mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Store the IFC geometry type on import. See #865.
This commit is contained in:
@@ -46,7 +46,6 @@ class MaterialCreator():
|
||||
if self.parse_representations(element):
|
||||
self.assign_material_slots_to_faces(obj, self.mesh)
|
||||
self.parsed_meshes.append(self.mesh.name)
|
||||
return # styled items override material styles
|
||||
|
||||
def parse_representations(self, element):
|
||||
has_parsed = False
|
||||
@@ -1220,6 +1219,17 @@ class IfcImporter():
|
||||
and representation.RepresentationType == 'MappedRepresentation':
|
||||
return representation.Items[0].MappingTarget
|
||||
|
||||
def get_geometry_type(self, element):
|
||||
if hasattr(element, 'Representation'):
|
||||
tree = self.file.traverse(element.Representation)
|
||||
elif hasattr(element, 'RepresentationMaps'):
|
||||
tree = self.file.traverse(element.RepresentationMaps)
|
||||
representations = [e for e in tree if e.is_a('IfcRepresentation') \
|
||||
and e.RepresentationIdentifier == 'Body' \
|
||||
and e.RepresentationType != 'MappedRepresentation']
|
||||
for representation in representations:
|
||||
return representation.Items[0].is_a()
|
||||
|
||||
def create_mesh(self, element, shape, is_curve=False):
|
||||
try:
|
||||
if hasattr(shape, 'geometry'):
|
||||
@@ -1252,6 +1262,7 @@ class IfcImporter():
|
||||
ios_materials.append(mat.name)
|
||||
mesh['ios_materials'] = ios_materials
|
||||
mesh['ios_material_ids'] = geometry.material_ids
|
||||
mesh.BIMMeshProperties.geometry_type = self.get_geometry_type(element)
|
||||
return mesh
|
||||
except:
|
||||
self.ifc_import_settings.logger.error('Could not create mesh for {}: {}/{}'.format(element.GlobalId, self.get_name(element)))
|
||||
|
||||
@@ -1074,3 +1074,4 @@ class BIMMeshProperties(PropertyGroup):
|
||||
swept_solids: CollectionProperty(name="Swept Solids", type=SweptSolid)
|
||||
is_parametric: BoolProperty(name='Is Parametric', default=False)
|
||||
presentation_layer: StringProperty(name="Presentation Layer")
|
||||
geometry_type: StringProperty(name="Geometry Type")
|
||||
|
||||
@@ -406,6 +406,8 @@ class BIM_PT_mesh(Panel):
|
||||
row = layout.row(align=True)
|
||||
row.operator('bim.push_representation')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'geometry_type')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'presentation_layer')
|
||||
|
||||
Reference in New Issue
Block a user