Skip to content

Commit fec2a27

Browse files
committed
added new properties and default values for max loft size
1 parent 0bf0659 commit fec2a27

5 files changed

+37
-17
lines changed

CurvedArray.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def __init__(self,
3232
DistributionReverse = False,
3333
extract=False,
3434
Twists = [],
35-
LoftMaxDegree=5):
35+
LoftMaxDegree=5,
36+
MaxLoftSize=16):
3637
CurvedShapes.addObjectProperty(obj, "App::PropertyLink", "Base", "CurvedArray", "The object to make an array from").Base = base
3738
CurvedShapes.addObjectProperty(obj, "App::PropertyLinkList", "Hullcurves", "CurvedArray", "Bounding curves").Hullcurves = hullcurves
3839
CurvedShapes.addObjectProperty(obj, "App::PropertyVector", "Axis", "CurvedArray", "Direction axis").Axis = axis
@@ -47,6 +48,7 @@ def __init__(self,
4748
CurvedShapes.addObjectProperty(obj, "App::PropertyEnumeration", "Distribution", "CurvedArray", "Algorithm for distance between elements")
4849
CurvedShapes.addObjectProperty(obj, "App::PropertyBool", "DistributionReverse", "CurvedArray", "Reverses direction of Distribution algorithm").DistributionReverse = DistributionReverse
4950
CurvedShapes.addObjectProperty(obj, "App::PropertyInteger", "LoftMaxDegree", "CurvedArray", "Max Degree for Surface or Solid").LoftMaxDegree = LoftMaxDegree
51+
CurvedShapes.addObjectProperty(obj,"App::PropertyInteger", "MaxLoftSize", "CurvedArray", "Max Size of a Loft in Segments.").MaxLoftSize = MaxLoftSize
5052
obj.Distribution = ['linear', 'parabolic', 'x³', 'sinusoidal', 'asinusoidal', 'elliptic']
5153
obj.Distribution = Distribution
5254
self.extract = extract
@@ -113,7 +115,7 @@ def makeRibs(self, obj):
113115

114116

115117
if (obj.Surface or obj.Solid) and obj.Items > 1:
116-
obj.Shape = CurvedShapes.makeSurfaceSolid(ribs, obj.Solid, maxDegree=obj.LoftMaxDegree)
118+
obj.Shape = CurvedShapes.makeSurfaceSolid(ribs, obj.Solid, maxDegree=obj.LoftMaxDegree, maxLoftSize=obj.MaxLoftSize)
117119
else:
118120
obj.Shape = Part.makeCompound(ribs)
119121

@@ -193,6 +195,8 @@ def execute(self, prop):
193195
def onChanged(self, fp, prop):
194196
if not hasattr(fp, 'LoftMaxDegree'):
195197
CurvedShapes.addObjectProperty(fp, "App::PropertyInteger", "LoftMaxDegree", "CurvedArray", "Max Degree for Surface or Solid", init_val=5) # backwards compatibility - this upgrades older documents
198+
if not hasattr(fp, 'MaxLoftSize'):
199+
CurvedShapes.addObjectProperty(fp,"App::PropertyInteger", "MaxLoftSize", "CurvedArray", "Max Size of a Loft in Segments.", init_val=-1) # backwards compatibility - this upgrades older documents
196200

197201
if "Positions" in prop and len(fp.Positions) != 0:
198202
setattr(fp,"Items",str(len(fp.Positions)))

CurvedPathArray.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def __init__(self,
3030
Solid = False,
3131
doScale = [],
3232
extract=False,
33-
LoftMaxDegree=5):
33+
LoftMaxDegree=5,
34+
MaxLoftSize=16):
3435
CurvedShapes.addObjectProperty(obj,"App::PropertyLink", "Base", "CurvedPathArray", "The object to make an array from").Base = base
3536
CurvedShapes.addObjectProperty(obj,"App::PropertyLink", "Path", "CurvedPathArray", "Sweep path").Path = path
3637
CurvedShapes.addObjectProperty(obj,"App::PropertyLinkList", "Hullcurves", "CurvedPathArray", "Bounding curves").Hullcurves = hullcurves
@@ -44,6 +45,7 @@ def __init__(self,
4445
CurvedShapes.addObjectProperty(obj,"App::PropertyBool", "ScaleY","CurvedPathArray", "Scale by hullcurves in Y direction").ScaleY = True
4546
CurvedShapes.addObjectProperty(obj,"App::PropertyBool", "ScaleZ","CurvedPathArray", "Scale by hullcurves in Z direction").ScaleZ = True
4647
CurvedShapes.addObjectProperty(obj,"App::PropertyInteger", "LoftMaxDegree", "CurvedPathArray", "Max Degree for Surface or Solid").LoftMaxDegree = LoftMaxDegree
48+
CurvedShapes.addObjectProperty(obj,"App::PropertyInteger", "MaxLoftSize", "CurvedPathArray", "Max Size of a Loft in Segments.").MaxLoftSize = MaxLoftSize
4749
self.doScaleXYZsum = [False, False, False]
4850
if len(doScale) == 3:
4951
obj.ScaleX = doScale[0]
@@ -134,7 +136,7 @@ def makeRibs(self, obj):
134136

135137

136138
if (obj.Surface or obj.Solid) and obj.Items > 1:
137-
obj.Shape = CurvedShapes.makeSurfaceSolid(ribs, obj.Solid, maxDegree=obj.LoftMaxDegree)
139+
obj.Shape = CurvedShapes.makeSurfaceSolid(ribs, obj.Solid, maxDegree=obj.LoftMaxDegree, maxLoftSize=obj.MaxLoftSize)
138140
else:
139141
obj.Shape = Part.makeCompound(ribs)
140142

@@ -184,6 +186,8 @@ def execute(self, prop):
184186
def onChanged(self, fp, prop):
185187
if not hasattr(fp, 'LoftMaxDegree'):
186188
CurvedShapes.addObjectProperty(fp, "App::PropertyInteger", "LoftMaxDegree", "CurvedPathArray", "Max Degree for Surface or Solid", init_val=5) # backwards compatibility - this upgrades older documents
189+
if not hasattr(fp, 'MaxLoftSize'):
190+
CurvedShapes.addObjectProperty(fp,"App::PropertyInteger", "MaxLoftSize", "CurvedPathArray", "Max Size of a Loft in Segments.", init_val=-1) # backwards compatibility - this upgrades older documents
187191

188192
#background compatibility
189193
CurvedPathArrayWorker = CurvedPathArray

CurvedSegment.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def __init__(self,
3232
TwistReverse = False,
3333
Distribution = 'linear',
3434
DistributionReverse = False,
35-
LoftMaxDegree=5):
35+
LoftMaxDegree=5,
36+
MaxLoftSize=16):
3637
CurvedShapes.addObjectProperty(fp,"App::PropertyLink", "Shape1", "CurvedSegment", "The first object of the segment").Shape1 = shape1
3738
CurvedShapes.addObjectProperty(fp,"App::PropertyLink", "Shape2", "CurvedSegment", "The last object of the segment").Shape2 = shape2
3839
CurvedShapes.addObjectProperty(fp,"App::PropertyLinkList", "Hullcurves", "CurvedSegment", "Bounding curves").Hullcurves = hullcurves
@@ -47,6 +48,7 @@ def __init__(self,
4748
CurvedShapes.addObjectProperty(fp,"App::PropertyEnumeration", "Distribution", "CurvedSegment", "Algorithm for distance between elements")
4849
CurvedShapes.addObjectProperty(fp,"App::PropertyBool", "DistributionReverse", "CurvedSegment", "Reverses direction of Distribution algorithm").DistributionReverse = DistributionReverse
4950
CurvedShapes.addObjectProperty(fp,"App::PropertyInteger", "LoftMaxDegree", "CurvedSegment", "Max Degree for Surface or Solid").LoftMaxDegree = LoftMaxDegree
51+
CurvedShapes.addObjectProperty(fp,"App::PropertyInteger", "MaxLoftSize", "CurvedSegment", "Max Size of a Loft in Segments.").MaxLoftSize = MaxLoftSize
5052
fp.Distribution = ['linear', 'parabolic', 'x³', 'sinusoidal', 'asinusoidal', 'elliptic']
5153
fp.Distribution = Distribution
5254
self.doScaleXYZ = []
@@ -104,6 +106,8 @@ def execute(self, fp):
104106
def onChanged(self, fp, prop):
105107
if not hasattr(fp, 'LoftMaxDegree'):
106108
CurvedShapes.addObjectProperty(fp, "App::PropertyInteger", "LoftMaxDegree", "CurvedSegment", "Max Degree for Surface or Solid", init_val=5) # backwards compatibility - this upgrades older documents
109+
if not hasattr(fp, 'MaxLoftSize'):
110+
CurvedShapes.addObjectProperty(fp,"App::PropertyInteger", "MaxLoftSize", "CurvedSegment", "Max Size of a Loft in Segments.", init_val=-1) # backwards compatibility - this upgrades older documents
107111

108112

109113
def makeRibs(self, fp):
@@ -132,7 +136,7 @@ def makeRibs(self, fp):
132136
self.rescaleRibs(fp, ribs)
133137

134138
if fp.makeSurface or fp.makeSolid:
135-
fp.Shape = CurvedShapes.makeSurfaceSolid(ribs, fp.makeSolid, maxDegree=fp.LoftMaxDegree)
139+
fp.Shape = CurvedShapes.makeSurfaceSolid(ribs, fp.makeSolid, maxDegree=fp.LoftMaxDegree, maxLoftSize=fp.MaxLoftSize)
136140
else:
137141
fp.Shape = Part.makeCompound(ribs)
138142

CurvedShapes.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,11 @@ def makeCurvedArray(Base = None,
337337
DistributionReverse = False,
338338
extract=False,
339339
Twists = [],
340-
LoftMaxDegree=5):
340+
LoftMaxDegree=5,
341+
MaxLoftSize=16):
341342
import CurvedArray
342343
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","CurvedArray")
343-
CurvedArray.CurvedArray(obj, Base, Hullcurves, Axis, Items, Position, OffsetStart, OffsetEnd, Twist, Surface, Solid, Distribution, DistributionReverse, False, Twists, LoftMaxDegree)
344+
CurvedArray.CurvedArray(obj, Base, Hullcurves, Axis, Items, Position, OffsetStart, OffsetEnd, Twist, Surface, Solid, Distribution, DistributionReverse, False, Twists, LoftMaxDegree, MaxLoftSize)
344345
if FreeCAD.GuiUp:
345346
CurvedArray.CurvedArrayViewProvider(obj.ViewObject)
346347
FreeCAD.ActiveDocument.recompute()
@@ -363,10 +364,11 @@ def makeCurvedPathArray(Base = None,
363364
Solid=False,
364365
doScale = [True, True, True],
365366
extract=False,
366-
LoftMaxDegree=5):
367+
LoftMaxDegree=5,
368+
MaxLoftSize=16):
367369
import CurvedPathArray
368370
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","CurvedPathArray")
369-
CurvedPathArray.CurvedPathArray(obj, Base, Path, Hullcurves, Items, OffsetStart, OffsetEnd, Twist, Surface, Solid, doScale, extract, LoftMaxDegree)
371+
CurvedPathArray.CurvedPathArray(obj, Base, Path, Hullcurves, Items, OffsetStart, OffsetEnd, Twist, Surface, Solid, doScale, extract, LoftMaxDegree, MaxLoftSize)
370372
if FreeCAD.GuiUp:
371373
CurvedPathArray.CurvedPathArrayViewProvider(obj.ViewObject)
372374
FreeCAD.ActiveDocument.recompute()
@@ -386,10 +388,11 @@ def makeCurvedSegment(Shape1 = None,
386388
TwistReverse = False,
387389
Distribution = 'linear',
388390
DistributionReverse = False,
389-
LoftMaxDegree=5):
391+
LoftMaxDegree=5,
392+
MaxLoftSize=16):
390393
import CurvedSegment
391394
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","CurvedSegment")
392-
CurvedSegment.CurvedSegment(obj, Shape1, Shape2, Hullcurves, NormalShape1, NormalShape2, Items, Surface, Solid, InterpolationPoints, Twist, TwistReverse, Distribution, DistributionReverse, LoftMaxDegree)
395+
CurvedSegment.CurvedSegment(obj, Shape1, Shape2, Hullcurves, NormalShape1, NormalShape2, Items, Surface, Solid, InterpolationPoints, Twist, TwistReverse, Distribution, DistributionReverse, LoftMaxDegree, MaxLoftSize)
393396
if FreeCAD.GuiUp:
394397
CurvedSegment.CurvedSegmentViewProvider(obj.ViewObject)
395398
FreeCAD.ActiveDocument.recompute()
@@ -405,10 +408,11 @@ def makeInterpolatedMiddle(Shape1 = None,
405408
InterpolationPoints=16,
406409
Twist = 0.0,
407410
TwistReverse = False,
408-
LoftMaxDegree=5):
411+
LoftMaxDegree=5,
412+
MaxLoftSize=16):
409413
import InterpolatedMiddle
410414
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","InterpolatedMiddle")
411-
InterpolatedMiddle.InterpolatedMiddle(obj, Shape1, Shape2, NormalShape1, NormalShape2, Surface, Solid, InterpolationPoints, Twist, TwistReverse, LoftMaxDegree)
415+
InterpolatedMiddle.InterpolatedMiddle(obj, Shape1, Shape2, NormalShape1, NormalShape2, Surface, Solid, InterpolationPoints, Twist, TwistReverse, LoftMaxDegree, MaxLoftSize)
412416
if FreeCAD.GuiUp:
413417
InterpolatedMiddle.InterpolatedMiddleViewProvider(obj.ViewObject)
414418
FreeCAD.ActiveDocument.recompute()

