mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Reuse builder.create_axis2_placement_3d
This commit is contained in:
@@ -21,6 +21,7 @@ import numpy as np
|
||||
import ifcopenshell
|
||||
from typing import Any, Union
|
||||
from dataclasses import dataclass
|
||||
from ifcopenshell.util.shape_builder import ShapeBuilder
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -78,9 +79,7 @@ class Clipping:
|
||||
|
||||
if not ifc_file:
|
||||
ifc_file = first_operand.file
|
||||
|
||||
location = ifc_file.createIfcCartesianPoint([i / unit_scale for i in self.location])
|
||||
direction = ifc_file.createIfcDirection(self.normal)
|
||||
builder = ShapeBuilder(ifc_file)
|
||||
|
||||
normal = np.array(self.normal)
|
||||
if np.allclose(normal, np.array([0.0, 0.0, 1.0]), atol=1e-2) or np.allclose(
|
||||
@@ -92,9 +91,9 @@ class Clipping:
|
||||
|
||||
x_axis = np.cross(normal, arbitrary_vector)
|
||||
x_axis /= np.linalg.norm(x_axis)
|
||||
x_axis = ifc_file.createIfcDirection(x_axis.tolist())
|
||||
|
||||
plane = ifc_file.createIfcPlane(ifc_file.createIfcAxis2Placement3D(location, direction, x_axis))
|
||||
placement = builder.create_axis2_placement_3d([i / unit_scale for i in self.location], self.normal, x_axis)
|
||||
plane = ifc_file.create_entity("IfcPlane", placement)
|
||||
|
||||
second_operand = ifc_file.createIfcHalfSpaceSolid(plane, False)
|
||||
return ifc_file.createIfcBooleanClippingResult("DIFFERENCE", first_operand, second_operand)
|
||||
|
||||
Reference in New Issue
Block a user