ScriptSpot

Forum topic · Scripts Wanted

Extrude by object height

By jsrocha · 2023-03-22

Description

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 (2)

jsrocha · 2023-03-27

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

Jsrocha

Extrude Spline by Reference

Visuali Studio · 2023-03-27

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
Attachments