MCPcopy
hub / github.com/CadQuery/cadquery / polygon

Function polygon

cadquery/occ_impl/shapes.py:6277–6289  ·  view source on GitHub ↗

Construct a polygon (closed polyline) from points.

(*pts: VectorLike)

Source from the content-addressed store, hash-verified

6275
6276
6277def polygon(*pts: VectorLike) -> Wire:
6278 """
6279 Construct a polygon (closed polyline) from points.
6280 """
6281
6282 builder = BRepBuilderAPI_MakePolygon()
6283
6284 for p in pts:
6285 builder.Add(Vector(p).toPnt())
6286
6287 builder.Close()
6288
6289 return _shape(builder.Wire(), Wire)
6290
6291
6292def rect(w: float, h: float) -> Wire:

Callers 4

test_trimmingFunction · 0.90
rectFunction · 0.85
test_polygonFunction · 0.85
test_prismFunction · 0.85

Calls 3

VectorClass · 0.85
_shapeFunction · 0.85
toPntMethod · 0.80

Tested by 3

test_trimmingFunction · 0.72
test_polygonFunction · 0.68
test_prismFunction · 0.68