Example #1
0
    def execute(self, obj):
        self.Width = float(obj.Width)
        self.Height = float(obj.Height)
        self.Length = float(obj.Length)
        self.Thickness = float(obj.Thickness)
        Result = None

        p1 = App.Vector(0, 0, 0)
        p2 = App.Vector(0, self.Length / 2, self.Height)
        p3 = App.Vector(0, self.Length, 0)

        p11 = App.Vector(p1.x + self.Thickness, p1.y + self.Thickness, p1.z)
        p22 = App.Vector(p2.x + self.Thickness, p2.y, p2.z - self.Thickness)
        p33 = App.Vector(p3.x + self.Thickness, p3.y - self.Thickness, p3.z)

        c1 = Part.ArcOfCircle(p1, p2, p3)
        c11 = c1.copy()
        l1 = Part.LineSegment(p1, p3)

        c2 = Part.ArcOfCircle(p11, p22, p33)
        l2 = Part.LineSegment(p11, p33)

        W1 = Part.Wire([c1.toShape(), l1.toShape()])
        W2 = Part.Wire([c2.toShape(), l2.toShape()])
        f1 = Part.Face(W1)
        f2 = Part.Face(W2)
        obj1 = f1.extrude(App.Vector(self.Width, 0, 0))
        obj2 = f2.extrude(App.Vector(self.Width - 2 * self.Thickness, 0, 0))
        Result = obj1.cut(obj2)
        obj.Shape = Result
Example #2
0
def filterArcs(arcEdge):
    '''filterArcs(Edge) -used to split arcs that over 180 degrees. Returns list '''
    s = arcEdge
    if isinstance(s.Curve, Part.Circle):
        splitlist = []
        angle = abs(s.LastParameter - s.FirstParameter)
        # overhalfcircle = False
        goodarc = False
        if (angle > math.pi):
            pass
            # overhalfcircle = True
        else:
            goodarc = True
        if not goodarc:
            arcstpt = s.valueAt(s.FirstParameter)
            arcmid = s.valueAt((s.LastParameter - s.FirstParameter) * 0.5 +
                               s.FirstParameter)
            arcquad1 = s.valueAt((s.LastParameter - s.FirstParameter) * 0.25 +
                                 s.FirstParameter)  # future midpt for arc1
            arcquad2 = s.valueAt((s.LastParameter - s.FirstParameter) * 0.75 +
                                 s.FirstParameter)  # future midpt for arc2
            arcendpt = s.valueAt(s.LastParameter)
            # reconstruct with 2 arcs
            arcseg1 = Part.ArcOfCircle(arcstpt, arcquad1, arcmid)
            arcseg2 = Part.ArcOfCircle(arcmid, arcquad2, arcendpt)

            eseg1 = arcseg1.toShape()
            eseg2 = arcseg2.toShape()
            splitlist.append(eseg1)
            splitlist.append(eseg2)
        else:
            splitlist.append(s)
    elif isinstance(s.Curve, Part.LineSegment):
        pass
    return splitlist
def createGeometryS(obj=None):
    '''create a testcase sketch'''

    if obj == None:
        sk = App.ActiveDocument.addObject('Sketcher::SketchObject', 'Sketch')
    else:
        sk = obj

    sk.addGeometry(
        Part.ArcOfCircle(
            Part.Circle(App.Vector(96.450951, 236.065002, 0),
                        App.Vector(0, 0, 1), 267.931216), -2.497296,
            -1.226827), False)
    App.ActiveDocument.recompute()

    sk.addGeometry(
        Part.ArcOfCircle(
            Part.Circle(App.Vector(-223.275940, -184.908691, 0),
                        App.Vector(0, 0, 1), 280.634057), -0.171680, 1.185353),
        False)
    sk.addConstraint(Sketcher.Constraint('Coincident', 0, 1, 1, 1))
    App.ActiveDocument.recompute()

    sk.addConstraint(Sketcher.Constraint('Tangent', 0, 1))
    App.ActiveDocument.recompute()

    sk.addConstraint(Sketcher.Constraint('Radius', 0, 1500.))
    App.ActiveDocument.recompute()

    # punkt A bewegen
    sk.movePoint(0, 1, App.Vector(-228.741898, 243.874924, 0), 0)

    consAX = sk.addConstraint(
        Sketcher.Constraint('DistanceX', 0, 2, -284.619380))
    sk.setDatum(consAX, -300)
    sk.renameConstraint(consAX, u'AX')
    consAY = sk.addConstraint(
        Sketcher.Constraint('DistanceY', 0, 2, 162.125989))
    sk.setDatum(consAY, 200)
    sk.renameConstraint(consAY, u'AY')
    App.ActiveDocument.recompute()

    # punkt B bewegen
    consBX = sk.addConstraint(
        Sketcher.Constraint('DistanceX', 1, 2, -284.619380))
    sk.setDatum(consBX, 200)
    sk.renameConstraint(consBX, u'BX')
    consBY = sk.addConstraint(
        Sketcher.Constraint('DistanceY', 1, 2, 162.125989))
    sk.setDatum(consBY, -75)
    sk.renameConstraint(consBY, u'BY')
    App.ActiveDocument.recompute()

    sk.addConstraint(Sketcher.Constraint('Radius', 1, 3000.))

    return
Example #4
0
    def getCurveSet(ent):
        result = []
        if ent.is_a() in ["IfcGeometricCurveSet", "IfcGeometricSet"]:
            elts = ent.Elements
        elif ent.is_a() in [
                "IfcLine", "IfcPolyline", "IfcCircle", "IfcTrimmedCurve"
        ]:
            elts = [ent]
        for el in elts:
            if el.is_a("IfcPolyline"):
                result.append(getPolyline(el))
            elif el.is_a("IfcLine"):
                result.append(getLine(el))
            elif el.is_a("IfcCircle"):
                result.append(getCircle(el))
            elif el.is_a("IfcTrimmedCurve"):
                base = el.BasisCurve
                t1 = el.Trim1[0].wrappedValue
                t2 = el.Trim2[0].wrappedValue
                if not el.SenseAgreement:
                    t1, t2 = t2, t1
                if base.is_a("IfcPolyline"):
                    bc = getPolyline(base)
                    result.append(bc)
                elif base.is_a("IfcCircle"):
                    bc = getCircle(base)
                    e = Part.ArcOfCircle(bc.Curve, math.radians(t1),
                                         math.radians(t2)).toShape()
                    d = base.Position.RefDirection.DirectionRatios
                    v = FreeCAD.Vector(d[0], d[1], d[2] if len(d) > 2 else 0)
                    a = -DraftVecUtils.angle(v)
                    e.rotate(bc.Curve.Center, FreeCAD.Vector(0, 0, 1),
                             math.degrees(a))
                    result.append(e)
            elif el.is_a("IfcCompositeCurve"):
                for base in el.Segments:
                    if base.ParentCurve.is_a("IfcPolyline"):
                        bc = getPolyline(base.ParentCurve)
                        result.append(bc)
                    elif base.ParentCurve.is_a("IfcCircle"):
                        bc = getCircle(base.ParentCurve)
                        e = Part.ArcOfCircle(bc.Curve, math.radians(t1),
                                             math.radians(t2)).toShape()
                        d = base.Position.RefDirection.DirectionRatios
                        v = FreeCAD.Vector(d[0], d[1],
                                           d[2] if len(d) > 2 else 0)
                        a = -DraftVecUtils.angle(v)
                        e.rotate(bc.Curve.Center, FreeCAD.Vector(0, 0, 1),
                                 math.degrees(a))
                        result.append(e)

        return result
