Fix 3 bugs related to representations:

* Bug when switching representations when active object not selected.
 * Bug when switching to a non MODEL_VIEW body representation would load the MODEL_VIEW one instead all the time.
 * Add support for plan body representations.
This commit is contained in:
Dion Moult
2023-02-03 21:27:25 +11:00
parent 1ed7b21ab0
commit e1e4380fc7
3 changed files with 4 additions and 3 deletions
@@ -116,7 +116,7 @@ class SwitchRepresentation(bpy.types.Operator, Operator):
def _execute(self, context):
target = tool.Ifc.get().by_id(self.ifc_definition_id).ContextOfItems
is_subcontext = target.is_a("IfcGeometricRepresentationSubContext")
for obj in context.selected_objects:
for obj in set(context.selected_objects + [context.active_object]):
element = tool.Ifc.get_entity(obj)
if not element:
continue
+2 -1
View File
@@ -174,7 +174,8 @@ class Geometry(blenderbim.core.tool.Geometry):
settings = ifcopenshell.geom.settings()
settings.set(settings.WELD_VERTICES, True)
if representation.ContextOfItems.ContextIdentifier == "Body":
context = representation.ContextOfItems
if context.ContextIdentifier == "Body" and context.TargetView == "MODEL_VIEW":
if element.is_a("IfcTypeProduct"):
shape = ifcopenshell.geom.create_shape(settings, representation)
else:
@@ -153,7 +153,7 @@ class Usecase:
elif self.settings["context"].ContextIdentifier == "Axis":
return self.create_curve2d_representation()
elif self.settings["context"].ContextIdentifier == "Body":
pass
return self.create_annotation2d_representation()
elif self.settings["context"].ContextIdentifier == "Box":
pass
elif self.settings["context"].ContextIdentifier == "Clearance":