Fix bug where assigning a type did not use existing representation data in the scene if the context had changed

This commit is contained in:
Dion Moult
2021-11-06 20:56:53 +11:00
parent 4149292a13
commit 8e215382f7
9 changed files with 99 additions and 66 deletions
@@ -52,7 +52,6 @@ class Geometry(blenderbim.core.tool.Geometry):
modifier.solver = "EXACT"
modifier.use_self = True
@classmethod
def delete_data(cls, data):
bpy.data.meshes.remove(data)
+11 -7
View File
@@ -25,15 +25,15 @@ import blenderbim.bim.helper
class Type(blenderbim.core.tool.Type):
@classmethod
def disable_editing(cls, obj):
obj.BIMTypeProperties.is_editing_type = False
def change_object_data(cls, obj, data, is_global=False):
if is_global:
obj.data.user_remap(data)
else:
obj.data = data
@classmethod
def get_any_representation(cls, element):
if element.is_a("IfcProduct") and element.Representation and element.Representation.Representations:
return element.Representation.Representations[0]
elif element.is_a("IfcTypeProduct") and element.RepresentationMaps:
return element.RepresentationMaps[0].MappedRepresentation
def disable_editing(cls, obj):
obj.BIMTypeProperties.is_editing_type = False
@classmethod
def get_body_context(cls):
@@ -59,6 +59,10 @@ class Type(blenderbim.core.tool.Type):
elif material.is_a("IfcMaterialLayerSetUsage"):
return "IfcExtrudedAreaSolid/IfcArbitraryProfileDefWithVoids"
@classmethod
def get_object_data(cls, obj):
return obj.data
@classmethod
def get_profile_set_usage(cls, element):
material = ifcopenshell.util.element.get_material(element)