Skip to content

Commit

Permalink
Draft: Array objects now have an IntervalAxis property to build helic…
Browse files Browse the repository at this point in the history
…oidal compounds
  • Loading branch information
yorikvanhavre committed Aug 1, 2014
1 parent fec636b commit bf101bb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Mod/Draft/Draft.py
Expand Up @@ -4408,6 +4408,7 @@ def __init__(self,obj):
obj.addProperty("App::PropertyVector","IntervalX","Draft","Distance and orientation of intervals in X direction")
obj.addProperty("App::PropertyVector","IntervalY","Draft","Distance and orientation of intervals in Y direction")
obj.addProperty("App::PropertyVector","IntervalZ","Draft","Distance and orientation of intervals in Z direction")
obj.addProperty("App::PropertyVector","IntervalAxis","Draft","Distance and orientation of intervals in Axis direction")
obj.addProperty("App::PropertyVector","Center","Draft","Center point")
obj.addProperty("App::PropertyAngle","Angle","Draft","Angle to cover with copies")
obj.ArrayType = ['ortho','polar']
Expand All @@ -4418,6 +4419,7 @@ def __init__(self,obj):
obj.IntervalX = Vector(1,0,0)
obj.IntervalY = Vector(0,1,0)
obj.IntervalZ = Vector(0,0,1)
obj.IntervalZ = Vector(0,0,0)
obj.Angle = 360
obj.Axis = Vector(0,0,1)

Expand Down Expand Up @@ -4455,7 +4457,8 @@ def execute(self,obj):
sh = self.rectArray(obj.Base.Shape,obj.IntervalX,obj.IntervalY,
obj.IntervalZ,obj.NumberX,obj.NumberY,obj.NumberZ)
else:
sh = self.polarArray(obj.Base.Shape,obj.Center,obj.Angle.Value,obj.NumberPolar,obj.Axis)
av = obj.IntervalAxis if hasattr(obj,"IntervalAxis") else None
sh = self.polarArray(obj.Base.Shape,obj.Center,obj.Angle.Value,obj.NumberPolar,obj.Axis,av)
obj.Shape = sh
if not DraftGeomUtils.isNull(pl):
obj.Placement = pl
Expand Down Expand Up @@ -4485,7 +4488,7 @@ def rectArray(self,shape,xvector,yvector,zvector,xnum,ynum,znum):
base.append(nshape)
return Part.makeCompound(base)

def polarArray(self,shape,center,angle,num,axis):
def polarArray(self,shape,center,angle,num,axis,axisvector):
#print "angle ",angle," num ",num
import Part
if angle == 360:
Expand All @@ -4499,6 +4502,10 @@ def polarArray(self,shape,center,angle,num,axis):
currangle = fraction + (i*fraction)
nshape = shape.copy()
nshape.rotate(DraftVecUtils.tup(center), DraftVecUtils.tup(axis), currangle)
if axisvector:
if not DraftVecUtils.isNull(axisvector):
if i > 0:
nshape.translate(FreeCAD.Vector(axisvector).multiply(i))
base.append(nshape)
return Part.makeCompound(base)

Expand Down

0 comments on commit bf101bb

Please sign in to comment.