Esempio n. 1
0
def wire():
    e1 = cm.arc(1.0, -math.pi / 2, math.pi / 2)
    e1.translate((1.0, 0.0, 0.0))
    e2 = cm.segment((1.0, 1.0, 0.0), (-1.0, 1.0, 0.0))
    e3 = cm.arc(1.0, math.pi / 2, 3 * math.pi / 2)
    e3.translate((-1.0, 0.0, 0.0))
    e4 = cm.segment((-1.0, -1.0, 0.0), (1.0, -1.0, 0.0))
    w1 = cm.wire([e1, e2, e3, e4])
    save_top(w1, 'wire.png', (0.0, 0.0, 0.0))
Esempio n. 2
0
def wire():
    e1 = cm.arc(1.0, -math.pi / 2, math.pi / 2)
    e1.translate((1.0, 0.0, 0.0))
    e2 = cm.segment((1.0, 1.0, 0.0), (-1.0, 1.0, 0.0))
    e3 = cm.arc(1.0, math.pi / 2, 3 * math.pi / 2)
    e3.translate((-1.0, 0.0, 0.0))
    e4 = cm.segment((-1.0, -1.0, 0.0), (1.0, -1.0, 0.0))
    w1 = cm.wire([e1, e2, e3, e4])
    save_top(w1, 'wire.png', (0.0, 0.0, 0.0))
Esempio n. 3
0
def derived_pipe():
    profile = cm.ngon(2.0, 6)
    e1 = cm.arc(8.0, 0.0, math.pi / 2)
    e2 = cm.segment((0.0, 8.0, 0.0), (-8.0, 8.0, 0.0))
    spine = cm.wire([e1, e2])
    spine.translate((-8.0, 0.0, 0.0))
    spine.rotatex(math.pi / 2)
    s1 = cm.pipe(profile, spine)
    save_iso(s1, 'derived_pipe.png')
Esempio n. 4
0
def derived_revol():
    e1 = cm.arc(1.0, -math.pi / 2, math.pi / 2)
    e1.translate((3.0, 0.0, 0.0))
    w1 = cm.polygon([(3.0, 1.0, 0.0), (2.0, 1.0, 0.0), (2.0, -1.0, 0.0),
                     (3.0, -1.0, 0.0)])
    f1 = cm.plane(cm.wire([e1, w1]))
    f1.rotatex(math.pi / 2)
    s1 = cm.revol(f1, (0.0, 0.0, 0.0), (0.0, 0.0, 1.0), 2 * math.pi)
    save_iso(s1, 'derived_revol.png')
Esempio n. 5
0
def derived_pipe():
    profile = cm.ngon(2.0, 6)
    e1 = cm.arc(8.0, 0.0, math.pi / 2)
    e2 = cm.segment((0.0, 8.0, 0.0), (-8.0, 8.0, 0.0))
    spine = cm.wire([e1, e2])
    spine.translate((-8.0, 0.0, 0.0))
    spine.rotatex(math.pi / 2)
    s1 = cm.pipe(profile, spine)
    save_iso(s1, 'derived_pipe.png')
Esempio n. 6
0
 def test_pipe(self):
     profile = cm.ngon(2.0, 6)
     e1 = cm.arc(8.0, 0.0, math.pi / 2)
     e2 = cm.segment((0.0, 8.0, 0.0), (-8.0, 8.0, 0.0))
     spine = cm.Wire([e1, e2])
     spine.translate((-8.0, 0.0, 0.0))
     spine.rotatex(math.pi / 2)
     s1 = cm.pipe(profile, spine)
     # empirical
     self.assert_(close(213.732, s1.volume(), 0.001))
Esempio n. 7
0
 def test_pipe(self):
     profile = cm.ngon(2.0, 6)
     e1 = cm.arc(8.0, 0.0, math.pi / 2)
     e2 = cm.segment((0.0, 8.0, 0.0), (-8.0, 8.0, 0.0))
     spine = cm.wire([e1, e2])
     spine.translate((-8.0, 0.0, 0.0))
     spine.rotatex(math.pi / 2)
     s1 = cm.pipe(profile, spine)
     # empirical
     self.assert_(close(213.732, s1.volume(), 0.001))
Esempio n. 8
0
def derived_revol():
    e1 = cm.arc(1.0, -math.pi / 2, math.pi / 2)
    e1.translate((3.0, 0.0, 0.0))
    w1 = cm.polygon([(3.0, 1.0, 0.0),
                       (2.0, 1.0, 0.0),
                       (2.0, -1.0, 0.0),
                       (3.0, -1.0, 0.0)])
    f1 = cm.plane(cm.wire([e1, w1]))
    f1.rotatex(math.pi / 2)
    s1 = cm.revol(f1, (0.0, 0.0, 0.0), (0.0, 0.0, 1.0), 2 * math.pi)
    save_iso(s1, 'derived_revol.png')
Esempio n. 9
0
def edge_arc():
    e1 = cm.arc(1.0, 0.0, math.pi / 2)
    save_top(e1, 'edge_arc.png', (0.0, 0.0, 0.0))
Esempio n. 10
0
 def test_arc(self):
     e1 = cm.arc(1.0, 0.0, math.pi / 2)
     self.assert_(close(math.pi / 2, e1.length()))
Esempio n. 11
0
 def test_arc(self):
     e1 = cm.arc(1.0, 0.0, math.pi / 2)
     self.assert_(close(math.pi / 2, e1.length()))
Esempio n. 12
0
def edge_arc():
    e1 = cm.arc(1.0, 0.0, math.pi / 2)
    save_top(e1, 'edge_arc.png', (0.0, 0.0, 0.0))