Tests whether or not a proper weighted center can be found for a compound
(self)
| 266 | pass |
| 267 | |
| 268 | def testCompoundCenter(self): |
| 269 | """ |
| 270 | Tests whether or not a proper weighted center can be found for a compound |
| 271 | """ |
| 272 | |
| 273 | def cylinders(self, radius, height): |
| 274 | |
| 275 | c = Solid.makeCylinder(radius, height, Vector()) |
| 276 | |
| 277 | # Combine all the cylinders into a single compound |
| 278 | r = self.eachpoint(lambda loc: c.located(loc), True).union() |
| 279 | |
| 280 | return r |
| 281 | |
| 282 | Workplane.cyl = cylinders |
| 283 | |
| 284 | # Now test. here we want weird workplane to see if the objects are transformed right |
| 285 | s = ( |
| 286 | Workplane("XY") |
| 287 | .rect(2.0, 3.0, forConstruction=True) |
| 288 | .vertices() |
| 289 | .cyl(0.25, 0.5) |
| 290 | ) |
| 291 | |
| 292 | self.assertEqual(4, len(s.val().Solids())) |
| 293 | self.assertTupleAlmostEquals((0.0, 0.0, 0.25), s.val().Center().toTuple(), 3) |
| 294 | |
| 295 | def testDot(self): |
| 296 | v1 = Vector(2, 2, 2) |