55from typing import Any , List
66
77import ifcopenshell
8+ import ifcopenshell .geom
89from shapely import Point , affinity
910from viktor import Color , File , UserException , ViktorController , geometry
1011from viktor .geometry import Material , Triangle , TriangleAssembly
@@ -89,7 +90,7 @@ class Parametrization(ViktorParametrization):
8990 options = get_element_options ,
9091 )
9192
92- lb = LineBreak ()
93+ lb2 = LineBreak ()
9394 text3 = Text (
9495 """
9596## Download
@@ -109,7 +110,13 @@ class Controller(ViktorController):
109110 parametrization = Parametrization
110111
111112 def download_file (self , params , ** kwargs ):
112- model = load_ifc_file_into_model (params .ifc_upload .file )
113+ if params .get_sample_ifc_toggle == True :
114+ params .sample_ifc = File .from_path (
115+ Path (__file__ ).parent / "AC20-FZK-Haus (Sample IFC).ifc"
116+ )
117+ model = load_ifc_file_into_model (params .sample_ifc )
118+ else :
119+ model = load_ifc_file_into_model (params .ifc_upload .file )
113120 # remove all other parts from the ifc file which are not viewed
114121 for element in model .by_type ("IfcElement" ):
115122 if element .get_info ()["type" ] not in params .element_filter :
@@ -149,8 +156,8 @@ def ifc_view(params, **kwargs):
149156 # Create triangle assembly and assign material
150157 triangle_assembly = TriangleAssembly (
151158 triangles = get_faces_from_ifc_element (element , settings ),
152- material = material ,
153- )
159+ material = material
160+ )
154161 geometry_groups .append (triangle_assembly )
155162
156163 return GeometryResult (geometry_groups )
0 commit comments