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

Method testIbeam

tests/test_cadquery.py:2202–2229  ·  view source on GitHub ↗

Make an ibeam. demonstrates fancy mirroring

(self)

Source from the content-addressed store, hash-verified

2200 # TODO: Add toLocalCoords and toWorldCoords tests
2201
2202 def testIbeam(self):
2203 """
2204 Make an ibeam. demonstrates fancy mirroring
2205 """
2206 s = Workplane(Plane.XY())
2207 L = 100.0
2208 H = 20.0
2209 W = 20.0
2210
2211 t = 1.0
2212 # TODO: for some reason doing 1/4 of the profile and mirroring twice ( .mirrorX().mirrorY() )
2213 # did not work, due to a bug in freecad-- it was losing edges when creating a composite wire.
2214 # i just side-stepped it for now
2215
2216 pts = [
2217 (0, 0),
2218 (0, H / 2.0),
2219 (W / 2.0, H / 2.0),
2220 (W / 2.0, (H / 2.0 - t)),
2221 (t / 2.0, (H / 2.0 - t)),
2222 (t / 2.0, (t - H / 2.0)),
2223 (W / 2.0, (t - H / 2.0)),
2224 (W / 2.0, H / -2.0),
2225 (0, H / -2.0),
2226 ]
2227 r = s.polyline(pts).mirrorY() # these other forms also work
2228 res = r.extrude(L)
2229 self.saveModel(res)
2230
2231 def testCone(self):
2232 """

Callers

nothing calls this directly

Calls 6

polylineMethod · 0.95
saveModelMethod · 0.95
WorkplaneClass · 0.85
XYMethod · 0.80
mirrorYMethod · 0.80
extrudeMethod · 0.80

Tested by

no test coverage detected