Skip to content

Commit cea78fc

Browse files
committed
resolving Yannick's comments
1 parent 8890b0a commit cea78fc

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

app.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import Any, List
66

77
import ifcopenshell
8+
import ifcopenshell.geom
89
from shapely import Point, affinity
910
from viktor import Color, File, UserException, ViktorController, geometry
1011
from 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)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
viktor==13.7.0
1+
# viktor==13.7.0
22
ifcopenshell==0.7.0
33
shapely==2.0.0

0 commit comments

Comments
 (0)