As part of the Tyre-Tire script I wanted to include an option which would scale the 'Sweep Modifier' custom shape in proportion to changing the radius of the created object.
Whilst a simple 'scale' on the whole object would have done the job perfectly well I was intrigued to see if I could replicate the really easy 'manual' method with some mxs code.
The end result was to add a Linked XForm modifier to the spline object and apply the scale to 'it'......thus scaling the spline sub-object and also updating the 'sweep' modifier.....in real-time.
I have since been reliably informed that this can also be achieved without using the Linked XForm modifier for a more elegant solution.....cue barigazy!
So although a solution is found I very much look forward to seeing the alternative.
Cheers.....(esp barigazy)
By
Comments (4)
Comment policy
Very nice.....
Sorry its been a while since you posted that code....had to do some 'real' work for a change.
Nice code there Barigazy, much cleaner than I had managed.
I'll implement it and tidy up my sloppy code with all haste......once I've had a coffee.
Thanks again.
Regards.
Yup. It's been a while :)
My pleasure
Cheers!
I already post the solution how to manually extract custom profile from sweep modifier but just in case...
fn extractSweepSection mody = if isKindOf mody sweep do
(
local customSection
if isValidNode (customSection = getNodeByName mody.CustomShapeName) then customSection else
(
customSection = if mody.shapes[1] != undefined do (splineshape baseobject:mody.shapes[1])
if customSection != undefined do mody.shapes[1] = customSection
) ; customSection
)
extractSweepSection $.sweep
,,,
This is the one of few solutions (maybe someone have better idea) that can solve your problem
Next example shows how to scale star shape 50% that is used as sweep profile
-- example helix spline with star profile
delete objects
guide = Helix radius1:50 radius2:50 height:200 turns:1.5 bias:.2 direction:0 pos:[0,0,0] isSelected:on
profile = convertToSplineShape (Star radius1:20 radius2:10 fillet1:3 fillet2:2 numPoints:5 distort:20 pos:[50,50,0] isSelected:on)
mody = sweep CustomShape:1 ; mody.Shapes[1] = profile
addModifier guide mody
-- scale star shape (profile) 50%
scaleSpline profile perc:50