mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 12:32:39 +00:00
Changes are now synchronised prior to switching representations.
This commit is contained in:
@@ -160,10 +160,35 @@ class Geometry(blenderbim.core.tool.Geometry):
|
||||
ifc_importer.material_creator.create(element, obj, mesh)
|
||||
return mesh
|
||||
|
||||
@classmethod
|
||||
def import_representation_parameters(cls, data):
|
||||
props = data.BIMMeshProperties
|
||||
elements = tool.Ifc.get().traverse(tool.Ifc.get().by_id(props.ifc_definition_id))
|
||||
props.ifc_parameters.clear()
|
||||
for element in elements:
|
||||
if element.is_a("IfcRepresentationItem") or element.is_a("IfcParameterizedProfileDef"):
|
||||
for i in range(0, len(element)):
|
||||
if element.attribute_type(i) == "DOUBLE":
|
||||
new = props.ifc_parameters.add()
|
||||
new.name = "{}/{}".format(element.is_a(), element.attribute_name(i))
|
||||
new.step_id = element.id()
|
||||
new.type = element.attribute_type(i)
|
||||
new.index = i
|
||||
if element[i]:
|
||||
new.value = element[i]
|
||||
|
||||
@classmethod
|
||||
def is_body_representation(cls, representation):
|
||||
return representation.ContextOfItems.ContextIdentifier == "Body"
|
||||
|
||||
@classmethod
|
||||
def is_box_representation(cls, representation):
|
||||
return representation.ContextOfItems.ContextIdentifier == "Box"
|
||||
|
||||
@classmethod
|
||||
def is_edited(cls, obj):
|
||||
return list(obj.scale) != [1.0, 1.0, 1.0] or obj in IfcStore.edited_objs
|
||||
|
||||
@classmethod
|
||||
def is_mapped_representation(cls, representation):
|
||||
return representation.RepresentationType == "MappedRepresentation"
|
||||
@@ -200,6 +225,10 @@ class Geometry(blenderbim.core.tool.Geometry):
|
||||
return cls.resolve_mapped_representation(representation.Items[0].MappingSource.MappedRepresentation)
|
||||
return representation
|
||||
|
||||
@classmethod
|
||||
def run_geometry_update_representation(cls, obj=None):
|
||||
bpy.ops.bim.update_representation(obj=obj.name, ifc_representation_class="")
|
||||
|
||||
@classmethod
|
||||
def should_force_faceted_brep(cls):
|
||||
return bpy.context.scene.BIMGeometryProperties.should_force_faceted_brep
|
||||
|
||||
@@ -114,4 +114,5 @@ class Type(blenderbim.core.tool.Type):
|
||||
should_reload=should_reload,
|
||||
enable_dynamic_voids=enable_dynamic_voids,
|
||||
is_global=is_global,
|
||||
should_sync_changes_first=False,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user