mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Add polyline tool for slabs.
No preview yet.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
import ifcopenshell.util.unit
|
||||
from ifcopenshell.util.data import Clipping
|
||||
from math import sin, cos
|
||||
from mathutils import Vector
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
|
||||
@@ -34,6 +35,7 @@ def add_slab_representation(
|
||||
# Planes are defined either by Clipping objects
|
||||
# or by dictionaries of arguments for `Clipping.parse`
|
||||
clippings: Optional[list[Union[Clipping, dict[str, Any]]]] = None,
|
||||
polyline: Optional[list[Vector]] = None,
|
||||
) -> ifcopenshell.entity_instance:
|
||||
usecase = Usecase()
|
||||
usecase.file = file
|
||||
@@ -42,6 +44,7 @@ def add_slab_representation(
|
||||
"depth": depth,
|
||||
"x_angle": x_angle,
|
||||
"clippings": clippings if clippings is not None else [],
|
||||
"polyline": polyline,
|
||||
}
|
||||
return usecase.execute()
|
||||
|
||||
@@ -59,6 +62,8 @@ class Usecase:
|
||||
def create_item(self):
|
||||
size = self.convert_si_to_unit(1)
|
||||
points = ((0.0, 0.0), (size, 0.0), (size, size), (0.0, size), (0.0, 0.0))
|
||||
if self.settings["polyline"]:
|
||||
points = [(self.convert_si_to_unit(p[0]), self.convert_si_to_unit(p[1])) for p in self.settings["polyline"]]
|
||||
if self.file.schema == "IFC2X3":
|
||||
curve = self.file.createIfcPolyline([self.file.createIfcCartesianPoint(p) for p in points])
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user