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
def seat(self,toCut=False): points = [] c1 = Base.Vector(0,0,0) c2 = c1 + Base.Vector(self.seatLength,0,0) c3 = c2 + Base.Vector(0,self.horseWidth,0) c4 = c1 + Base.Vector(0,self.horseWidth,0) t12 = c1+ Base.Vector(self.tenonLength) t42 = c4+ Base.Vector(self.tenonLength) t22 = c2- Base.Vector(self.tenonLength) t32 = c3- Base.Vector(self.tenonLength) points += self.tenonPoints(c1,t12,Base.Vector(0,-1,0)) points += self.tenonPoints(t22,c2,Base.Vector(0,-1,0)) points += self.tenonPoints(c3,t32,Base.Vector(0,1,0)) points += self.tenonPoints(t42,c4,Base.Vector(0,1,0)) part = util.partFromVectors(points, Base.Vector(0,0,self.thickness)) part.translate(Base.Vector(0,self.sideThickness,0)) return part
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
def feetHolder(self): points = [] c1 = Base.Vector(0,0,0) c2 = c1 + Base.Vector(self.feetHolderLength,0,0) c3 = c2 + Base.Vector(0,self.horseWidth,0) c4 = c1 + Base.Vector(0,self.horseWidth,0) tenonMargin = (self.feetHolderLength - self.tenonLength)/2 t11 = c1 + Base.Vector(tenonMargin,0,0) t12 = t11+ Base.Vector(self.tenonLength) t21 = c4 + Base.Vector(tenonMargin,0,0) t22 = t21+ Base.Vector(self.tenonLength) points.append(c1) points += self.tenonPoints(t11,t12,Base.Vector(0,-1,0)) points.append(c2) points.append(c3) points += self.tenonPoints(t22,t21,Base.Vector(0,1,0)) points.append(c4) p = util.partFromVectors(points,Base.Vector(0,0,self.thickness)) p.translate(Base.Vector(0,self.sideThickness,0)) return p