mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 05:46:51 +00:00
Purge usage of mathutils in grid API functions
The only thing left is add_representation which is Blender specific anyway and is slowly being refactored out.
This commit is contained in:
@@ -474,7 +474,7 @@ class UpdateRepresentation(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
if product.is_a("IfcGridAxis"):
|
||||
# Grid geometry does not follow the "representation" paradigm and needs to be treated specially
|
||||
ifcopenshell.api.grid.create_axis_curve(self.file, axis_curve=obj, grid_axis=product)
|
||||
tool.Model.create_axis_curve(obj, product)
|
||||
return
|
||||
elif product.is_a("IfcRelSpaceBoundary"):
|
||||
# TODO refactor
|
||||
|
||||
@@ -50,7 +50,7 @@ def add_object(self, context):
|
||||
"grid.create_grid_axis", tool.Ifc.get(), axis_tag=tag, uvw_axes="UAxes", grid=grid
|
||||
)
|
||||
tool.Ifc.link(result, obj)
|
||||
ifcopenshell.api.run("grid.create_axis_curve", tool.Ifc.get(), axis_curve=obj, grid_axis=result)
|
||||
tool.Model.create_axis_curve(obj, result)
|
||||
tool.Collector.assign(obj)
|
||||
|
||||
for i in range(0, self.total_v):
|
||||
@@ -69,7 +69,7 @@ def add_object(self, context):
|
||||
"grid.create_grid_axis", tool.Ifc.get(), axis_tag=tag, uvw_axes="VAxes", grid=grid
|
||||
)
|
||||
tool.Ifc.link(result, obj)
|
||||
ifcopenshell.api.run("grid.create_axis_curve", tool.Ifc.get(), axis_curve=obj, grid_axis=result)
|
||||
tool.Model.create_axis_curve(obj, result)
|
||||
tool.Collector.assign(obj)
|
||||
|
||||
tool.Root.reload_grid_decorator()
|
||||
|
||||
@@ -1978,3 +1978,11 @@ class Model(bonsai.core.tool.Model):
|
||||
x_angle = Vector((0, 1)).angle_signed(Vector((y, z)))
|
||||
|
||||
return x_angle
|
||||
|
||||
@classmethod
|
||||
def create_axis_curve(cls, obj: bpy.types.Object, grid_axis: ifcopenshell.entity_instance):
|
||||
m = tool.Surveyor.get_absolute_matrix(obj)
|
||||
points = [m @ np.array(v.co.to_4d()) for v in obj.data.vertices[0:2]]
|
||||
ifcopenshell.api.grid.create_axis_curve(
|
||||
tool.Ifc.get(), p1=points[0], p2=points[1], is_si=True, grid_axis=grid_axis
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user