mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 16:46:19 +00:00
bim.create_shape_from_step_id to include ifc class and id to object name
This commit is contained in:
@@ -246,13 +246,16 @@ class CreateShapeFromStepId(bpy.types.Operator):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return IfcStore.get_file()
|
if not tool.Ifc.get():
|
||||||
|
cls.poll_message_set("No IFC file is loaded.")
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
geometry_library = self.custom_geometry_library or self.geometry_library
|
geometry_library = self.custom_geometry_library or self.geometry_library
|
||||||
logger = logging.getLogger("ImportIFC")
|
logger = logging.getLogger("ImportIFC")
|
||||||
self.ifc_import_settings = import_ifc.IfcImportSettings.factory(context, IfcStore.path, logger)
|
self.ifc_import_settings = import_ifc.IfcImportSettings.factory(context, IfcStore.path, logger)
|
||||||
self.file = IfcStore.get_file()
|
self.file = tool.Ifc.get()
|
||||||
element = self.file.by_id(self.step_id or int(context.scene.BIMDebugProperties.step_id))
|
element = self.file.by_id(self.step_id or int(context.scene.BIMDebugProperties.step_id))
|
||||||
settings = ifcopenshell.geom.settings()
|
settings = ifcopenshell.geom.settings()
|
||||||
settings.set("keep-bounding-boxes", True)
|
settings.set("keep-bounding-boxes", True)
|
||||||
@@ -265,7 +268,7 @@ class CreateShapeFromStepId(bpy.types.Operator):
|
|||||||
mesh = ifc_importer.create_mesh(element, shape)
|
mesh = ifc_importer.create_mesh(element, shape)
|
||||||
else:
|
else:
|
||||||
mesh = None
|
mesh = None
|
||||||
obj = bpy.data.objects.new("Debug", mesh)
|
obj = bpy.data.objects.new(f"Debug/{element.is_a()}/{element.id()}", mesh)
|
||||||
context.scene.collection.objects.link(obj)
|
context.scene.collection.objects.link(obj)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user