Example #5
0
    def otv(offsetX, offsetY):
        P0 = Base.Vector(0. + offsetX, 0. + offsetY, 0)
        P1 = Base.Vector(0. + offsetX, cHEIGHT + offsetY, 0)
        P2 = Base.Vector(cLENGTH + offsetX, cHEIGHT + offsetY, 0)
        P3 = Base.Vector(cLENGTH + offsetX, 0. + offsetY, 0)
        P4 = Base.Vector(0. + offsetX - cRADIUSdx, cHdiv2 + offsetY, 0)
        P5 = Base.Vector(cLENGTH - cRADIUSdx + offsetX, cHdiv2 + offsetY, 0)
        #
        ls0 = Part.LineSegment(P1, P2)
        gm0 = AS.addGeometry(ls0, False)
        AS.addConstraint(Sketcher.Constraint('Horizontal', gm0))
        cnr0 = AS.addConstraint(
            Sketcher.Constraint('DistanceX', gm0, 1, offsetX))
        AS.setVirtualSpace(cnr0, True)
        cnr1 = AS.addConstraint(
            Sketcher.Constraint('DistanceY', gm0, 1, cHEIGHT + offsetY))
        AS.setVirtualSpace(cnr1, True)
        cnr2 = AS.addConstraint(
            Sketcher.Constraint('DistanceX', gm0, 1, gm0, 2, cLENGTH))  # dx0
        AS.setVirtualSpace(cnr2, True)
        #
        ls1 = Part.LineSegment(P0, P3)
        gm1 = AS.addGeometry(ls1, False)
        AS.addConstraint(Sketcher.Constraint('Horizontal', gm1))
        cnr3 = AS.addConstraint(
            Sketcher.Constraint('DistanceX', gm1, 1, offsetX))
        AS.setVirtualSpace(cnr3, True)
        #
        cnr4 = AS.addConstraint(
            Sketcher.Constraint('DistanceY', gm1, 1, offsetY))
        AS.setVirtualSpace(cnr4, True)
        cnr5 = AS.addConstraint(
            Sketcher.Constraint('DistanceX', gm1, 1, gm1, 2, cLENGTH))  # dx1
        AS.setVirtualSpace(cnr5, True)
        #
        cr1 = Part.ArcOfCircle(Part.Circle(P4, App.Vector(0, 0, 1), cRADIUS),
                               -0.627014, 0.643501)
        gm2 = AS.addGeometry(cr1, False)
        #
        cr2 = Part.ArcOfCircle(Part.Circle(P5, App.Vector(0, 0, 1), cRADIUS),
                               -0.627014, 0.643501)
        gm3 = AS.addGeometry(cr2, False)
        #
        AS.addConstraint(Sketcher.Constraint('Coincident', gm0, 1, gm2,
                                             2))  # c1
        AS.addConstraint(Sketcher.Constraint('Coincident', gm1, 1, gm2,
                                             1))  # c2

        AS.addConstraint(Sketcher.Constraint('Coincident', gm0, 2, gm3, 2))
        AS.addConstraint(Sketcher.Constraint('Coincident', gm1, 2, gm3, 1))
        #
        App.ActiveDocument.recompute()
Example #6
0
 def make_profile_sketch(self):
     import Sketcher
     sk = FreeCAD.ActiveDocument.addObject('Sketcher::SketchObject',
                                           'Profile')
     sk.Placement = FreeCAD.Placement(FreeCAD.Vector(0, 0, 0),
                                      FreeCAD.Rotation(0, 0, 0, 1))
     sk.MapMode = "Deactivated"
     sk.addGeometry(
         Part.LineSegment(FreeCAD.Vector(100.0, 0.0, 0),
                          FreeCAD.Vector(127.0, 12.0, 0)), False)
     sk.addConstraint(Sketcher.Constraint('PointOnObject', 0, 1, -1))
     sk.addGeometry(
         Part.ArcOfCircle(
             Part.Circle(FreeCAD.Vector(125.0, 17.0, 0),
                         FreeCAD.Vector(0, 0, 1), 5.8), -1.156090,
             1.050925), False)
     sk.addConstraint(Sketcher.Constraint('Tangent', 0, 2, 1, 1))
     sk.addGeometry(
         Part.LineSegment(FreeCAD.Vector(128.0, 22.0, 0),
                          FreeCAD.Vector(100.0, 37.0, 0)), False)
     sk.addConstraint(Sketcher.Constraint('Tangent', 1, 2, 2, 1))
     sk.addConstraint(Sketcher.Constraint('Vertical', 0, 1, 2, 2))
     sk.addConstraint(Sketcher.Constraint('DistanceY', 0, 1, 2, 2, 37.5))
     sk.setDatum(4, FreeCAD.Units.Quantity('35.000000 mm'))
     sk.renameConstraint(4, u'Lead')
     sk.setDriving(4, False)
     sk.addConstraint(Sketcher.Constraint('Equal', 2, 0))
     FreeCAD.ActiveDocument.recompute()
     return sk
Example #7
0
    def sketch_from_coords(self, data):
        for line in data.wires:
            v1 = FreeCAD.Vector(line.x1, line.y1, 0.0)
            v2 = FreeCAD.Vector(line.x2, line.y2, 0.0)
            self.fc.addGeometry(Partfc.Line(v1, v2))

        for arc in data.arcs:
            x1 = arc.x1
            x2 = arc.x2
            y1 = arc.y1
            y2 = arc.y2
            curve = arc.curve
            (xc, yc) = geom.find_circle_center_3pt_arc(x1, y1, x2, y2, radians(curve))
            radius = sqrt((x1-xc)**2 + (y1-yc)**2)
            arc_length = (curve/360) * 2*pi*radius
            center = FreeCAD.Vector(xc, yc, 0)
            if curve < 0:
                curve_start = atan2(y2-yc, x2-xc) # radians
                curve_end = atan2(y1-yc, x1-xc) # radians
            else:
                curve_end = atan2(y2-yc, x2-xc) # radians
                curve_start = atan2(y1-yc, x1-xc) # radians
            self.fc.addGeometry(Partfc.ArcOfCircle(Partfc.Circle(center,
                                                                 FreeCAD.Vector(0, 0, 1),
                                                                 radius),
                                                   curve_start,
                                                   curve_end))


        for circle in data.circles:
            self.fc.addGeometry(Partfc.Circle(FreeCAD.Vector(circle.x, circle.y),
                                              FreeCAD.Vector(0.0, 0.0, 1.0),
                                              circle.radius))
Example #8
0
def CreateSlotPlateSet(SketchFeature):
	SketchFeature.addGeometry(Part.LineSegment(App.Vector(60.029362,-30.279360,0),App.Vector(-120.376335,-30.279360,0)))
	SketchFeature.addConstraint(Sketcher.Constraint('Horizontal',0)) 
	SketchFeature.addGeometry(Part.LineSegment(App.Vector(-120.376335,-30.279360,0),App.Vector(-70.193062,38.113884,0)))
	SketchFeature.addConstraint(Sketcher.Constraint('Coincident',0,2,1,1)) 
	SketchFeature.addGeometry(Part.LineSegment(App.Vector(-70.193062,38.113884,0),App.Vector(60.241116,37.478645,0)))
	SketchFeature.addConstraint(Sketcher.Constraint('Coincident',1,2,2,1)) 
	SketchFeature.addConstraint(Sketcher.Constraint('Horizontal',2)) 
	SketchFeature.addGeometry(Part.ArcOfCircle(Part.Circle(App.Vector(60.039921,3.811391,0),App.Vector(0,0,1),35.127132),-1.403763,1.419522))
	SketchFeature.addConstraint(Sketcher.Constraint('Coincident',3,2,2,2)) 
	SketchFeature.addConstraint(Sketcher.Constraint('Coincident',3,1,0,1)) 
	SketchFeature.addConstraint(Sketcher.Constraint('Tangent',2,2,3,2))
	SketchFeature.addConstraint(Sketcher.Constraint('Tangent',0,1,3,1))
	SketchFeature.addConstraint(Sketcher.Constraint('Angle',0,2,1,1,0.947837)) 
	SketchFeature.addConstraint(Sketcher.Constraint('Distance',0,184.127425)) 
	SketchFeature.setDatum(9,200.000000)
	SketchFeature.addConstraint(Sketcher.Constraint('Radius',3,38.424808)) 
	SketchFeature.setDatum(10,40.000000)
	SketchFeature.setDatum(8,0.872665)
	SketchFeature.addConstraint(Sketcher.Constraint('DistanceX',0,2,0.0)) 
	SketchFeature.setDatum(11,0.000000)
	SketchFeature.movePoint(0,2,App.Vector(-0.007829,-33.376450,0))
	SketchFeature.movePoint(0,2,App.Vector(-0.738149,-10.493386,0))
	SketchFeature.movePoint(0,2,App.Vector(-0.007829,2.165328,0))
	SketchFeature.addConstraint(Sketcher.Constraint('DistanceY',0,2,2.165328)) 
	SketchFeature.setDatum(12,0.000000)
