Extrude by object height

Hi guys, how´s going?
i was thinking of a script that would apply an extrude modifier into a spline, using an object height as the amount. Example, select the spline, run the script, wich asks to pick the reference object, and then apply extrude modifier with the objetc height. Is it possible? too hard to code?
Thanks in advance,

Jsrocha

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jsrocha's picture

Wow, that's exactly what i

Wow, that's exactly what i need! Thanks a lot man!

Jsrocha

Visuali Studio's picture

Extrude Spline by Reference

If I understand correctly this code should work as you said.

You can download the attached script and run it from 3ds.
To use it select one or more splines, then go to "Scripting -> Run script" and select the script.
A window will open asking you to select the reference object and voilà.

try( destroyDialog :: pickRollout ) catch()
 
-- Collects the current selection into an array
SelSplines = selection as array
 
rollout pickRollout "Reference Height"
(
    pickbutton pickButton "Pick Reference Object"
 
    on pickButton picked pickObj do
    (
        pickButton.object = pickObj
 
        if pickObj != undefined do
        (
            RefHeight = pickObj.max.z - pickObj.min.z
        )
 
		-- Apply the "Extrude" modifier with the "amount" parameter = to RefHeight
		for obj in SelSplines do
		(
			extrudeMod = Extrude()
			addModifier obj extrudeMod
 
			extrudeMod.amount = RefHeight
		)
 
		try( destroyDialog :: pickRollout ) catch()
    )
)
 
createDialog pickRollout
AttachmentSize
extrude_spline_by_reference.ms 730 bytes

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.