This commit is contained in:
Andrej730
2024-03-25 14:42:26 +05:00
parent 9ae39f1edc
commit 98e0070be7
3 changed files with 10 additions and 8 deletions
@@ -1451,10 +1451,6 @@ class ActivateModel(bpy.types.Operator):
class ActivateDrawing(bpy.types.Operator):
"""
Activates the selected drawing view
"""
bl_idname = "bim.activate_drawing"
bl_label = "Activate Drawing"
bl_options = {"REGISTER", "UNDO"}
+6 -2
View File
@@ -440,7 +440,7 @@ class Drawing(blenderbim.core.tool.Drawing):
return results
@classmethod
def get_drawing_target_view(cls, drawing):
def get_drawing_target_view(cls, drawing: ifcopenshell.entity_instance) -> str:
return ifcopenshell.util.element.get_psets(drawing).get("EPset_Drawing", {}).get("TargetView", "MODEL_VIEW")
@classmethod
@@ -1661,6 +1661,8 @@ class Drawing(blenderbim.core.tool.Drawing):
filtered_elements = cls.get_drawing_elements(drawing) | cls.get_drawing_spaces(drawing)
filtered_elements.add(drawing)
# hide non-filtered elemenets
for view_layer_object in bpy.context.view_layer.objects:
element = tool.Ifc.get_entity(view_layer_object)
if not element or element.is_a("IfcTypeProduct"):
@@ -1669,7 +1671,7 @@ class Drawing(blenderbim.core.tool.Drawing):
view_layer_object.hide_set(hide)
view_layer_object.hide_render = hide
subcontexts = []
subcontexts: list[ifcopenshell.entity_instance] = []
target_view = cls.get_drawing_target_view(drawing)
if target_view in ("PLAN_VIEW", "REFLECTED_PLAN_VIEW"):
@@ -1702,6 +1704,8 @@ class Drawing(blenderbim.core.tool.Drawing):
if subcontext:
subcontexts.append(context_filter)
# switch representations and hide elements without representations
for element in filtered_elements:
obj = tool.Ifc.get_object(element)
current_representation = tool.Geometry.get_active_representation(obj)
+4 -2
View File
@@ -32,7 +32,7 @@ import blenderbim.bim.import_ifc
from math import radians, pi
from mathutils import Vector, Matrix
from blenderbim.bim.ifc import IfcStore
from typing import List
from typing import List, Union
class Geometry(blenderbim.core.tool.Geometry):
@@ -315,7 +315,9 @@ class Geometry(blenderbim.core.tool.Geometry):
return ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Body", "MODEL_VIEW")
@classmethod
def get_subcontext_parameters(cls, subcontext):
def get_subcontext_parameters(
cls, subcontext: ifcopenshell.entity_instance
) -> tuple[Union[str, None], Union[str, None], Union[str, None]]:
return (
subcontext.ContextType,
subcontext.ContextIdentifier,