Example #9
0
def roundEdge(edg):
    if 'Line' in str(edg):
        #print (str(edg))
        ps = edg.StartPoint
        psx = round(ps.x, 3)
        psy = round(ps.y, 3)
        psz = round(ps.z, 3)
        pe = edg.EndPoint
        pex = round(pe.x, 3)
        pey = round(pe.y, 3)
        pez = round(pe.z, 3)
        return PLine(Base.Vector(psx, psy, psz), Base.Vector(pex, pey, pez))
    elif 'ArcOfCircle' in str(edg):
        #print (str(edg))
        #v=FreeCAD.Vector
        c = edg.Center
        cx = round(c[0], 3)
        cy = round(c[1], 3)
        cz = round(c[0], 3)
        r = round(edg.Radius, 3)
        axis = edg.Axis
        sa = round(edg.FirstParameter, 4)
        ea = round(edg.LastParameter, 4)
        return Part.ArcOfCircle(
            Part.Circle(FreeCAD.Vector(cx, cy, cz), axis, r), sa, ea)
    elif 'Circle' in str(edg):
        #print (str(edg))
        c = edg.Center
        cx = round(c[0], 3)
        cy = round(c[1], 3)
        cz = round(c[0], 3)
        r = round(edg.Radius, 3)
        axis = edg.Axis
        return Part.Circle(FreeCAD.Vector(cx, cy, cz), axis, r)
Example #10
0
    def generateGlue(self, doc, grp, layerName, layerColor, layerNumber,
                     layerSide):
        for i, j in self.wersjaFormatu.getGlue([layerNumber,
                                                layerName]).items():
            ser = doc.addObject('Sketcher::SketchObject',
                                "Sketch_{0}".format(layerName))
            ser.ViewObject.Visibility = False
            for k in j:
                if k[0] == 'line':
                    ser.addGeometry(
                        Part.LineSegment(FreeCAD.Vector(k[1], k[2], 0),
                                         FreeCAD.Vector(k[3], k[4], 0)))
                elif k[0] == 'circle':
                    ser.addGeometry(
                        Part.Circle(FreeCAD.Vector(k[1], k[2]),
                                    FreeCAD.Vector(0, 0, 1), k[3]))
                elif k[0] == 'arc':
                    x1 = k[1]
                    y1 = k[2]
                    x2 = k[3]
                    y2 = k[4]
                    [x3, y3] = self.arcMidPoint([x2, y2], [x1, y1], k[5])

                    arc = Part.ArcOfCircle(FreeCAD.Vector(x1, y1, 0.0),
                                           FreeCAD.Vector(x3, y3, 0.0),
                                           FreeCAD.Vector(x2, y2, 0.0))
                    ser.addGeometry(arc)
            #
            glue = createGlue()
            glue.base = ser
            glue.width = i
            glue.side = layerSide
            glue.color = layerColor
            glue.generate()
Example #11
0
    def test66(self):
        '''Split arc real world sample'''

        af = Vector(421.55, 378.41, 1)
        am = Vector(459.51, 372.61, 1)
        al = Vector(491.75, 351.75, 1)
        arc = Part.Edge(Part.ArcOfCircle(af, am, al))
        ac = arc.Curve.Center

        s = Vector(434.54, 378.26, 1)
        head, tail = PathGeom.splitEdgeAt(arc, s)

        # make sure the arcs connect as they should
        self.assertCoincide(arc.valueAt(arc.FirstParameter),
                            head.valueAt(head.FirstParameter), 0.005)
        self.assertCoincide(s, head.valueAt(head.LastParameter), 0.005)
        self.assertCoincide(s, tail.valueAt(tail.FirstParameter), 0.005)
        i = arc.valueAt(arc.LastParameter)
        j = tail.valueAt(tail.LastParameter)
        print("(%.2f, %.2f, %.2f) vs. (%.2f, %.2f, %.2f)" %
              (i.x, i.y, i.z, j.x, j.y, j.z))
        self.assertCoincide(arc.valueAt(arc.LastParameter),
                            tail.valueAt(tail.LastParameter), 0.005)

        # make sure the radii match
        self.assertRoughly(arc.Curve.Radius, head.Curve.Radius, 0.001)
        self.assertRoughly(arc.Curve.Radius, tail.Curve.Radius, 0.001)

        # also, all arcs should have the same center
        self.assertCoincide(arc.Curve.Center, head.Curve.Center, 0.001)
        self.assertCoincide(arc.Curve.Center, tail.Curve.Center, 0.001)
Example #12
0
def test():
    from FreeCAD import Base
    import Part

    P1 = Base.Vector(1, -5, 0)
    P2 = Base.Vector(-5, 2, 0)
    P3 = Base.Vector(1, 5, 0)
    # Q = Base.Vector(5, 10, 0)
    # Q = Base.Vector(5, 11, 0)
    Q = Base.Vector(5, 0, 0)
    r2 = 3.0
    axis = Base.Vector(0, 0, 1)
    ccw = False

    arc = Part.ArcOfCircle(P1, P2, P3)
    C = arc.Center
    Part.show(Part.makeLine(P3, Q))
    Part.show(arc.toShape())

    (S1, S2, M2) = makeArc(Vector(C.x, C.y, C.z), Vector(P3.x, P3.y, P3.z),
                           Vector(Q.x, Q.y, Q.z),
                           Vector(axis.x, axis.y, axis.z), r2, ccw)
    circle = Part.Circle(Base.Vector(M2.x, M2.y, M2.z), Base.Vector(0, 0, 1),
                         math.fabs(r2))
    Part.show(circle.toShape())
def force_short_arc(p1, p2, edge):
    edge.parameter(p1), edge.FirstParameter
    edge.parameter(p2), edge.LastParameter
    if edge.LastParameter - edge.FirstParameter > pi:
        edge = Part.ArcOfCircle(
            edge.Circle, edge.LastParameter, 2 * pi + edge.FirstParameter
        )
    return edge
Example #14
0
def generate_key_sketch(parameters,add_clearence,sketch,Offset=0):    
    key_radius,key_flat = generate_slot_size(parameters,add_clearence)
    arc = sketch.addGeometry(Part.ArcOfCircle(Part.Circle(Base.Vector(Offset,0,0),Base.Vector(0,0,1),key_radius),2,1),False)
    sketch.addConstraint(Sketcher.Constraint('Coincident',arc,3,-1,1))
    c = sketch.addConstraint(Sketcher.Constraint('Radius',arc,key_radius))
    l = sketch.addGeometry(Part.LineSegment(Base.Vector(-2,key_flat,0),Base.Vector(2,key_flat/3,0)),False)
    #print(arc,l)
    sketch.addConstraint(Sketcher.Constraint('Coincident',l,1,arc,1))
    sketch.addConstraint(Sketcher.Constraint('Coincident',l,2,arc,2))
    sketch.addConstraint(Sketcher.Constraint('Horizontal',l))
    vc = sketch.addConstraint(Sketcher.Constraint('DistanceY',0,3,l,1,key_flat))
Example #15
0
def CreateSlotPlateInnerSet(SketchFeature):
	SketchFeature.addGeometry(Part.Circle(App.Vector(195.055893,39.562252,0),App.Vector(0,0,1),29.846098))
	SketchFeature.addGeometry(Part.LineSegment(App.Vector(150.319031,13.449363,0),App.Vector(36.700474,13.139774,0)))
	SketchFeature.addConstraint(Sketcher.Constraint('Horizontal',5)) 
	SketchFeature.addGeometry(Part.LineSegment(App.Vector(36.700474,13.139774,0),App.Vector(77.566010,63.292927,0)))
	SketchFeature.addConstraint(Sketcher.Constraint('Coincident',5,2,6,1)) 
	SketchFeature.addGeometry(Part.LineSegment(App.Vector(77.566010,63.292927,0),App.Vector(148.151917,63.602505,0)))
	SketchFeature.addConstraint(Sketcher.Constraint('Coincident',6,2,7,1)) 
	SketchFeature.addConstraint(Sketcher.Constraint('Horizontal',7)) 
	SketchFeature.addConstraint(Sketcher.Constraint('Parallel',1,6)) 
	SketchFeature.addGeometry(Part.ArcOfCircle(Part.Circle(App.Vector(192.422913,38.216347,0),App.Vector(0,0,1),45.315174),2.635158,3.602228))
	SketchFeature.addConstraint(Sketcher.Constraint('Coincident',7,2,8,1)) 
	SketchFeature.addConstraint(Sketcher.Constraint('Coincident',8,2,5,1))
