See #3582. Fix bug where switching representations didn't handle curves in a body / model_view.

This means that if you created a curve body, you couldn't switch to it, or if you deleted everything, you ended up with an empty object. If you then tried to switch to that, it would "sync" the empty object and leave you with an empty cartesian point list. E.g:

 1. Create cube and assign IFC element.
 2. Remove all faces only (leaving edges and verts). Save changes.
 3. Switch to representation (bug!)
 4. Delete everything (no verts, edges, or faces). Attempt to save.
 5. "Revert" switch will fail, leading to empty mesh.
 6. Manually try to switch. Empty mesh will sync, creating an empty point list.
This commit is contained in:
Dion Moult
2023-08-15 18:06:02 +10:00
parent 4fe03230c5
commit b4e46da97f
+11 -4
View File
@@ -434,10 +434,17 @@ class Geometry(blenderbim.core.tool.Geometry):
context = representation.ContextOfItems
if context.ContextIdentifier == "Body" and context.TargetView == "MODEL_VIEW":
if element.is_a("IfcTypeProduct") or not apply_openings:
shape = ifcopenshell.geom.create_shape(settings, representation)
else:
shape = ifcopenshell.geom.create_shape(settings, element)
try:
if element.is_a("IfcTypeProduct") or not apply_openings:
shape = ifcopenshell.geom.create_shape(settings, representation)
else:
shape = ifcopenshell.geom.create_shape(settings, element)
except:
settings.set(settings.INCLUDE_CURVES, True)
if element.is_a("IfcTypeProduct") or not apply_openings:
shape = ifcopenshell.geom.create_shape(settings, representation)
else:
shape = ifcopenshell.geom.create_shape(settings, element)
else:
settings.set(settings.INCLUDE_CURVES, True)
shape = ifcopenshell.geom.create_shape(settings, representation)