Exemplo n.º 1
0
 def arc(self, x=None, y=None, z=None, i=None, j=None, k=None, r=None, ccw = True):
     px = self.x
     py = self.y
     pz = self.z
     recreator.Redirector.arc(self, x, y, z, i, j, k, r, ccw)
     
     # add an arc to the path
     if self.path == None: self.path = ocl.Path()
     self.path.append(ocl.Arc(ocl.Point(px, py, pz), ocl.Point(self.x, self.y, self.z), ocl.Point(i, j, pz), ccw))
Exemplo n.º 2
0
 def arc(self, x=None, y=None, z=None, i=None, j=None, k=None, r=None, ccw = True):
     if self.x == None or self.y == None or self.z == None:
         raise "first attached move can't be an arc"
     px = self.x
     py = self.y
     pz = self.z
     if x != None: self.x = x * units
     if y != None: self.y = y * units
     if z != None: self.z = z * units
     
     # add an arc to the path
     if self.path == None: self.path = ocl.Path()
     self.path.append(ocl.Arc(ocl.Point(px, py, pz), ocl.Point(self.x, self.y, self.z), ocl.Point(i, j, pz), ccw))
Exemplo n.º 3
0
             ocl.Point(4.62435565, 19.99038106, 0)))
path_id_2.append(
    ocl.Line(ocl.Point(4.62435565, 19.99038106, 0), ocl.Point(-15, 14, 0)))
path_id_2.append(
    ocl.Line(ocl.Point(-15, 14, 0), ocl.Point(-19.6243556, -5.99038106, 0)))
path_id_2.append(
    ocl.Line(ocl.Point(-19.6243556, -5.99038106, 0),
             ocl.Point(-4.62435565, -19.9903811, 0)))
path_id_2.append(
    ocl.Line(ocl.Point(-4.62435565, -19.9903811, 0), ocl.Point(15, -14, 0)))
paths.append(path_id_2)

path_id_3 = ocl.Path()
path_id_3.append(ocl.Line(ocl.Point(-27, 2, 0), ocl.Point(-18, 18, 0)))
path_id_3.append(
    ocl.Arc(ocl.Point(-18, 18, 0), ocl.Point(-10.00000001, 21.99999996, 0),
            ocl.Point(-11.0434783, 14.08695652, 0), True))
path_id_3.append(ocl.Line(ocl.Point(-10, 22, 0), ocl.Point(10, 23, 0)))
paths.append(path_id_3)

for path in paths:
    # Retrieve a list of type/span pairs.  The type indicates whether it's a line or an arc
    spans = path.getTypeSpanPairs()
    print '\n\nSpan'

    for span in spans:
        span_type = span[0]
        span_element = span[1]

        if (span_type == ocl.ArcSpanType):
            arc = span_element
            print 'Arc(start=' + str(arc.p1) + ', centre=' + str(