Example #1
0
 def test_filling(self):
     e1 = cm.spline([(0.0, 0.0, 0.0), (1.0, 0.2, 0.3), (1.5, 0.8, 1.0),
                     (0.8, 1.2, 0.2), (0.0, 1.0, 0.0)])
     e2 = cm.spline([(0.0, 0.0, 0.0), (-1.0, 0.2, 0.3), (-1.5, 0.8, 1.0),
                     (-0.8, 1.2, 0.2), (0.0, 1.0, 0.0)])
     w1 = cm.wire([e1, e2])
     f1 = cm.filling(w1)
     # empirical
     self.assert_(close(5.479, f1.area(), 0.01))  # Can vary
Example #2
0
 def test_filling(self):
     e1 = cm.spline([(0.0, 0.0, 0.0), (1.0, 0.2, 0.3), (1.5, 0.8, 1.0),
                     (0.8, 1.2, 0.2), (0.0, 1.0, 0.0)])
     e2 = cm.spline([(0.0, 0.0, 0.0), (-1.0, 0.2, 0.3), (-1.5, 0.8, 1.0),
                     (-0.8, 1.2, 0.2), (0.0, 1.0, 0.0)])
     w1 = cm.Wire([e1, e2])
     f1 = cm.filling(w1)
     # empirical
     # Can vary considerably given the spline nature
     # self.assert_(close(5.479, f1.area(), 0.01))
     self.assert_(close(5.44100168973, f1.area(), 0.01))
Example #3
0
def face_filling():
    e1 = cm.spline([(0.0, 0.0, 0.0), (1.0, 0.2, 0.3), (1.5, 0.8, 1.0),
                    (0.8, 1.2, 0.2), (0.0, 1.0, 0.0)])
    e2 = cm.spline([(0.0, 0.0, 0.0), (-1.0, 0.2, 0.3), (-1.5, 0.8, 1.0),
                    (-0.8, 1.2, 0.2), (0.0, 1.0, 0.0)])
    w1 = cm.wire([e1, e2])
    f1 = cm.filling(w1)
    v.viewstandard(viewtype='iso')
    v.display(w1, color=(1.0, 0.0, 0.0))
    v.display(f1)
    v.fit()
    v.save('face_filling.png')
    v.clear()
Example #4
0
 def test_filling(self):
     e1 = cm.spline([(0.0, 0.0, 0.0),
                     (1.0, 0.2, 0.3),
                     (1.5, 0.8, 1.0),
                     (0.8, 1.2, 0.2),
                     (0.0, 1.0, 0.0)])
     e2 = cm.spline([(0.0, 0.0, 0.0),
                     (-1.0, 0.2, 0.3),
                     (-1.5, 0.8, 1.0),
                     (-0.8, 1.2, 0.2),
                     (0.0, 1.0, 0.0)])
     w1 = cm.wire([e1, e2])
     f1 = cm.filling(w1)
     # empirical
     self.assert_(close(5.479, f1.area(), 0.01))  # Can vary
Example #5
0
def face_filling():
    e1 = cm.spline([(0.0, 0.0, 0.0),
                      (1.0, 0.2, 0.3),
                      (1.5, 0.8, 1.0),
                      (0.8, 1.2, 0.2),
                      (0.0, 1.0, 0.0)])
    e2 = cm.spline([(0.0, 0.0, 0.0),
                      (-1.0, 0.2, 0.3),
                      (-1.5, 0.8, 1.0),
                      (-0.8, 1.2, 0.2),
                      (0.0, 1.0, 0.0)])
    w1 = cm.wire([e1, e2])
    f1 = cm.filling(w1)
    v.viewstandard(viewtype='iso')
    v.display(w1, color=(1.0, 0.0, 0.0))
    v.display(f1)
    v.fit()
    v.save('face_filling.png')
    v.clear()
Example #6
0
#!/usr/bin/env python
# coding: utf-8
r"""Generation script for ISO 4032 nut"""

from ccad.model import prism, filling, ngon, cylinder

m_max = 2.0
s_max = 5.0
d_a_min = 2.5

body = prism(filling(ngon(2 / 3**.5 * s_max / 2., 6)), (0, 0, m_max))

hole = cylinder(d_a_min / 2., m_max)

__shape__ = (body - hole).shape

__anchors__ = {
    "nut_bottom": {
        "p": (0., 0., 0.),
        "u": (0., 0., -1.),
        "v": (1., 0., 0.),
        "dimension": d_a_min
    },
    "nut_top": {
        "p": (0., 0., m_max),
        "u": (0., 0., 1.),
        "v": (1., 0., 0.),
        "dimension": d_a_min
    }
}
Example #7
0
#!/usr/bin/env python
# coding: utf-8

r"""Generation script for ISO 4014 screw"""

from ccad.model import prism, filling, ngon, cylinder, translated

k_max = 1.6
s_max = 4.0
l_g_max = 10.0
d_s_max = 2.0
d_s_min = 1.75
l_max = 21.05

head = translated(prism(filling(ngon(2 / 3**.5 * s_max / 2., 6)), (0, 0, k_max)), (0., 0., -k_max))

threaded = cylinder(d_s_min / 2., l_max)
unthreaded = cylinder(d_s_max / 2., l_g_max)

__shape__ = (head + threaded + unthreaded).shape
__anchors__ = {"head_bottom": {"p": (0., 0., 0.),
                               "u": (0., 0., -1.),
                               "v": (1., 0., 0.),
                               "dimension": d_s_max,
                               "description": "screw head on plane"}}