shape builder docs fixes

This commit is contained in:
Andrej730
2024-01-24 16:14:26 +05:00
parent 3fbd9d7cdf
commit 2ab32e41b2
@@ -52,22 +52,23 @@ class ShapeBuilder:
def polyline( def polyline(
self, points: List[Vector], closed: bool = False, position_offset: Vector = None, arc_points: List[int] = [] self, points: List[Vector], closed: bool = False, position_offset: Vector = None, arc_points: List[int] = []
): ) -> ifcopenshell.entity_instance:
""" """
Generate an IfcIndexedPolyCurve based on the provided points. Generate an IfcIndexedPolyCurve based on the provided points.
:param points: List of points formatted as ( (x0, y0), (x1, y1) ) :param points: List of 2d or 3d points
:type: List[Vector] :param type: List[Vector]
:param closed: Whether polyline should be closed. Default is False. :param closed: Whether polyline should be closed. Default is `False`
:type: bool, optional :param type: bool, optional
:param position_offset: Optional offset to be applied to all points. :param position_offset: offset to be applied to all points
:type: Optional[Vector] :param type: Vector, optional
:param arc_points: Indices of the middle points for arcs. For creating an arc segment, :param arc_points: Indices of the middle points for arcs. For creating an arc segment,
provide 3 points: `arc_start`, `arc_middle` and `arc_end` and add the `arc_middle` provide 3 points: `arc_start`, `arc_middle` and `arc_end` and add the `arc_middle`
point's index to this list. point's index to this list
:type: List[int] :param type: List[int]
:return: IfcIndexedPolyCurve :return: IfcIndexedPolyCurve
:rtype: ifcopenshell.entity_instance
""" """
if arc_points and self.file.schema == "IFC2X3": if arc_points and self.file.schema == "IFC2X3":
@@ -150,17 +151,20 @@ class ShapeBuilder:
] ]
return points return points
def rectangle(self, size: Vector = Vector((1.0, 1.0)).freeze(), position: Vector = None): def rectangle(
self, size: Vector = Vector((1.0, 1.0)).freeze(), position: Vector = None
) -> ifcopenshell.entity_instance:
""" """
Generate a rectangle polyline, method supports both 2d and 3d rectangle sizes. Generate a rectangle polyline.
:param size: rectangle size :param size: rectangle size, could be either 2d or 3d, defaults to `(1,1)`
:param type: Vector :param type: Vector, optional
:param size: rectangle position, default to `None`. :param size: rectangle position, default to `None`.
if `position` not specified zero-vector will be used if `position` not specified zero-vector will be used
:param type: Vector, optional :param type: Vector, optional
:return: IfcIndexedPolyCurve :return: IfcIndexedPolyCurve
:rtype: ifcopenshell.entity_instance
""" """
return self.polyline(self.get_rectangle_coords(size, position), closed=True) return self.polyline(self.get_rectangle_coords(size, position), closed=True)
@@ -642,16 +646,17 @@ class ShapeBuilder:
disk_solid = self.file.createIfcSweptDiskSolid(Directrix=path_curve, Radius=radius) disk_solid = self.file.createIfcSweptDiskSolid(Directrix=path_curve, Radius=radius)
return disk_solid return disk_solid
def get_representation(self, context, items, representation_type: str = None): def get_representation(self, context, items, representation_type: str = None) -> ifcopenshell.entity_instance:
"""Create IFC representation for the specified context and items. """Create IFC representation for the specified context and items.
:param context: IfcGeometricRepresentationSubContext :param context: IfcGeometricRepresentationSubContext
:param items: could be a list or single curve/IfcExtrudedAreaSolid :param items: could be a list or single curve/IfcExtrudedAreaSolid
:param representation_type: Explicitly specified RepresentationType, defaults to `None`. :param representation_type: Explicitly specified RepresentationType, defaults to `None`.
If not provided it will be guessed from the items types. If not provided it will be guessed from the items types
:type representation_type: str, optional :type representation_type: str, optional
:return: IfcRepresentation :return: IfcRepresentation
:rtype: ifcopenshell.entity_instance
""" """
if not isinstance(items, collections.abc.Iterable): if not isinstance(items, collections.abc.Iterable):
items = [items] items = [items]
@@ -1361,12 +1366,12 @@ class ShapeBuilder:
radius: float, radius: float,
bend_vector: Vector, bend_vector: Vector,
flip_z_axis: bool, flip_z_axis: bool,
): ) -> ifcopenshell.entity_instance:
""" """
:param segment: IfcFlowSegment for a bend. :param segment: IfcFlowSegment for a bend.
Note that for a bend start and end segments types should match. Note that for a bend start and end segments types should match.
:param type: ifcopenshell.entity_instance
:param angle: bend angle, in radians :param angle: bend angle, in radians
:param type: float :param type: float
:param radius: bend radius :param radius: bend radius