Example #1
0
    def legHolder(self,toCut=False):
        points = []
        c1  = Base.Vector(0,0,0)
        c2  = c1 + Base.Vector(self.legHolderLength,0,0)
        c3  = c2 + Base.Vector(0,self.horseWidth,0)
        c4  = c1 + Base.Vector(0,self.horseWidth,0)
        
        attachMargin = (self.legHolderLength- self.attachWidth)/2
        t11 = c1 + Base.Vector(attachMargin,0,0)
        t12 = t11+ Base.Vector(self.attachWidth)        
        t21 = c4 + Base.Vector(attachMargin,0,0)
        t22 = t21+ Base.Vector(self.attachWidth)        



        #block between legs
        b0  = util.mult((c3 - c2),0.5,c2)
        b11 = b0 + Base.Vector(0,-self.legSafeWidth)
        b21 = b0 + Base.Vector(0,self.legSafeWidth)        
        
        b12 = b11 + Base.Vector(self.legSafeHeight/2,self.legSafeCurve1)
        b22 = b21 + Base.Vector(self.legSafeHeight/2,-self.legSafeCurve1)        

        b13 = b11 + Base.Vector(self.legSafeHeight)
        b23 = b21 + Base.Vector(self.legSafeHeight)
        
        bt  = b0 + Base.Vector(self.legSafeCurve2 + self.legSafeHeight) 

        spPoints = [b11,b12,b13,bt,b23,b22,b21]


        points.append(b21)
        points.append(c3)
        points.append(c4)
        points.append(c1)
        points.append(c2)
        points.append(b11)

        p = util.partFromVectors(points,Base.Vector(0,0,self.thickness))
        lines = util.linesFromPoints(points)
        
        sp = Part.BSplineCurve()
        sp.interpolate(spPoints,False)
        
        lines.append(sp.toShape())
        w = Part.Wire(lines)
        f = Part.Face(w)
        p = f.extrude(Base.Vector(0,0,self.thickness))

        
        
        a1 = self.attachPart(t11,t12,Base.Vector(0,-1,0),toCut=toCut)
        a2 = self.attachPart(t21,t22,Base.Vector(0,1,0),toCut=toCut)
        part = p.fuse(a1).fuse(a2)
        part.translate(Base.Vector(0,self.sideThickness,0))
        return part
Example #2
0
 def makeBorder(self):
     l = 750
     h = 500
     p1 = Base.Vector(-10,0,-10)
     p2= p1 + Base.Vector(l,0,0)
     p3= p1 + Base.Vector(l,0,h)
     p4= p1 + Base.Vector(0,0,h)
     
     lines = util.linesFromPoints([p1,p2,p3,p4],True)
     Part.show(Part.Wire(lines))
Example #3
0
    def makeRef(self):
        part = Part.makeBox(100,100,100,Base.Vector(550,0,300))
        Part.show(part)

        
        points = [] 
        c1  = Base.Vector(0,0,0)
        c2  = c1 + Base.Vector(750,0,0)
        c3  = c2 + Base.Vector(0,0, 500)
        c4  = c1 + Base.Vector(0,0, 500)
        lines = util.linesFromPoints([c1,c2,c3,c4],True)
        w = Part.Wire(lines)
        #f = Part.Face(w)
        p = w.extrude(Base.Vector(0,self.thickness))
        p.translate(Base.Vector(-10,0,-10))
        Part.show(p)
Example #4
0
    def back(self,toCut=False):
        points = [] 
        c1  = Base.Vector(0,0,0)
        c2  = c1 + Base.Vector(self.backLength,0,0)
        c3  = c2 + Base.Vector(0,self.horseWidth,0)
        c4  = c1 + Base.Vector(0,self.horseWidth,0)

        #arc in the top
        av1 = util.mult((c3 - c2),0.5,c2) + Base.Vector(self.backCurveDepth) 
        
        c3c = c3 + Base.Vector(0,self.sideThickness,0)
        c2c = c2 + Base.Vector(0,-self.sideThickness,0)

        
        points.append(c3c)
        points.append(c3 + Base.Vector(-self.tenonLength,self.sideThickness,0))
        points.append(c3 + Base.Vector(-self.tenonLength,0,0))
        points.append(c4)
        
        points.append(c1)
        points.append(c2 + Base.Vector(-self.tenonLength,0,0))
        points.append(c2 + Base.Vector(-self.tenonLength,-self.sideThickness,0))
        points.append(c2c)

        
        lines = util.linesFromPoints(points)
        lines.append(Part.Arc(c2c,av1,c3c).toShape())
        w = Part.Wire(lines)
        f = Part.Face(w)
        p = f.extrude(Base.Vector(0,0,self.thickness))
        
        offset = Base.Vector((self.backLength - self.tenonLength - self.attachWidth)/2)
        att1v1 = offset + c1
        att1v2 = offset + c1+Base.Vector(self.attachWidth)
        att2v1 = offset + c4
        att2v2 = offset + c4+Base.Vector(self.attachWidth)
        a1 = self.attachPart(att1v1,att1v2,Base.Vector(0,-1,0),toCut=toCut)
        a2 = self.attachPart(att2v1,att2v2,Base.Vector(0,1,0),toCut=toCut)
        part = p.fuse(a1)
        part = part.fuse(a2)
        part.translate(Base.Vector(0,self.sideThickness,0))
        return part 
Example #5
0
    def attachPart(self,p1,p2,direction,size=attachSize,holeWidth=thickness, toCut=False):
        p12 = util.mult(direction,size-self.attachCurveDepth,p1)
        p22 = util.mult(direction,size-self.attachCurveDepth,p2)
        c   = util.mult((p2 - p1),0.5,p1) + util.mult(direction,size)
        a   = Part.Arc(p12,c,p22)
        lines = util.linesFromPoints([p22,p2, p1,p12])
        lines += [a.toShape()]
        w = Part.Wire(lines)
        p = Part.Face(w).extrude(Base.Vector(0,0,self.thickness))

        distHoleStart   = util.mult(direction,self.attachHoleMarginStart)
        distHoleEnd     = util.mult(direction,size-self.attachHoleMarginEnd)
        pi1 = util.mult((p2 - p1),1.0/3,p1) + distHoleStart
        pi2 = util.mult((p2 - p1),2.0/3,p1) + distHoleStart
        pi3 = util.mult((p2 - p1),1.0/3,p1) + distHoleEnd
        pi4 = util.mult((p2 - p1),2.0/3,p1) + distHoleEnd
        hole = util.partFromVectors([pi1,pi3,pi4,pi2], Base.Vector(0,0,self.thickness))
        if not toCut:
            attach = p.cut(hole)
        else:
            attach = p
        return  attach