Example #16
0
def reverseEdge(e):
    if geomType(e) == "Circle":
        arcstpt = e.valueAt(e.FirstParameter)
        arcmid = e.valueAt((e.LastParameter - e.FirstParameter) * 0.5 + e.FirstParameter)
        arcendpt = e.valueAt(e.LastParameter)
        arcofCirc = Part.ArcOfCircle(arcendpt, arcmid, arcstpt)
        newedge = arcofCirc.toShape()
    elif geomType(e) == "LineSegment" or geomType(e) == "Line":
        stpt = e.valueAt(e.FirstParameter)
        endpt = e.valueAt(e.LastParameter)
        newedge = Part.makeLine(endpt, stpt)

    return newedge
Example #17
0
 def setBy3Points(self,p1,p2,p3):
     "sets the arc by three points"
     import Part
     try:
         arc=Part.ArcOfCircle(p1,p2,p3)
     except: return
     e=arc.toShape()
     self.autoinvert = False
     self.normal = e.Curve.Axis.negative() # axis is always in wrong direction
     self.basevector = self.getDeviation()
     self.setCenter(e.Curve.Center)
     self.setRadius(e.Curve.Radius)
     self.setStartPoint(p1)
     self.setEndPoint(p3)
Example #18
0
def test_arc():

    # Vectors 
    v0 = App.Vector(0.0, 0.0, 0.0)
    v1 = App.Vector(10.0, 0.0, 0.0)
    v2 = App.Vector(10.0, 10.0, 0.0)

    # Wire
    Draft.makeWire([v0, v1, v2])

    # Arc
    arc = Part.ArcOfCircle(v0, v1, v2)
    Part.show(arc.toShape())
    c = Draft.makeCircle(arc.toShape())

    Draft.autogroup(c)
Example #19
0
    def generatePCB(self, PCB, doc, groupBRD, gruboscPlytki):
        doc.addObject('Sketcher::SketchObject', 'PCB_Border')
        doc.PCB_Border.Placement = FreeCAD.Placement(
            FreeCAD.Vector(0.0, 0.0, 0.0),
            FreeCAD.Rotation(0.0, 0.0, 0.0, 1.0))
        #
        for i in PCB[0]:
            if i[0] == 'Arc':  # arc by 3 points
                x1 = i[1]
                y1 = i[2]
                x2 = i[3]
                y2 = i[4]
                [x3, y3] = self.arcMidPoint([x2, y2], [x1, y1], i[5])

                arc = Part.Arc(FreeCAD.Vector(x1, y1, 0.0),
                               FreeCAD.Vector(x3, y3, 0.0),
                               FreeCAD.Vector(x2, y2, 0.0))
                doc.PCB_Border.addGeometry(
                    self.Draft2Sketch(arc, doc.PCB_Border))
            elif i[0] == 'Arc_2':  # arc by center / start angle / stop angle / radius
                doc.PCB_Border.addGeometry(
                    Part.ArcOfCircle(
                        Part.Circle(FreeCAD.Vector(i[1], i[2], 0),
                                    FreeCAD.Vector(0, 0, 1), i[3]), i[4],
                        i[5]))
            elif i[0] == 'Circle':
                doc.PCB_Border.addGeometry(
                    Part.Circle(FreeCAD.Vector(i[1], i[2]),
                                FreeCAD.Vector(0, 0, 1), i[3]))
            elif i[0] == 'Line':
                doc.PCB_Border.addGeometry(
                    Part.Line(FreeCAD.Vector(i[1], i[2], 0),
                              FreeCAD.Vector(i[3], i[4], 0)))
        #
        #if PCB[1]:
        PCBboard = doc.addObject("Part::FeaturePython", "Board")
        PCBboardObject(PCBboard)
        PCBboard.Thickness = gruboscPlytki
        PCBboard.Border = doc.PCB_Border
        viewProviderPCBboardObject(PCBboard.ViewObject)
        groupBRD.addObject(doc.Board)
        FreeCADGui.activeDocument().getObject(
            PCBboard.Name).ShapeColor = PCBconf.PCB_COLOR
        FreeCADGui.activeDocument().PCB_Border.Visibility = False
        self.updateView()
Example #20
0
    def Activated(self):
        doc = FreeCAD.ActiveDocument
        pg = FreeCAD.ParamGet("User parameter:Plugins/MeshRemodel")
        line_width = pg.GetFloat("LineWidth", 5.0)
        point_size = pg.GetFloat("PointSize", 4.0)
        modifiers = QtGui.QApplication.keyboardModifiers()
        poly = Part.makePolygon(self.pts)
        #        Part.show(poly)
        normal = DraftGeomUtils.getNormal(poly)

        A = self.pts[0]
        B = self.pts[1]
        C = self.pts[2]

        if gu.isColinear(A, B, C):
            FreeCAD.Console.PrintError(
                "MeshRemodel Error: Cannot make arc/circle from 3 colinear points\n"
            )
            return
        center = gu.circumcenter(A, B, C)
        radius = gu.circumradius(A, B, C)

        doc.openTransaction("Create Arc")
        arc = Part.ArcOfCircle(A, B, C)
        #on ctrl+shift click we only show center
        arcName = "MR_Ref"
        if not modifiers == QtCore.Qt.ControlModifier.__or__(
                QtCore.Qt.ShiftModifier):
            Part.show(arc.toShape(), "MR_Arc")
            arcName = doc.ActiveObject.Name
            doc.ActiveObject.ViewObject.LineWidth = line_width
            FreeCAD.Console.PrintMessage(arcName + ": radius = " +
                                         str(radius) + "\n  center at " +
                                         str(center) + "\n")
            Gui.Selection.clearSelection()
            Gui.Selection.addSelection(doc.getObject(arcName))
        if modifiers == QtCore.Qt.ControlModifier or modifiers == QtCore.Qt.ControlModifier.__or__(
                QtCore.Qt.ShiftModifier):
            Part.show(Part.Point(center).toShape(),
                      arcName + "_Ctr")  #show the center point
            doc.ActiveObject.ViewObject.PointSize = point_size
        doc.recompute()
        doc.commitTransaction()
        #QtGui.QApplication.restoreOverrideCursor()
        return
 def _createCoilStart(self, fp):
     pathEdges = []
     if (fp.StartTransit):
         m = fp.Profile.Shape.BoundBox.Center  # Center of the profile
         radius = m.distanceToLine(fp.Center, fp.Center + fp.Axis)
         circleStart = Part.Circle(fp.Center, fp.Axis, radius)
         a = circle.parameter(m)
         if (fp.StartFlat > 0):  # Angle of the flat part
             b = a + readians(fp.StartFlat)
             arc = Part.ArcOfCircle(circleStart, a, b)
             a = b
             pathEdges.append(arc.toShape())
         if (fp.StartSegue >
                 0):  # Tangent connection between flat and helical part.
             b = a + radians(fp.StartSegue)
             edge = Part.makeBSpline(points)
             a = b
             pathEdges.append(edge)
     return pathEdges, a
Example #22
0
def ricreaShapeElementare(sh, begin, end):
    # controllo il tipo passato
    # Wire?
    if isinstance(sh, Part.Wire):
        # Estraggo le edges
        edges = sh.Edges
        if (len(edges) == 1):
            # Ho una sola edge, la converto con i nuovi punti di inizio e fine ed esco
            return ([ricreaShapeElementare(edges[0], begin, end)])
        elif (len(edges) > 1):
            # Ho più edges, converto la prima con il nuovo inizio e l'ultima con la nuova fine, le altre senza modificare inizio e fine
            list = ricreaShapeElementare(
                edges[0], begin, edges[0].valueAt(edges[0].LastParameter))
            for e in edges[1:-1]:
                list.append(
                    ricreaShapeElementare(e, e.valueAt(e.FirstParameter),
                                          e.valueAt(e.LastParameter)))
            list.append(
                ricreaShapeElementare(
                    edges[-1], edges[-1].valueAt(edges[-1].FirstParameter),
                    end))
            return (list)
    # Edge?
    elif isinstance(sh, Part.Edge):
        # Line?
        if isinstance(sh.Curve, Part.Line):
            return ([Part.LineSegment(begin, end).toShape()])
        # Circle?
        elif isinstance(sh.Curve, Part.Circle):
            return ([
                Part.ArcOfCircle(
                    begin,
                    sh.valueAt((sh.FirstParameter + sh.LastParameter) / 2.0),
                    end).toShape()
            ])
        else:
            print("Part.Edge ma non Line o Circle :-o")
            print(sh.ShapeType)
            print(sh.Curve)
            return ([])
    else:
        print("Né Wire né Line o Circle")
        return ([])
 def _createCoildEnd(self, fp, a):
     pathEdges = []
     if (fp.EndTransit):
         m = fp.Profile.Shape.BoundBox.Center  # Center of the profile
         circleEnd = Part.Circle(fp.Center, fp.Axis, radiusEnd)
         radius = m.distanceToLine(fp.Center, fp.Center + fp.Axis)
         radius -= fp.Height * sin(radians(fp.Angle))
         if (fp.EndSegue >
                 0):  # Tangent connection between helical and flat part.
             b = a + radians(fp.EndSegue)
             edge = Part.makeBSpline(points)
             a = b
             pathEdges.append(edge)
         if (fp.EndFlat > 0):
             b = a + radians(fp.EndFlat)
             edge = Part.ArcOfCircle(
                 Part.Circle(fp.Center, fp.Axis, radius), a, b)
             a = b
             profileEdges.append(edge)
     return pathEdges
