Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit b0bd027

Browse files
committed
Optimise import to only consider surface styles
1 parent 8bf530d commit b0bd027

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/ifcblenderexport/blenderbim/bim/import_ifc.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,11 @@ def parse_representation_item(self, item):
8585
item_id = self.mesh.BIMMeshProperties.ifc_item_ids.add()
8686
item_id.name = str(item.id())
8787

88-
styled_item = item.StyledByItem[0]
89-
style_name = self.get_style_name(styled_item)
88+
styled_item = item.StyledByItem[0] # Cardinality is S[0:1]
89+
style_name = self.get_surface_style_name(styled_item)
90+
91+
if not style_name:
92+
return
9093

9194
if self.mesh.materials.get(style_name):
9295
item_id.slot_index = self.mesh.materials.find(style_name)
@@ -266,7 +269,7 @@ def create_new_single(self, material):
266269
continue
267270
self.parse_styled_item(item, obj)
268271

269-
def get_style_name(self, styled_item):
272+
def get_surface_style_name(self, styled_item):
270273
if styled_item.Name:
271274
return styled_item.Name
272275
styles = self.get_styled_item_styles(styled_item)
@@ -276,7 +279,7 @@ def get_style_name(self, styled_item):
276279
if style.Name:
277280
return style.Name
278281
return str(style.id())
279-
return str(styled_item.id())
282+
return None # We only support surface styles right now
280283

281284
def parse_styled_item(self, styled_item, material):
282285
styles = self.get_styled_item_styles(styled_item)
@@ -1098,7 +1101,7 @@ def get_representation_item_material_name(self, item):
10981101
if not item.StyledByItem:
10991102
return
11001103
styled_item = item.StyledByItem[0]
1101-
return self.material_creator.get_style_name(styled_item)
1104+
return self.material_creator.get_surface_style_name(styled_item)
11021105

11031106
def transform_curve(self, curve, matrix):
11041107
for spline in curve.splines:

0 commit comments

Comments
 (0)