mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
small refactor
This commit is contained in:
@@ -1920,7 +1920,7 @@ class IfcImporter:
|
|||||||
|
|
||||||
def link_element(self, element, obj):
|
def link_element(self, element, obj):
|
||||||
self.added_data[element.id()] = obj
|
self.added_data[element.id()] = obj
|
||||||
IfcStore.link_element(element, obj)
|
tool.Ifc.link(element, obj)
|
||||||
|
|
||||||
def set_matrix_world(self, obj, matrix_world):
|
def set_matrix_world(self, obj, matrix_world):
|
||||||
obj.matrix_world = matrix_world
|
obj.matrix_world = matrix_world
|
||||||
|
|||||||
@@ -18,12 +18,10 @@
|
|||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import ifcopenshell.api
|
import ifcopenshell.api
|
||||||
import blenderbim.core.spatial
|
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from bpy.types import Operator
|
from bpy.types import Operator
|
||||||
from bpy.props import FloatProperty, IntProperty
|
from bpy.props import FloatProperty, IntProperty
|
||||||
from mathutils import Vector
|
from mathutils import Vector
|
||||||
from blenderbim.bim.ifc import IfcStore
|
|
||||||
|
|
||||||
|
|
||||||
def add_object(self, context):
|
def add_object(self, context):
|
||||||
@@ -66,7 +64,7 @@ def add_object(self, context):
|
|||||||
tool.Ifc.get(),
|
tool.Ifc.get(),
|
||||||
**{"axis_tag": tag, "uvw_axes": "UAxes", "grid": grid},
|
**{"axis_tag": tag, "uvw_axes": "UAxes", "grid": grid},
|
||||||
)
|
)
|
||||||
IfcStore.link_element(result, obj)
|
tool.Ifc.link(result, obj)
|
||||||
ifcopenshell.api.run("grid.create_axis_curve", tool.Ifc.get(), **{"axis_curve": obj, "grid_axis": result})
|
ifcopenshell.api.run("grid.create_axis_curve", tool.Ifc.get(), **{"axis_curve": obj, "grid_axis": result})
|
||||||
obj.BIMObjectProperties.ifc_definition_id = result.id()
|
obj.BIMObjectProperties.ifc_definition_id = result.id()
|
||||||
|
|
||||||
@@ -91,7 +89,7 @@ def add_object(self, context):
|
|||||||
tool.Ifc.get(),
|
tool.Ifc.get(),
|
||||||
**{"axis_tag": tag, "uvw_axes": "VAxes", "grid": grid},
|
**{"axis_tag": tag, "uvw_axes": "VAxes", "grid": grid},
|
||||||
)
|
)
|
||||||
IfcStore.link_element(result, obj)
|
tool.Ifc.link(result, obj)
|
||||||
ifcopenshell.api.run("grid.create_axis_curve", tool.Ifc.get(), **{"axis_curve": obj, "grid_axis": result})
|
ifcopenshell.api.run("grid.create_axis_curve", tool.Ifc.get(), **{"axis_curve": obj, "grid_axis": result})
|
||||||
obj.BIMObjectProperties.ifc_definition_id = result.id()
|
obj.BIMObjectProperties.ifc_definition_id = result.id()
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class ReassignClass(bpy.types.Operator):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
obj.name = "{}/{}".format(product.is_a(), getattr(product, "Name", "None"))
|
obj.name = "{}/{}".format(product.is_a(), getattr(product, "Name", "None"))
|
||||||
IfcStore.link_element(product, obj)
|
tool.Ifc.link(product, obj)
|
||||||
obj.BIMObjectProperties.is_reassigning_class = False
|
obj.BIMObjectProperties.is_reassigning_class = False
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ class UnlinkObject(bpy.types.Operator):
|
|||||||
obj = obj_copy
|
obj = obj_copy
|
||||||
if obj in IfcStore.edited_objs:
|
if obj in IfcStore.edited_objs:
|
||||||
IfcStore.edited_objs.remove(obj)
|
IfcStore.edited_objs.remove(obj)
|
||||||
IfcStore.unlink_element(obj=obj)
|
tool.Ifc.unlink_element(obj=obj)
|
||||||
if obj.data:
|
if obj.data:
|
||||||
obj.data = obj.data.copy()
|
obj.data = obj.data.copy()
|
||||||
for material_slot in obj.material_slots:
|
for material_slot in obj.material_slots:
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ class RemoveOpening(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
|
|
||||||
if opening_obj:
|
if opening_obj:
|
||||||
opening_obj.name = "/".join(opening_obj.name.split("/")[1:])
|
opening_obj.name = "/".join(opening_obj.name.split("/")[1:])
|
||||||
IfcStore.unlink_element(obj=opening_obj)
|
tool.Ifc.unlink(obj=opening_obj)
|
||||||
|
|
||||||
ifcopenshell.api.run("void.remove_opening", tool.Ifc.get(), opening=opening)
|
ifcopenshell.api.run("void.remove_opening", tool.Ifc.get(), opening=opening)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user