Notifications
Clear all

[Closed] Answering Max dialog that pops up

Hi I’m trying to create my first maxscript.

This script should automate the process of detaching multiple spline SO of a splineShape at once into multiple independant splineShape. So I use the detach spline command (splineOps.detach) in a loop but i need that my script answer OK after giving a name to my newly created splineShape before it proceed to the next spline etc…
Can’t find the way to do that in the Maxscript reference
By the way I’d like to have an automated naming process at the same time (having: Shape01, Shape02, Shape03 and so on…)

Is my request clear enough?

Thanks for any help

2 Replies

you can’t have max press that button for you, there are programs that can do that and can be run from within max, but it’s usually better to try and solve it without the use of external programs.
here’s a function that does spline detachemnt. note there are no error checking, so either add some error handling or make sure you only pass correct values.


 fn splineDetach splineObj splineNum newName: =
 (
 	if newName == unsupplied then
 		newName = uniqueName splineObj.name
 	local newObj = copy splineObj name:newName
 	for i = (numSplines newObj) to 1 by -1 where i != splineNum do
 		deleteSpline newObj i
 	deleteSpline splineObj splineNum
 	updateShape newObj
 	updateShape splineObj
 	
 	newObj
 )
 
 -- sample use:
 splineDetach $ 2 newName:"test"
 

hOpe this helps,
o

Thanks a lot Ofer! your script really helped, you actually made the job for me
As a newbie in maxscripting (and moreover in programming) it took me a while to understand your function, but I finnally did it.
But something was missing, so I included this in a loop and it was done.

Thanks again !