MCPcopy Index your code
hub / github.com/CadQuery/cadquery / testCubePlugin

Method testCubePlugin

tests/test_cadquery.py:137–169  ·  view source on GitHub ↗

Tests a plugin that combines cubes together with a base :return:

(self)

Source from the content-addressed store, hash-verified

135 )
136
137 def testCubePlugin(self):
138 """
139 Tests a plugin that combines cubes together with a base
140 :return:
141 """
142 # make the plugin method
143
144 def makeCubes(self, length):
145 # self refers to the CQ or Workplane object
146
147 # create the solid
148 s = Solid.makeBox(length, length, length, Vector(0, 0, 0))
149
150 # use CQ utility method to iterate over the stack an position the cubes
151 return self.eachpoint(lambda loc: s.located(loc), True)
152
153 # link the plugin in
154 Workplane.makeCubes = makeCubes
155
156 # call it
157 result = (
158 Workplane("XY")
159 .box(6.0, 8.0, 0.5)
160 .faces(">Z")
161 .rect(4.0, 4.0, forConstruction=True)
162 .vertices()
163 )
164 result = result.makeCubes(1.0)
165 result = result.combine()
166 self.saveModel(result)
167 self.assertEqual(1, result.size())
168 self.assertEqual("Compound", result.val().ShapeType())
169 self.assertEqual(4, result.solids().size())
170
171 def testCylinderPlugin(self):
172 """

Callers

nothing calls this directly

Calls 12

saveModelMethod · 0.95
WorkplaneClass · 0.85
boxMethod · 0.80
makeCubesMethod · 0.80
verticesMethod · 0.45
rectMethod · 0.45
facesMethod · 0.45
combineMethod · 0.45
sizeMethod · 0.45
ShapeTypeMethod · 0.45
valMethod · 0.45
solidsMethod · 0.45

Tested by

no test coverage detected