mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
shape_builder.create_axis2_placement_2d
This commit is contained in:
@@ -228,10 +228,8 @@ class ShapeBuilder:
|
|||||||
:return: IfcCircle
|
:return: IfcCircle
|
||||||
:rtype: ifcopenshell.entity_instance
|
:rtype: ifcopenshell.entity_instance
|
||||||
"""
|
"""
|
||||||
ifc_center = self.file.createIfcAxis2Placement2D(self.file.createIfcCartesianPoint(center))
|
ifc_center = self.create_axis2_placement_2d(center)
|
||||||
ifc_curve = self.file.createIfcCircle(ifc_center, radius)
|
ifc_curve = self.file.createIfcCircle(ifc_center, radius)
|
||||||
|
|
||||||
# self.file_file.createIfcAxis2Placement2D(tool.Ifc.get().createIfcCartesianPoint(center[0:2]))
|
|
||||||
return ifc_curve
|
return ifc_curve
|
||||||
|
|
||||||
def plane(
|
def plane(
|
||||||
@@ -324,9 +322,7 @@ class ShapeBuilder:
|
|||||||
for further extrusion.
|
for further extrusion.
|
||||||
"""
|
"""
|
||||||
direction = self.file.createIfcDirection(ref_x_direction)
|
direction = self.file.createIfcDirection(ref_x_direction)
|
||||||
ifc_position = self.file.createIfcAxis2Placement2D(
|
ifc_position = self.create_axis2_placement_2d(position, direction)
|
||||||
self.file.createIfcCartesianPoint(position), RefDirection=direction
|
|
||||||
)
|
|
||||||
ifc_ellipse = self.file.createIfcEllipse(
|
ifc_ellipse = self.file.createIfcEllipse(
|
||||||
Position=ifc_position, SemiAxis1=x_axis_radius, SemiAxis2=y_axis_radius
|
Position=ifc_position, SemiAxis1=x_axis_radius, SemiAxis2=y_axis_radius
|
||||||
)
|
)
|
||||||
@@ -373,9 +369,7 @@ class ShapeBuilder:
|
|||||||
"OuterCurve": outer_curve,
|
"OuterCurve": outer_curve,
|
||||||
}
|
}
|
||||||
if self.file.schema == "IFC2X3":
|
if self.file.schema == "IFC2X3":
|
||||||
kwargs["Position"] = self.file.create_entity(
|
kwargs["Position"] = self.create_axis2_placement_2d()
|
||||||
"IfcAxis2Placement2D", self.file.create_entity("IfcCartesianPoint", [0.0, 0.0])
|
|
||||||
)
|
|
||||||
|
|
||||||
if inner_curves:
|
if inner_curves:
|
||||||
if not isinstance(inner_curves, collections.abc.Iterable):
|
if not isinstance(inner_curves, collections.abc.Iterable):
|
||||||
@@ -584,6 +578,17 @@ class ShapeBuilder:
|
|||||||
position=matrix[:, 3][:3].tolist(), z_axis=matrix[:, 2][:3].tolist(), x_axis=matrix[:, 0][:3].tolist()
|
position=matrix[:, 3][:3].tolist(), z_axis=matrix[:, 2][:3].tolist(), x_axis=matrix[:, 0][:3].tolist()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def create_axis2_placement_2d(
|
||||||
|
self, position: VectorTuple = (0.0, 0.0), x_direction: Optional[VectorTuple] = None
|
||||||
|
) -> ifcopenshell.entity_instance:
|
||||||
|
"""Create IfcAxis2Placement2D."""
|
||||||
|
ref_direction = self.file.create_entity("IfcDirection", x_direction) if x_direction else None
|
||||||
|
return self.file.create_entity(
|
||||||
|
"IfcAxis2Placement2D",
|
||||||
|
Location=self.file.create_entity("IfcCartesianPoint", position),
|
||||||
|
RefDirection=ref_direction,
|
||||||
|
)
|
||||||
|
|
||||||
def mirror(
|
def mirror(
|
||||||
self,
|
self,
|
||||||
curve_or_item: Union[ifcopenshell.entity_instance, list[ifcopenshell.entity_instance]],
|
curve_or_item: Union[ifcopenshell.entity_instance, list[ifcopenshell.entity_instance]],
|
||||||
|
|||||||
@@ -31,12 +31,10 @@ class TestCreatingShapes(test.bootstrap.IFC4):
|
|||||||
assert shape.verts
|
assert shape.verts
|
||||||
|
|
||||||
def test_create_IfcEllipse(self):
|
def test_create_IfcEllipse(self):
|
||||||
ifc_position = self.file.create_entity(
|
builder = ShapeBuilder(self.file)
|
||||||
"IfcAxis2Placement2D",
|
item = self.file.create_entity(
|
||||||
self.file.create_entity("IfcCartesianPoint", V(0, 0)),
|
"IfcEllipse", Position=builder.create_axis2_placement_2d(), SemiAxis1=1.0, SemiAxis2=0.5
|
||||||
RefDirection=self.file.create_entity("IfcDirection", V(1, 0)),
|
|
||||||
)
|
)
|
||||||
item = self.file.create_entity("IfcEllipse", Position=ifc_position, SemiAxis1=1.0, SemiAxis2=0.5)
|
|
||||||
settings = ifcopenshell.geom.settings()
|
settings = ifcopenshell.geom.settings()
|
||||||
shape = ifcopenshell.geom.create_shape(settings, item)
|
shape = ifcopenshell.geom.create_shape(settings, item)
|
||||||
assert shape.verts
|
assert shape.verts
|
||||||
|
|||||||
Reference in New Issue
Block a user