Example #24
0
def xyarc(args, state):
    # no native support in RML/Modela, convert to linear line segments
    c = []

    lastPoint = FreeCAD.Vector(state['X'], state['Y'])
    newPoint = FreeCAD.Vector(float(args['X']), float(args['Y']))
    centerOffset = FreeCAD.Vector(float(args['I']), float(args['J']))
    center = lastPoint + centerOffset
    radius = (center - lastPoint).Length
    xyNormal = FreeCAD.Vector(0, 0, 1)
    circle = Part.Circle(center, xyNormal, radius)
    p0 = circle.parameter(lastPoint)
    p1 = circle.parameter(newPoint)
    arc = Part.ArcOfCircle(circle, p0, p1)
    steps = 64  # TODO: specify max error instead
    points = arc.discretize(steps)
    # TODO: consider direction
    #print('p = Part.ArcOfCircle(Part.Circle(FreeCAD.Vector(%f, %f), FreeCAD.Vector(0, 0, 1), %f), %f, %f)' % (center.x, center.y, radius, p0, p1))
    for p in points:
        c += feed(p.x, p.y, state['Z'], state)
    return c
Example #25
0
 def testUnconnectedCurve(self):
     SketchFeature = self.Doc.addObject('Sketcher::SketchObject',
                                        'UnconnectedCurve')
     SketchFeature.addGeometry(
         Part.LineSegment(App.Vector(0, 0, 0), App.Vector(1, 1, 0)))
     SketchFeature.addConstraint(
         Sketcher.Constraint('Coincident', 0, 1, -1, 1))
     SketchFeature.addConstraint(
         Sketcher.Constraint('DistanceX', 0, 1, 0, 2, 1))
     SketchFeature.addConstraint(
         Sketcher.Constraint('DistanceY', 0, 1, 0, 2, 1))
     arc = Part.ArcOfCircle(
         Part.Circle(App.Vector(3, 1, 0), App.Vector(0, 0, 1), 1.75), -3.14,
         -2.17)
     SketchFeature.addGeometry(arc)
     SketchFeature.addConstraint(
         Sketcher.Constraint('DistanceX', -1, 1, 1, 3, 3.0))
     SketchFeature.addConstraint(
         Sketcher.Constraint('DistanceY', -1, 1, 1, 3, 1.0))
     SketchFeature.addConstraint(
         Sketcher.Constraint('Distance', 0, 2, 1, 1, 0.25))
     self.Doc.recompute()
Example #26
0
        def run(ag, bg):

            try:
                p2 = sk.getPoint(ag, 1)
                p0 = sk.getPoint(bg, 2)
                ps = sk.getPoint(ag, 2)
            except:
                print "points not found"
                return

            alpha = np.arccos((p2 - ps).normalize().dot((p0 - ps).normalize()))
            radius = (p2 - ps).Length * np.tan(alpha * 0.5)

            print "Richtung ", (p2 - ps).normalize().dot((p0 - ps).normalize())

            vv = (p2 - ps).normalize().cross((p0 - ps).normalize())

            f = vv.z < 0

            if not f:
                mp = p2 - (p2 - ps).normalize().cross(FreeCAD.Vector(
                    0, 0, 1)) * radius
            else:
                mp = p2 + (p2 - ps).normalize().cross(FreeCAD.Vector(
                    0, 0, 1)) * radius

            r2 = (p2 - mp)
            r0 = (p0 - mp)
            w1 = np.arctan2(r2.y, r2.x)
            w2 = np.arctan2(r0.y, r0.x)

            if not f:
                w1, w2 = w2, w1

            cc = obj.addGeometry(
                Part.ArcOfCircle(Part.Circle(mp, App.Vector(0, 0, 1), radius),
                                 w1, w2), False)
            obj.solve()
Example #27
0
File: gt2.py Project: eaguirrea/gt2
    def create_gear(self, doc, data):
        """
			Create the geometry of the gear. Each tooth is a sequence of arcs 
			(3 points non coincidental vertices). 
		"""
        teeth = data['teeth']
        angle = 360.0 / teeth
        gear = []
        for idx in range(teeth):
            step = angle * idx
            t = None
            if data['group'] == "GT":
                t = self.gt_tooth(step, data)
            else:
                raise Exception("Invalid group %s" % data['group'])
            if len(gear) > 0:
                doc.SketchGear.addGeometry(Part.LineSegment(gear[-1], t[0]))
            gear.extend(t)
            for idx in range(0, len(t) - 1, 3):
                doc.SketchGear.addGeometry(
                    Part.ArcOfCircle(t[idx], t[idx + 1], t[idx + 2]))
        doc.SketchGear.addGeometry(Part.LineSegment(gear[-1], gear[0]))
        doc.recompute()
Example #28
0
    def testCurve(self):
        SketchFeature = self.Doc.addObject('Sketcher::SketchObject', 'Curve')
        SketchFeature.addGeometry(
            Part.LineSegment(App.Vector(0, 0, 0), App.Vector(1, 1, 0)))
        SketchFeature.addConstraint(
            Sketcher.Constraint('Coincident', 0, 1, -1, 1))
        SketchFeature.addConstraint(
            Sketcher.Constraint('DistanceX', 0, 1, 0, 2, 1))
        SketchFeature.addConstraint(
            Sketcher.Constraint('DistanceY', 0, 1, 0, 2, 1))
        arc = Part.ArcOfCircle(
            Part.Circle(App.Vector(3, 0, 0), App.Vector(0, 0, 1), 3), 0, -1)
        SketchFeature.addGeometry(arc)
        SketchFeature.addConstraint(
            Sketcher.Constraint('DistanceX', 1, 3, -1, 1, -3))
        SketchFeature.addConstraint(
            Sketcher.Constraint('DistanceY', 1, 3, -1, 1, 0))
        SketchFeature.addConstraint(
            Sketcher.Constraint('Coincident', 1, 1, 0, 2))
        self.Doc.recompute()

        SketchFeature.fillet(0, 1, App.Vector(0.5, 0.5, 0),
                             App.Vector(0.8, 0.3, 0), 0.25, True, True)
        self.assertAlmostEqual(SketchFeature.Geometry[2].Radius, 0.25)
    def _build_path(sketch, points):
        '''
        Builds the sweep path
        sketch - the target sketch to contain the sweep path
        points - the list of point sublists which describe the final path
        '''

        for point_vecs in points:

            point_count = len(point_vecs)
            geo = None

            # Three-point sublist is a curve
            if point_count == 3:
                geo = Part.ArcOfCircle(point_vecs[0], point_vecs[1], point_vecs[2])

            # Two-point sublist is a line
            elif point_count == 2:
                geo = Part.LineSegment(point_vecs[0], point_vecs[1])

            if geo is None:
                continue

            sketch.addGeometry(geo)
