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

Method rPoly

tests/test_cadquery.py:209–224  ·  view source on GitHub ↗
(self, nSides, diameter)

Source from the content-addressed store, hash-verified

207 """
208
209 def rPoly(self, nSides, diameter):
210 def _makePolygon(loc):
211 # pnt is a vector in local coordinates
212 angle = 2.0 * math.pi / nSides
213 pnts = []
214 for i in range(nSides + 1):
215 pnts.append(
216 Vector(
217 (diameter / 2.0 * math.cos(angle * i)),
218 (diameter / 2.0 * math.sin(angle * i)),
219 0,
220 )
221 )
222 return Wire.makePolygon(pnts).located(loc)
223
224 return self.eachpoint(_makePolygon, True)
225
226 Workplane.rPoly = rPoly
227

Callers 1

testPolygonPluginMethod · 0.80

Calls 1

eachpointMethod · 0.80

Tested by

no test coverage detected