def derived_loft(): w1 = cm.wire([cm.circle(1.0)]) w2 = cm.wire([cm.circle(2.0)]) w2.translate((0.0, 0.0, 5.0)) w3 = cm.wire([cm.circle(1.5)]) w3.translate((0.0, 0.0, 10.0)) s1 = cm.loft([w1, w2, w3]) save_iso(s1, 'derived_loft.png')
def test_loft(self): w1 = cm.Wire([cm.circle(1.0)]) w2 = cm.Wire([cm.circle(2.0)]) w2.translate((0.0, 0.0, 5.0)) w3 = cm.Wire([cm.circle(1.5)]) w3.translate((0.0, 0.0, 10.0)) s1 = cm.loft([w1, w2, w3]) # empirical self.assert_(close(98.407, s1.volume(), 0.001))
def test_loft(self): w1 = cm.wire([cm.circle(1.0)]) w2 = cm.wire([cm.circle(2.0)]) w2.translate((0.0, 0.0, 5.0)) w3 = cm.wire([cm.circle(1.5)]) w3.translate((0.0, 0.0, 10.0)) s1 = cm.loft([w1, w2, w3]) # empirical self.assert_(close(98.407, s1.volume(), 0.001))
def test_copy(self): s1 = cm.circle(1.0) s2 = s1.copy() s1.translate((1.0, 1.0, 1.0)) self.assert_( close(s2.center(), (0.0, 0.0, 0.0)) and close(s1.center(), (1.0, 1.0, 1.0)))
def test_to_iges(self): s1 = cm.circle(1.0) r1 = s1.length() s1.to_iges('tmp.igs', brep_mode=1) s2 = cm.from_iges('tmp.igs') r2 = s2.length() self.assert_(close(r1, 2 * math.pi) and close(r2, 2 * math.pi))
def test_to_brep(self): s1 = cm.circle(1.0) r1 = s1.length() s1.to_brep('tmp.brp') s2 = cm.from_brep('tmp.brp') r2 = s2.length() self.assert_(close(r1, 2 * math.pi) and close(r2, 2 * math.pi))
def test_circle(self): e1 = cm.circle(3.0) self.assert_(close(3 * 2 * math.pi, e1.length()))
def edge_circle(): e1 = cm.circle(3.0) save_top(e1, 'edge_circle.png', (0.0, 0.0, 0.0))
def test_copy(self): s1 = cm.circle(1.0) s2 = s1.copy() s1.translate((1.0, 1.0, 1.0)) self.assert_(close(s2.center(), (0.0, 0.0, 0.0)) and close(s1.center(), (1.0, 1.0, 1.0)))
def test_bounds(self): s1 = cm.circle(1.0) self.assert_( close(s1.bounds(), (-1.0, -1.0, 0.0, 1.0, 1.0, 0.0), eps=0.1))
def test_center(self): s1 = cm.circle(1.0) s1.translate((1.0, 2.0, 3.0)) self.assert_(close(s1.center(), (1.0, 2.0, 3.0)))
def test_bounds(self): s1 = cm.circle(1.0) self.assert_(close(s1.bounds(), (-1.0, -1.0, 0.0, 1.0, 1.0, 0.0), eps=0.1))
def draw(self, view): self.geom = model.circle(self.r.val) self.geom.translate([self.p.x.val, self.p.y.val, 0]) view.display(self.geom)