InterpolatedMiddle.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def __init__(self,
2828
InterpolationPoints=16,
2929
Twist = 0.0,
3030
TwistReverse = False,
31-
LoftMaxDegree=5):
31+
LoftMaxDegree=5,
32+
MaxLoftSize=16):
3233
CurvedShapes.addObjectProperty(fp,"App::PropertyLink", "Shape1", "InterpolatedMiddle", "The first object of the segment").Shape1 = shape1
3334
CurvedShapes.addObjectProperty(fp,"App::PropertyLink", "Shape2", "InterpolatedMiddle", "The last object of the segment").Shape2 = shape2
3435
CurvedShapes.addObjectProperty(fp,"App::PropertyVector", "NormalShape1", "InterpolatedMiddle", "Direction axis of Shape1").NormalShape1 = normalShape1
@@ -39,6 +40,7 @@ def __init__(self,
3940
CurvedShapes.addObjectProperty(fp,"App::PropertyFloat", "Twist","InterpolatedMiddle", "Compensates a rotation between Shape1 and Shape2").Twist = Twist
4041
CurvedShapes.addObjectProperty(fp,"App::PropertyBool", "TwistReverse","InterpolatedMiddle", "Reverses the rotation of one Shape").TwistReverse = TwistReverse
4142
CurvedShapes.addObjectProperty(fp,"App::PropertyInteger", "LoftMaxDegree", "InterpolatedMiddle", "Max Degree for Surface or Solid").LoftMaxDegree = LoftMaxDegree
43+
CurvedShapes.addObjectProperty(fp,"App::PropertyInteger", "MaxLoftSize", "InterpolatedMiddle", "Max Size of a Loft in Segments.").MaxLoftSize = MaxLoftSize
4244
self.update = True
4345
fp.Proxy = self
4446

@@ -71,6 +73,8 @@ def execute(self, fp):
7173
def onChanged(self, fp, prop):
7274
if not hasattr(fp, 'LoftMaxDegree'):
7375
CurvedShapes.addObjectProperty(fp, "App::PropertyInteger", "LoftMaxDegree", "InterpolatedMiddle", "Max Degree for Surface or Solid", init_val=5) # backwards compatibility - this upgrades older documents
76+
if not hasattr(fp, 'MaxLoftSize'):
77+
CurvedShapes.addObjectProperty(fp,"App::PropertyInteger", "MaxLoftSize", "InterpolatedMiddle", "Max Size of a Loft in Segments.", init_val=-1) # backwards compatibility - this upgrades older documents
7478

7579

7680
def makeRibs(self, fp):
@@ -96,9 +100,9 @@ def makeRibs(self, fp):
96100

97101
if (fp.makeSurface or fp.makeSolid) and len(ribs) == 1:
98102
rib1 = [fp.Shape1.Shape, ribs[0]]
99-
shape1 = CurvedShapes.makeSurfaceSolid(rib1, False, maxDegree=fp.LoftMaxDegree)
103+
shape1 = CurvedShapes.makeSurfaceSolid(rib1, False, maxDegree=fp.LoftMaxDegree, maxLoftSize=fp.MaxLoftSize)
100104
rib2 = [ribs[0], fp.Shape2.Shape]
101-
shape2 = CurvedShapes.makeSurfaceSolid(rib2, False, maxDegree=fp.LoftMaxDegree)
105+
shape2 = CurvedShapes.makeSurfaceSolid(rib2, False, maxDegree=fp.LoftMaxDegree, maxLoftSize=fp.MaxLoftSize)
102106

103107
shape = Part.makeCompound([shape1, shape2])
104108

0 commit comments

Comments
 (0)