mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
bim.create_all_shapes - allow selecting library to use
This commit is contained in:
@@ -251,6 +251,21 @@ class CreateAllShapes(bpy.types.Operator):
|
|||||||
bl_idname = "bim.create_all_shapes"
|
bl_idname = "bim.create_all_shapes"
|
||||||
bl_label = "Test All Shapes"
|
bl_label = "Test All Shapes"
|
||||||
bl_description = "Look for errors in all the shapes contained in the file"
|
bl_description = "Look for errors in all the shapes contained in the file"
|
||||||
|
bl_options = {"REGISTER"}
|
||||||
|
|
||||||
|
geometry_library: bpy.props.EnumProperty( # pyright: ignore[reportRedeclaration]
|
||||||
|
name="Geometry Library",
|
||||||
|
items=[(i, i, "") for i in get_args(ifcopenshell.geom.GEOMETRY_LIBRARY)],
|
||||||
|
default="opencascade",
|
||||||
|
)
|
||||||
|
custom_geometry_library: bpy.props.StringProperty( # pyright: ignore[reportRedeclaration]
|
||||||
|
name="Custom Geometry Library",
|
||||||
|
description="Provide a custom geometry library name, will override the 'geometry library' property.",
|
||||||
|
)
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
geometry_library: ifcopenshell.geom.GEOMETRY_LIBRARY
|
||||||
|
custom_geometry_library: str
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
@@ -258,6 +273,7 @@ class CreateAllShapes(bpy.types.Operator):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
self.file = tool.Ifc.get()
|
self.file = tool.Ifc.get()
|
||||||
|
geometry_library = self.custom_geometry_library or self.geometry_library
|
||||||
elements = self.file.by_type("IfcElement") + self.file.by_type("IfcSpace")
|
elements = self.file.by_type("IfcElement") + self.file.by_type("IfcSpace")
|
||||||
|
|
||||||
total = len(elements)
|
total = len(elements)
|
||||||
@@ -276,10 +292,10 @@ class CreateAllShapes(bpy.types.Operator):
|
|||||||
start = time.time()
|
start = time.time()
|
||||||
shape = None
|
shape = None
|
||||||
try:
|
try:
|
||||||
shape = ifcopenshell.geom.create_shape(settings, element)
|
shape = ifcopenshell.geom.create_shape(settings, element, geometry_library=geometry_library)
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
shape = ifcopenshell.geom.create_shape(settings_2d, element)
|
shape = ifcopenshell.geom.create_shape(settings_2d, element, geometry_library=geometry_library)
|
||||||
except:
|
except:
|
||||||
failures.append(element)
|
failures.append(element)
|
||||||
print("***** FAILURE *****")
|
print("***** FAILURE *****")
|
||||||
@@ -302,6 +318,7 @@ class CreateShapeFromStepId(bpy.types.Operator):
|
|||||||
bl_label = "Create Shape From STEP ID"
|
bl_label = "Create Shape From STEP ID"
|
||||||
bl_description = "Recreate a mesh object from a STEP ID"
|
bl_description = "Recreate a mesh object from a STEP ID"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
should_include_curves: bpy.props.BoolProperty()
|
should_include_curves: bpy.props.BoolProperty()
|
||||||
step_id: bpy.props.IntProperty(default=0)
|
step_id: bpy.props.IntProperty(default=0)
|
||||||
geometry_library: bpy.props.EnumProperty(
|
geometry_library: bpy.props.EnumProperty(
|
||||||
@@ -314,6 +331,12 @@ class CreateShapeFromStepId(bpy.types.Operator):
|
|||||||
description="Provide a custom geometry library name, will override the 'geometry library' property.",
|
description="Provide a custom geometry library name, will override the 'geometry library' property.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
should_include_curves: bool
|
||||||
|
step_id: int
|
||||||
|
geometry_library: ifcopenshell.geom.GEOMETRY_LIBRARY
|
||||||
|
custom_geometry_library: str
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
if not tool.Ifc.get():
|
if not tool.Ifc.get():
|
||||||
|
|||||||
Reference in New Issue
Block a user