Example #30
0
	def draw(self):
		
		if self.side == "Right":
			self.rodDia = gv.zRodDiaR
		elif self.side == "Left":
			self.rodDia = gv.zRodDiaL

		#set up helper Variables
		supportWidth = (self.rodDia + 
						gv.printedToPrintedDia + 
						gv.clampNutFaceToFace + 
						2*gv.clampNutPadding)
						
		tabWidth = gv.slotDia+gv.slotWidth+2*gv.slotPadding
		tabLength = 2*gv.slotPadding+gv.slotDia
		totalLength = 2*tabLength + gv.zRodSupportLength

		try:
			App.getDocument(self.name).recompute()
			App.closeDocument(self.name)
			App.setActiveDocument("")
			App.ActiveDocument=None
		except:
			pass

		#make document
		App.newDocument(self.name)
		App.setActiveDocument(self.name)
		App.ActiveDocument=App.getDocument(self.name)
		App.ActiveDocument=App.getDocument(self.name)
		
		#Create tabs
		#Sketch points
		p1x = -tabWidth/2
		p1y = totalLength/2
		p2x = tabWidth/2
		p2y = totalLength/2
		p3x = tabWidth/2
		p3y = -totalLength/2
		p4x = -tabWidth/2
		p4y = -totalLength/2
		
		#MakeSketch
		App.activeDocument().addObject('Sketcher::SketchObject','Sketch')
		App.activeDocument().Sketch.Placement = App.Placement(App.Vector(0.000000,0.000000,0.000000),App.Rotation(0.000000,0.000000,0.000000,1.000000))
		App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(p1x,p1y,0),App.Vector(p2x,p2y,0)))
		App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(p2x,p2y,0),App.Vector(p3x,p3y,0)))
		App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(p3x,p3y,0),App.Vector(p4x,p4y,0)))
		App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(p4x,p4y,0),App.Vector(p1x,p1y,0)))
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',0,2,1,1)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',1,2,2,1)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',2,2,3,1)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',3,2,0,1)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Horizontal',0)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Horizontal',2)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Vertical',1)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Vertical',3)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Symmetric',0,1,1,2,-1,1)) 
		App.ActiveDocument.recompute()
		
		#add dimensions
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('DistanceY',1,-totalLength)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('DistanceX',2,-tabWidth)) 
		App.ActiveDocument.recompute()
		App.getDocument(self.name).recompute()
		
		#Pad Sketch
		App.activeDocument().addObject("PartDesign::Pad","Pad")
		App.activeDocument().Pad.Sketch = App.activeDocument().Sketch
		App.activeDocument().Pad.Length = 10.0
		App.ActiveDocument.recompute()
		App.ActiveDocument.Pad.Length = gv.tabThickness
		App.ActiveDocument.Pad.Reversed = 0
		App.ActiveDocument.Pad.Midplane = 0
		App.ActiveDocument.Pad.Length2 = 100.000000
		App.ActiveDocument.Pad.Type = 0
		App.ActiveDocument.Pad.UpToFace = None
		App.ActiveDocument.recompute()

		#Cut top slot
		#Sketch Points
		p1x = -gv.slotWidth/2
		p1y = gv.zRodSupportLength/2+gv.slotPadding
		p2x = gv.slotWidth/2
		p2y = gv.zRodSupportLength/2+gv.slotPadding
		p3x = -gv.slotWidth/2
		p3y = gv.zRodSupportLength/2+gv.slotPadding+gv.slotDia/2
		p4x = gv.slotWidth/2
		p4y = gv.zRodSupportLength/2+gv.slotPadding+gv.slotDia/2
		p5x = gv.slotWidth/2
		p5y = gv.zRodSupportLength/2+gv.slotPadding-gv.slotDia/2
		p6x = -gv.slotWidth/2
		p6y = gv.zRodSupportLength/2+gv.slotPadding-gv.slotDia/2
		p7x = 0
		p7y = gv.zRodSupportLength/2+gv.slotPadding-gv.slotDia/2
		
		#make Sketch
		App.activeDocument().addObject('Sketcher::SketchObject','Sketch001')
		App.activeDocument().Sketch001.Support = uf.getFace(App.ActiveDocument.Pad,
														  None,None,
														  None, None,
														  gv.tabThickness, 0)
		App.activeDocument().recompute()
		App.ActiveDocument.Sketch001.addExternal("Pad",uf.getEdge(App.ActiveDocument.Pad, 
														  0,0,
														  0,1,
														  gv.tabThickness, 0))
		App.ActiveDocument.Sketch001.addGeometry(Part.ArcOfCircle(Part.Circle(App.Vector(p1x,p1y,0),App.Vector(0,0,1),gv.slotDia/2),math.pi/2,-math.pi/2))
		App.ActiveDocument.Sketch001.addGeometry(Part.ArcOfCircle(Part.Circle(App.Vector(p2x,p2y,0),App.Vector(0,0,1),gv.slotDia/2),-math.pi/2,math.pi/2))
		App.ActiveDocument.Sketch001.addGeometry(Part.Line(App.Vector(p6x,p6y,0),App.Vector(p5x,p5y,0)))
		App.ActiveDocument.Sketch001.addGeometry(Part.Line(App.Vector(p3x,p3y,0),App.Vector(p4x,p4y,0)))
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Tangent',0,2)) 
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Tangent',0,3)) 
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Tangent',1,2)) 
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Tangent',1,3)) 
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Coincident',0,1,3,1)) 
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Coincident',0,2,2,1)) 
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Coincident',2,2,1,1)) 
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Coincident',3,2,1,2)) 
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Horizontal',2)) 
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Equal',0,1)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addGeometry(Part.Point(App.Vector(p7x,p7y,0)))
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('PointOnObject',4,1,2)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('PointOnObject',4,1,-2)) 
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Symmetric',1,1,0,2,4,1)) 
		App.ActiveDocument.recompute()
		
		#add dimensions
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Radius',1,gv.slotDia/2)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Distance',0,3,1,3,gv.slotWidth)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Distance',0,1,-3,gv.slotPadding)) 
		App.ActiveDocument.recompute()
		App.getDocument(self.name).recompute()
		
		#Cut slot through all
		App.activeDocument().addObject("PartDesign::Pocket","Pocket")
		App.activeDocument().Pocket.Sketch = App.activeDocument().Sketch001
		App.activeDocument().Pocket.Length = 5.0
		App.ActiveDocument.recompute()
		App.ActiveDocument.Pocket.Length = 5.000000
		App.ActiveDocument.Pocket.Type = 1
		App.ActiveDocument.Pocket.UpToFace = None
		App.ActiveDocument.recompute()

		#Mirror slot along horizotal axis
		App.activeDocument().addObject("PartDesign::Mirrored","Mirrored")
		App.ActiveDocument.recompute()
		App.activeDocument().Mirrored.Originals = [App.activeDocument().Pocket,]
		App.activeDocument().Mirrored.MirrorPlane = (App.activeDocument().Sketch001, ["V_Axis"])
		App.ActiveDocument.Mirrored.Originals = [App.ActiveDocument.Pocket,]
		App.ActiveDocument.Mirrored.MirrorPlane = (App.ActiveDocument.Sketch001,["H_Axis"])
		App.ActiveDocument.recompute()

		#Make rod support column
		#Sketch points
		p1x = -supportWidth/2
		p1y = -gv.zRodSupportLength/2
		p2x = -supportWidth/2
		p2y = gv.zRodSupportLength/2
		p3x = supportWidth/2
		p3y = gv.zRodSupportLength/2
		p4x = supportWidth/2
		p4y = -gv.zRodSupportLength/2
		
		#Make sketch
		App.activeDocument().addObject('Sketcher::SketchObject','Sketch002')
		App.activeDocument().Sketch002.Support = uf.getFace(App.ActiveDocument.Mirrored,
														  None,None,
														  None, None,
														  0, 0)
		App.activeDocument().recompute()
		App.ActiveDocument.Sketch002.addGeometry(Part.Line(App.Vector(p1x,p1y,0),App.Vector(p4x,p4y,0)))
		App.ActiveDocument.Sketch002.addGeometry(Part.Line(App.Vector(p4x,p4y,0),App.Vector(p3x,p3y,0)))
		App.ActiveDocument.Sketch002.addGeometry(Part.Line(App.Vector(p3x,p3y,0),App.Vector(p2x,p2y,0)))
		App.ActiveDocument.Sketch002.addGeometry(Part.Line(App.Vector(p2x,p2y,0),App.Vector(p1x,p1y,0)))
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('Coincident',0,2,1,1)) 
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('Coincident',1,2,2,1)) 
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('Coincident',2,2,3,1)) 
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('Coincident',3,2,0,1)) 
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('Horizontal',0)) 
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('Horizontal',2)) 
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('Vertical',1)) 
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('Vertical',3)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('Symmetric',0,1,1,2,-1,1)) 
		App.ActiveDocument.recompute()
		
		#add dimensions
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('DistanceY',1,gv.zRodSupportLength)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('DistanceX',2,-supportWidth)) 
		App.ActiveDocument.recompute()
		App.getDocument(self.name).recompute()
		
		#pad rod support
		App.activeDocument().addObject("PartDesign::Pad","Pad001")
		App.activeDocument().Pad001.Sketch = App.activeDocument().Sketch002
		App.activeDocument().Pad001.Length = 10.0
		App.ActiveDocument.recompute()
		App.ActiveDocument.Pad001.Length = gv.zRodStandoff-gv.clampGap/2
		App.ActiveDocument.Pad001.Reversed = 1
		App.ActiveDocument.Pad001.Midplane = 0
		App.ActiveDocument.Pad001.Length2 = 100.000000
		App.ActiveDocument.Pad001.Type = 0
		App.ActiveDocument.Pad001.UpToFace = None
		App.ActiveDocument.recompute()

		#Make cut out for z rod
		#Sketch points
		p1x = 0
		p1y = gv.zRodStandoff
		p2x = -self.rodDia/2
		p2y = gv.zRodStandoff
		p3x = self.rodDia/2
		p3y = gv.zRodStandoff
		
		#make sketch
		App.activeDocument().addObject('Sketcher::SketchObject','Sketch003')
		App.activeDocument().Sketch003.Support = uf.getFace(App.ActiveDocument.Pad001,
														  0,0,
														  -gv.zRodSupportLength/2,0,
														  None, None)
		App.ActiveDocument.Sketch003.addExternal("Pad001",uf.getEdge(App.ActiveDocument.Pad001, 
 														  0,0,
 														  -gv.zRodSupportLength/2, 0,
 														  gv.zRodStandoff-gv.clampGap/2, 0))
		App.activeDocument().recompute()	
		App.ActiveDocument.Sketch003.addGeometry(Part.ArcOfCircle(Part.Circle(App.Vector(p1x,p1y,0),App.Vector(0,0,1),self.rodDia/2),math.pi,2*math.pi))
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch003.addConstraint(Sketcher.Constraint('PointOnObject',0,3,-2)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch003.addGeometry(Part.Line(App.Vector(p2x,p2y,0),App.Vector(p3x,p3y,0)))
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch003.addConstraint(Sketcher.Constraint('Coincident',1,1,0,1)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch003.addConstraint(Sketcher.Constraint('Coincident',1,2,0,2)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch003.addConstraint(Sketcher.Constraint('Horizontal',1)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch003.addConstraint(Sketcher.Constraint('PointOnObject',0,3,1)) 
		
		#Add dimensions
		App.ActiveDocument.Sketch003.addConstraint(Sketcher.Constraint('Distance',0,3,-3,gv.clampGap/2)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch003.addConstraint(Sketcher.Constraint('Radius',0,self.rodDia/2)) 
		App.ActiveDocument.recompute()
		App.getDocument(self.name).recompute()
		
		#Cut through all
		App.activeDocument().addObject("PartDesign::Pocket","Pocket001")
		App.activeDocument().Pocket001.Sketch = App.activeDocument().Sketch003
		App.activeDocument().Pocket001.Length = 5.0
		App.ActiveDocument.recompute()
		App.ActiveDocument.Pocket001.Length = 5.000000
		App.ActiveDocument.Pocket001.Type = 1
		App.ActiveDocument.Pocket001.UpToFace = None
		App.ActiveDocument.recompute()

		#cut Right clamp hole
		#Sketch points
		p1x = self.rodDia/2+gv.printedToPrintedDia/2
		p1y = 0
		
		#Make sketch
		App.activeDocument().addObject('Sketcher::SketchObject','Sketch004')
		App.activeDocument().Sketch004.Support = uf.getFace(App.ActiveDocument.Pocket001,
														  0,1,
														  0,0,
														  gv.zRodStandoff-gv.clampGap/2,0)
		App.activeDocument().recompute()
		App.ActiveDocument.Sketch004.addGeometry(Part.Circle(App.Vector(p1x,p1y,0),App.Vector(0,0,1),gv.printedToPrintedDia/2))
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch004.addConstraint(Sketcher.Constraint('PointOnObject',0,3,-1)) 
		App.ActiveDocument.recompute()

		
		#Add dimensions
		App.ActiveDocument.Sketch004.addConstraint(Sketcher.Constraint('Radius',0,gv.printedToPrintedDia/2)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch004.addConstraint(Sketcher.Constraint('Distance',-1,1,0,3,self.rodDia/2+gv.printedToPrintedDia/2)) 
		App.ActiveDocument.recompute()
		App.getDocument(self.name).recompute()
		
		#Cut clamp hole through all
		App.activeDocument().addObject("PartDesign::Pocket","Pocket002")
		App.activeDocument().Pocket002.Sketch = App.activeDocument().Sketch004
		App.activeDocument().Pocket002.Length = 5.0
		App.ActiveDocument.recompute()
		App.ActiveDocument.Pocket002.Length = 5.000000
		App.ActiveDocument.Pocket002.Type = 1
		App.ActiveDocument.Pocket002.UpToFace = None
		App.ActiveDocument.recompute()

		#Reflect clamp hole accross verticle axis
		App.activeDocument().addObject("PartDesign::Mirrored","Mirrored001")
		App.ActiveDocument.recompute()
		App.activeDocument().Mirrored001.Originals = [App.activeDocument().Pocket002,]
		App.activeDocument().Mirrored001.MirrorPlane = (App.activeDocument().Sketch004, ["V_Axis"])
		App.ActiveDocument.Mirrored001.Originals = [App.ActiveDocument.Pocket002,]
		App.ActiveDocument.Mirrored001.MirrorPlane = (App.ActiveDocument.Sketch004,["V_Axis"])
		App.ActiveDocument.recompute()

		#refine shape
		App.activeDocument().addObject("Part::Feature","Refined").Shape = App.ActiveDocument.Mirrored001.Shape.removeSplitter()

		#Add Nut trap to right side
		#Sketch Points
		mat = uf.hexagonPoints(self.rodDia/2+gv.printedToPrintedDia/2,
								0,
								gv.clampNutFaceToFace,
								0)

		p1x = mat[0][0] 
		p1y = mat[0][1]
		p2x = mat[1][0]
		p2y = mat[1][1]
		p3x = mat[2][0]
		p3y = mat[2][1]
		p4x = mat[3][0]
		p4y = mat[3][1]
		p5x = mat[4][0]
		p5y = mat[4][1]
		p6x = mat[5][0]
		p6y = mat[5][1]
		p7x = mat[6][0]
		p7y = mat[6][1]
		hexRadius = mat[7][0]

		#make sketch
		App.activeDocument().addObject('Sketcher::SketchObject','Sketch005')
		App.activeDocument().Sketch005.Support = uf.getFace(App.ActiveDocument.Refined,
														  0,0,
														  0,0,
														  0,0)
		App.ActiveDocument.Sketch005.addExternal("Refined",uf.getEdge(App.ActiveDocument.Refined, 
 														  0,1,
 														  None, None,
 														  0, 0,
 														  radius = gv.printedToPrintedDia/2,
 														  makeUnique = True))
							
		App.ActiveDocument.Sketch005.addGeometry(Part.Line(App.Vector(p1x,p1y,0),App.Vector(p2x,p2y,0)))
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch005.addGeometry(Part.Line(App.Vector(p2x,p2y,0),App.Vector(p3x,p3y,0)))
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('Coincident',0,2,1,1)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch005.addGeometry(Part.Line(App.Vector(p3x,p3y,0),App.Vector(p4x,p4y,0)))
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('Coincident',1,2,2,1)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch005.addGeometry(Part.Line(App.Vector(p4x,p4y,0),App.Vector(p5x,p5y,0)))
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('Coincident',2,2,3,1)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch005.addGeometry(Part.Line(App.Vector(p5x,p5y,0),App.Vector(p6x,p6y,0)))
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('Coincident',3,2,4,1)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch005.addGeometry(Part.Line(App.Vector(p6x,p6y,0),App.Vector(p1x,p1y,0)))
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('Coincident',4,2,5,1)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('Coincident',5,2,0,1)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch005.addGeometry(Part.Circle(App.Vector(p7x,p7y,0),App.Vector(0,0,1),hexRadius))
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('PointOnObject',0,1,6)) 
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('PointOnObject',0,2,6)) 
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('PointOnObject',1,2,6)) 
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('PointOnObject',2,2,6)) 
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('PointOnObject',3,2,6)) 
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('PointOnObject',4,2,6)) 
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('Equal',5,0)) 
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('Equal',0,1)) 
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('Equal',1,2)) 
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('Equal',2,3)) 
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('Equal',3,4)) 
		App.ActiveDocument.Sketch005.toggleConstruction(6) 
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('Coincident',-3,3,6,3)) 
		App.ActiveDocument.recompute()

		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch005.addConstraint(Sketcher.Constraint('Distance',0,2,4,gv.clampNutFaceToFace)) 
		App.ActiveDocument.recompute()
		App.getDocument(self.name).recompute()

		#cut nut trap out
		App.activeDocument().addObject("PartDesign::Pocket","Pocket003")
		App.activeDocument().Pocket003.Sketch = App.activeDocument().Sketch005
		App.activeDocument().Pocket003.Length = 5.0
		App.ActiveDocument.recompute()
		App.ActiveDocument.Pocket003.Length = gv.rodSupportNutTrapDepthMin
		App.ActiveDocument.Pocket003.Type = 0
		App.ActiveDocument.Pocket003.UpToFace = None
		App.ActiveDocument.recompute()

		#Mirror nut trap
		App.activeDocument().addObject("PartDesign::Mirrored","Mirrored002")
		App.ActiveDocument.recompute()
		App.activeDocument().Mirrored002.Originals = [App.activeDocument().Pocket003,]
		App.activeDocument().Mirrored002.MirrorPlane = (App.activeDocument().Sketch005, ["V_Axis"])
		App.ActiveDocument.Mirrored002.Originals = [App.ActiveDocument.Pocket003,]
		App.ActiveDocument.Mirrored002.MirrorPlane = (App.ActiveDocument.Sketch005,["V_Axis"])
		App.ActiveDocument.recompute()


		#Set view as axometric

		#Make the coresponding xRodClamp
		try:
			App.getDocument(self.name+"Clamp").recompute()
			App.closeDocument(self.name+"Clamp")
			App.setActiveDocument("")
			App.ActiveDocument=None
		except:
			pass

		#make document
		App.newDocument(self.name+"Clamp")
		App.setActiveDocument(self.name+"Clamp")
		App.ActiveDocument=App.getDocument(self.name+"Clamp")
		App.ActiveDocument=App.getDocument(self.name+"Clamp")
		
		#Make clamp body
		#Sketch points
		p1x = -supportWidth/2
		p1y = -gv.zRodSupportLength/2
		p2x = -supportWidth/2
		p2y = gv.zRodSupportLength/2
		p3x = supportWidth/2
		p3y = gv.zRodSupportLength/2
		p4x = supportWidth/2
		p4y = -gv.zRodSupportLength/2

		#Make Sketch
		App.activeDocument().addObject('Sketcher::SketchObject','Sketch')
		App.activeDocument().Sketch.Placement = App.Placement(App.Vector(0.000000,0.000000,0.000000),App.Rotation(0.000000,0.000000,0.000000,1.000000))
		App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(p1x,p1y,0),App.Vector(p4x,p4y,0)))
		App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(p4x,p4y,0),App.Vector(p3x,p3y,0)))
		App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(p3x,p3y,0),App.Vector(p2x,p2y,0)))
		App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(p2x,p2y,0),App.Vector(p1x,p1y,0)))
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',0,2,1,1)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',1,2,2,1)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',2,2,3,1)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',3,2,0,1)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Horizontal',0)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Horizontal',2)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Vertical',1)) 
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Vertical',3)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Symmetric',0,1,1,2,-1,1)) 
		App.ActiveDocument.recompute()
		
		#add dimensions
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('DistanceY',1,gv.zRodSupportLength)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('DistanceX',2,-supportWidth)) 
		App.ActiveDocument.recompute()
		App.getDocument(self.name+"Clamp").recompute()
		
		#pad rod support
		App.activeDocument().addObject("PartDesign::Pad","Pad")
		App.activeDocument().Pad.Sketch = App.activeDocument().Sketch
		App.activeDocument().Pad.Length = 10.0
		App.ActiveDocument.recompute()
		App.ActiveDocument.Pad.Length = self.rodDia/2+gv.clampThickness-gv.clampGap/2
		App.ActiveDocument.Pad.Reversed = 0
		App.ActiveDocument.Pad.Midplane = 0
		App.ActiveDocument.Pad.Length2 = 100.000000
		App.ActiveDocument.Pad.Type = 0
		App.ActiveDocument.Pad.UpToFace = None
		App.ActiveDocument.recompute()

		#make cut out for rod
		#sketch points
		p1x = 0
		p1y = self.rodDia/2+gv.clampThickness
		p2x = -self.rodDia/2
		p2y = self.rodDia/2+gv.clampThickness
		p3x = self.rodDia/2
		p3y = self.rodDia/2+gv.clampThickness
		
		#Make Sketch
		#make sketch
		App.activeDocument().addObject('Sketcher::SketchObject','Sketch001')
		App.activeDocument().Sketch001.Support = uf.getFace(App.ActiveDocument.Pad,
														  0,0,
														  -gv.zRodSupportLength/2, 0,
														  None,None)
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addExternal("Pad",uf.getEdge(App.ActiveDocument.Pad, 
 														  0,0,
 														  -gv.zRodSupportLength/2, 0,
 														  self.rodDia/2+gv.clampThickness-gv.clampGap/2, 0))
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addGeometry(Part.ArcOfCircle(Part.Circle(App.Vector(p1x,p1y,0),App.Vector(0,0,1),self.rodDia/2),math.pi,2*math.pi))
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('PointOnObject',0,3,-2)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addGeometry(Part.Line(App.Vector(p2x,p2y,0),App.Vector(p3x,p3y,0)))
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Coincident',1,1,0,1)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Coincident',1,2,0,2)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Horizontal',1)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('PointOnObject',0,3,1)) 
		
		#Add dimensions
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Distance',0,3,-3,gv.clampGap/2)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch001.addConstraint(Sketcher.Constraint('Radius',0,self.rodDia/2)) 
		App.ActiveDocument.recompute()
		App.getDocument(self.name+"Clamp").recompute()
		
		#Cut through all
		App.activeDocument().addObject("PartDesign::Pocket","Pocket")
		App.activeDocument().Pocket.Sketch = App.activeDocument().Sketch001
		App.activeDocument().Pocket.Length = 5.0
		App.ActiveDocument.recompute()
		App.ActiveDocument.Pocket.Length = 5.000000
		App.ActiveDocument.Pocket.Type = 1
		App.ActiveDocument.Pocket.UpToFace = None
		App.ActiveDocument.recompute()


		#cut Right clamp hole
		#Sketch points
		p1x = self.rodDia/2+gv.printedToPrintedDia/2
		p1y = 0
		
		#Make sketch
		App.activeDocument().addObject('Sketcher::SketchObject','Sketch002')
		App.activeDocument().Sketch002.Support = uf.getFace(App.ActiveDocument.Pocket,
														  0,1,
														  0, 0,
														  self.rodDia/2+gv.clampThickness-gv.clampGap/2,0)
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch002.addGeometry(Part.Circle(App.Vector(p1x,p1y,0),App.Vector(0,0,1),gv.printedToPrintedDia/2))
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('PointOnObject',0,3,-1)) 
		App.ActiveDocument.recompute()

		
		#Add dimensions
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('Radius',0,gv.printedToPrintedDia/2)) 
		App.ActiveDocument.recompute()
		App.ActiveDocument.Sketch002.addConstraint(Sketcher.Constraint('Distance',-1,1,0,3,self.rodDia/2+gv.printedToPrintedDia/2)) 
		App.ActiveDocument.recompute()
		App.getDocument(self.name+"Clamp").recompute()
		
		#Cut clamp hole through all
		App.activeDocument().addObject("PartDesign::Pocket","Pocket001")
		App.activeDocument().Pocket001.Sketch = App.activeDocument().Sketch002
		App.activeDocument().Pocket001.Length = 5.0
		App.ActiveDocument.recompute()
		App.ActiveDocument.Pocket001.Length = 5.000000
		App.ActiveDocument.Pocket001.Type = 1
		App.ActiveDocument.Pocket001.UpToFace = None
		App.ActiveDocument.recompute()

		#Mirror clamp hole
		App.activeDocument().addObject("PartDesign::Mirrored","Mirrored")
		App.ActiveDocument.recompute()
		App.activeDocument().Mirrored.Originals = [App.activeDocument().Pocket001,]
		App.activeDocument().Mirrored.MirrorPlane = (App.activeDocument().Sketch002, ["V_Axis"])
		App.ActiveDocument.Mirrored.Originals = [App.ActiveDocument.Pocket001,]
		App.ActiveDocument.Mirrored.MirrorPlane = (App.ActiveDocument.Sketch002,["V_Axis"])
		App.ActiveDocument.recompute()

		#Set view as axometric