mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Move boundary origin to space origin
Ensure that boundary origin is same as space origin to assign correct geometry into IFC.
This commit is contained in:
@@ -285,6 +285,7 @@ class UpdateBoundaryGeometry(bpy.types.Operator):
|
||||
return IfcStore.execute_ifc_operator(self, context)
|
||||
|
||||
def _execute(self, context):
|
||||
tool.Boundary.move_origin_to_space_origin(context.active_object)
|
||||
settings = tool.Boundary.get_assign_connection_geometry_settings(context.active_object)
|
||||
ifcopenshell.api.run("boundary.assign_connection_geometry", tool.Ifc.get(), **settings)
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -62,3 +62,12 @@ class Boundary(blenderbim.core.tool.Boundary):
|
||||
def polyline_to_2d(cls, polyline, placement_matrix):
|
||||
matrix_inv = placement_matrix.inverted()
|
||||
return tuple((matrix_inv @ v).to_2d() for v in polyline)
|
||||
|
||||
@classmethod
|
||||
def move_origin_to_space_origin(cls, obj):
|
||||
model = tool.Ifc.get()
|
||||
boundary = tool.Ifc.get_entity(obj)
|
||||
space = tool.Ifc.get_object(boundary.RelatingSpace)
|
||||
translation = obj.matrix_world.translation - space.matrix_world.translation
|
||||
obj.data.transform(mathutils.Matrix.Translation(translation))
|
||||
obj.matrix_world = space.matrix_world
|
||||
|
||||
Reference in New Issue
Block a user