Fix #4076. Fix bug where drawing activation priorities didn't match drawing generation priorities, and switching to a text literal representation failed.

This commit is contained in:
Dion Moult
2023-12-06 23:04:21 +11:00
parent ff4eddf38a
commit d6c020b5ee
3 changed files with 32 additions and 4 deletions
@@ -106,6 +106,9 @@ def switch_representation(
entity = ifc.get_entity(obj)
current_obj_data = geometry.get_object_data(obj)
if not current_obj_data and geometry.is_text_literal(representation):
return
has_openings = apply_openings and getattr(entity, "HasOpenings", None)
if has_openings:
# if it has openings make sure to switch to element's mapped representation
+25 -4
View File
@@ -1636,11 +1636,32 @@ class Drawing(blenderbim.core.tool.Drawing):
subcontexts = []
target_view = cls.get_drawing_target_view(drawing)
context_filters = [("Model", "Body", target_view), ("Model", "Body", "MODEL_VIEW")]
if target_view in ("PLAN_VIEW", "REFLECTED_PLAN_VIEW"):
plan_contexts = [("Plan", "Body", target_view), ("Plan", "Body", "MODEL_VIEW")]
plan_contexts.extend(context_filters)
context_filters = plan_contexts
context_filters = [
("Plan", "Body", target_view),
("Plan", "Body", "MODEL_VIEW"),
("Plan", "Facetation", target_view),
("Plan", "Facetation", "MODEL_VIEW"),
("Model", "Body", target_view),
("Model", "Body", "MODEL_VIEW"),
("Model", "Facetation", target_view),
("Model", "Facetation", "MODEL_VIEW"),
("Plan", "Annotation", target_view),
("Plan", "Annotation", "MODEL_VIEW"),
("Model", "Annotation", target_view),
("Model", "Annotation", "MODEL_VIEW"),
]
else:
context_filters = [
("Model", "Body", target_view),
("Model", "Body", "MODEL_VIEW"),
("Model", "Facetation", target_view),
("Model", "Facetation", "MODEL_VIEW"),
("Model", "Annotation", target_view),
("Model", "Annotation", "MODEL_VIEW"),
]
for context_filter in context_filters:
subcontext = ifcopenshell.util.representation.get_context(tool.Ifc.get(), *context_filter)
if subcontext:
@@ -586,6 +586,10 @@ class Geometry(blenderbim.core.tool.Geometry):
"SweptSolid",
)
@classmethod
def is_text_literal(cls, representation):
return bool([i for i in representation.Items if i.is_a("IfcTextLiteral")])
@classmethod
def is_type_product(cls, element):
return element.is_a("IfcTypeProduct")