def test_bolt(self): shaft = CSG.cylinder(start=[0., 0., 0.], end=[1., 0., 0.], radius=0.1, slices=32) head = CSG.cone(start=[-0.12, 0., 0.], end=[0.10, 0., 0.], radius=0.25) notch1 = CSG.cube(center=[-0.10, 0., 0.], radius=[0.02, 0.20, 0.02]) notch2 = CSG.cube(center=[-0.10, 0., 0.], radius=[0.02, 0.02, 0.20]) bolt = shaft + head - notch1 - notch2 bolt.saveVTK('test_bolt.vtk')
def cone_csg(inst): r, h, n = inst[1:4] key = "%f,%f%dcone" % (r, h, n) obj = cache_find(key) if obj is not None: mesh_push(obj, key) return obj = CSG.cone(start=[0, 0, 0], end=[0, 0, h], slices=n, radius=r) cache_put(key, obj) mesh_push(obj, key)
def Cone(radius, origin, lengths, n_theta=16): """ Create cone @param radius radius @param origin location of the focal point @param lengths lengths of the cone @param n_theta number of theta cells """ ori = Vector(origin[0], origin[1], origin[2]) end = Vector(origin[0] + lengths[0], origin[1] + lengths[1], origin[2] + lengths[2]) return CSG.cone(start=ori, end=end, radius=radius, slices=n_theta)
def test_cone(self): a = CSG.cone(start=[0., 0., 0.], end=[1., 2., 3.], radius=1.0, slices=8) a.saveVTK('test_cone.vtk')