mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 14:02:27 +00:00
typing
This commit is contained in:
@@ -1451,10 +1451,6 @@ class ActivateModel(bpy.types.Operator):
|
|||||||
|
|
||||||
|
|
||||||
class ActivateDrawing(bpy.types.Operator):
|
class ActivateDrawing(bpy.types.Operator):
|
||||||
"""
|
|
||||||
Activates the selected drawing view
|
|
||||||
"""
|
|
||||||
|
|
||||||
bl_idname = "bim.activate_drawing"
|
bl_idname = "bim.activate_drawing"
|
||||||
bl_label = "Activate Drawing"
|
bl_label = "Activate Drawing"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ class Drawing(blenderbim.core.tool.Drawing):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
@classmethod
|
@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")
|
return ifcopenshell.util.element.get_psets(drawing).get("EPset_Drawing", {}).get("TargetView", "MODEL_VIEW")
|
||||||
|
|
||||||
@classmethod
|
@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 = cls.get_drawing_elements(drawing) | cls.get_drawing_spaces(drawing)
|
||||||
filtered_elements.add(drawing)
|
filtered_elements.add(drawing)
|
||||||
|
|
||||||
|
# hide non-filtered elemenets
|
||||||
for view_layer_object in bpy.context.view_layer.objects:
|
for view_layer_object in bpy.context.view_layer.objects:
|
||||||
element = tool.Ifc.get_entity(view_layer_object)
|
element = tool.Ifc.get_entity(view_layer_object)
|
||||||
if not element or element.is_a("IfcTypeProduct"):
|
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_set(hide)
|
||||||
view_layer_object.hide_render = hide
|
view_layer_object.hide_render = hide
|
||||||
|
|
||||||
subcontexts = []
|
subcontexts: list[ifcopenshell.entity_instance] = []
|
||||||
target_view = cls.get_drawing_target_view(drawing)
|
target_view = cls.get_drawing_target_view(drawing)
|
||||||
|
|
||||||
if target_view in ("PLAN_VIEW", "REFLECTED_PLAN_VIEW"):
|
if target_view in ("PLAN_VIEW", "REFLECTED_PLAN_VIEW"):
|
||||||
@@ -1702,6 +1704,8 @@ class Drawing(blenderbim.core.tool.Drawing):
|
|||||||
if subcontext:
|
if subcontext:
|
||||||
subcontexts.append(context_filter)
|
subcontexts.append(context_filter)
|
||||||
|
|
||||||
|
|
||||||
|
# switch representations and hide elements without representations
|
||||||
for element in filtered_elements:
|
for element in filtered_elements:
|
||||||
obj = tool.Ifc.get_object(element)
|
obj = tool.Ifc.get_object(element)
|
||||||
current_representation = tool.Geometry.get_active_representation(obj)
|
current_representation = tool.Geometry.get_active_representation(obj)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import blenderbim.bim.import_ifc
|
|||||||
from math import radians, pi
|
from math import radians, pi
|
||||||
from mathutils import Vector, Matrix
|
from mathutils import Vector, Matrix
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from typing import List
|
from typing import List, Union
|
||||||
|
|
||||||
|
|
||||||
class Geometry(blenderbim.core.tool.Geometry):
|
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")
|
return ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Body", "MODEL_VIEW")
|
||||||
|
|
||||||
@classmethod
|
@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 (
|
return (
|
||||||
subcontext.ContextType,
|
subcontext.ContextType,
|
||||||
subcontext.ContextIdentifier,
|
subcontext.ContextIdentifier,
|
||||||
|
|||||||
Reference in New Issue
Block a user