View Full Version : Is it possibly to have a scrupt create a object by dragging in the viewport?

03 March 2012, 04:32 PM
I'm guessing the answer is "yes" but I need to work with some sort of mouse listener?

I'm learning maxscript at the moment and would like to allow the user to create an object like they do with normal max tools, using the viewpoint and dragging to select the width/length/height. (think how a normal box is made)

Any pointers or links? I tried googleing without too much luck - probably bad keyword choices.


03 March 2012, 05:33 PM
in max script it calls Scripted Plug-in (see mxs help Scripted Plug-in Clauses)
in most cases it's a scripted Simple Object (see Scripted SimpleObject Plug-ins)
also it might be an extension of some standard class (for example helper)... there is a sample how to extend Dummy with Scripted Helper:

03 March 2012, 06:11 PM
This is of course only necessary if you are actually looking to create your own type of object. for creating existing max objects, you can just use a tool clause in your script.

03 March 2012, 04:25 PM
The dummy example is especially helpful.

My random bookcase generator is almost done now :)


A little follow up question:

Is it possible to automatically switch to the modifier tab for the object after its created?
(for further editing/creation options)

In my case the user is creating a box that acts as the placeholder for the bookcase, my rollout has a "Fill" pushbutton that will fill it with books and make the final object (which takes a minute or so)
However, at the moment after the user clicks away after setting the height, the copy of my rollout in the create panel wont pick up the parameters correctly. I'm not sure why this is - maybe because it isnt fully created till the user clicks away?
It does work if the object as selected and the button is pressed from the modifier tab, however. So if I can simply automaticaly move them to that tab it would be helpfull.


03 March 2012, 02:42 PM
To change to the modify panel check out the help on Command Panels.

This should do what you need:
setCommandPanelTaskMode #modify

03 March 2012, 11:54 PM
Perfect! Thanks!

CGTalk Moderation
03 March 2012, 11:54 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.