Spline selection problem
Hi
My problem is when you press the button in my script and if a spline shape is selected i want it to go to subobjectLevel = 1
if its a polygon object or a mesh object or any other object other then a spline shape i want it to say messageBox "You must select a shape "
this is what i tried no luck
On ON3 pressed do
(
objs = getCurrentSelection();
(
if (classOf objs == SplineShape ) then
subobjectLevel = 1
else
messageBox "You must select a shape..."
)
)
Thanks in advance!!!!
Comments
Hi ! If you want to write
Hi !
If you want to write more than one instruction after a then, you need to add parentheses.
The script must be:
On ON1 pressed do
(
objs = getCurrentSelection();
if (objs.count > 0) then
(
(
if ((classOf objs[1] == SplineShape) or (classOf objs[1] == Line)) then
(
max modify mode --( This is my error )
subobjectLevel = 1
)
else
messageBox "You must select a shapegggggg..."
)
)
Regards.
Martin
Hi Martin, I receive a
Hi Martin, I receive a message from you and reply to it but your mail server return an error, so I'll reply here again. In the mail you send me different code. There was "then" context without brackets. Shortly, if "then" or any other context sensitive statement has more than 1 command, then it contain body *must* be inside closed (round) brackets, e.g.:
And in the current code that you post here, I see one open bracket that is not closed:
And one suggestion as well - when post a script code in the forum use [ CODE ] tags [ /CODE ] ;-)
my recent MAXScripts RSS (archive here)
Thanks allot!!!! i finally
Thanks allot!!!! i finally got this script working normally without any errors
Armen
You can use the isShapeObject
You can use the isShapeObject function as well (to simplify the code).
my recent MAXScripts RSS (archive here)
thanks for the help guys it
thanks for the help guys it worked but quick question for Anubis
I was trying to add 1 more line of script but it gives me an error how would i
add lets say 2 - 3 more lines of script without getting an error
On ON1 pressed do
if selection.count == 1 do
(
if isShapeObject $ then
max modify mode ( i added this and got am error )
subobjectLevel = 1
else
messageBox "You must select a shape..."
)
There are a few problems in
There are a few problems in your script.
This one runs:
(
objs = getCurrentSelection();
if (objs.count > 0) then
(
(
if ((classOf objs[1] == SplineShape) or (classOf objs[1] == Line)) then
subobjectLevel = 1
else
messageBox "You must select a shape..."
)
else
messageBox "You must select a shape..."
)
1-objs is an array, you want to know about the first element in such array ( objs[1] )
2-if you create a line the class if "line"
3-what happend if nothing is selected ( objs.count > 0 )
I hope this solve your problem !
Thanks for the help guys it
Thanks for the help guys it worked Great same question for your script how can i add another line of script without getting an error thanks
On ON1 pressed do
(
objs = getCurrentSelection();
if (objs.count > 0) then
(
(
if ((classOf objs[1] == SplineShape) or (classOf objs[1] == Line)) then
max modify mode ( This is my error )
subobjectLevel = 1
else
messageBox "You must select a shapegggggg..."
)
)