From 6089d3af780409888f17c2de0d1741890b52f03f Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 28 Aug 2023 16:13:37 +0500 Subject: [PATCH] shape_builder docs test --- .../ifcopenshell/util/shape_builder.py | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py b/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py index aef9bca169..e34aa289c7 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py +++ b/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py @@ -127,13 +127,16 @@ class ShapeBuilder: def rectangle(self, size: Vector = Vector((1.0, 1.0)).freeze(), position: Vector = None): """ - function supports both 2d and 3d rectangle sizes + Generate a rectangle polyline, method supports both 2d and 3d rectangle sizes. + :param size: rectangle size + :param type: Vector + :param size: rectangle position, default to `None`. if `position` not specified zero-vector will be used + :param type: Vector, optional - returns IfcIndexedPolyCurve + :return: IfcIndexedPolyCurve """ - # < IfcIndexedPolyCurve return self.polyline(self.get_rectangle_coords(size, position), closed=True) def circle(self, center: Vector = Vector((0.0, 0.0)).freeze(), radius=1.0): @@ -572,9 +575,17 @@ class ShapeBuilder: disk_solid = self.file.createIfcSweptDiskSolid(Directrix=path_curve, Radius=radius) return disk_solid - def get_representation(self, context, items, representation_type=None): - # > items - could be a list or single curve/IfcExtrudedAreaSolid - # < IfcShapeRepresentation + def get_representation(self, context, items, representation_type:str = None): + """Create IFC representation for the specified context and items. + + :param context: IfcGeometricRepresentationSubContext + :param items: could be a list or single curve/IfcExtrudedAreaSolid + :param representation_type: Explicitly specified RepresentationType, defaults to `None`. + If not provided it will be guessed from the items types. + :type representation_type: str, optional + + :return: IfcRepresentation + """ if not isinstance(items, collections.abc.Iterable): items = [items]