Writing the Max plugin using MaxScript (i)

Source: Internet
Author: User

Visual MaxScript is a very simple UI plug-in editor that 3dmax provides, using which he can create event-based UI scripts, such as: commands that execute when the button is pressed, something like VB or MFC, and, of course, just the Max plugin.

First you need to open visual Maxscript, the last subkey of the Maxscript menu item in the 3dmax menus, to open it into the visual Maxscript Editor.

The introduction of the editor is not much to say, the document and many books are explained, and not the general programmer will not feel strange because the operation is very simple.

Here I'm going to implement a function, I'm going to create a window in Max with a script, and then there's a btn, and I'll click on this btn and I'll be creating a box in Max.

When you open visual MaxScript, you have a new project. You first need to change the properties of the window:

The mouse single-click Form, and then the right menu will show his specific properties, you can change to the desired properties. The following figure:

Then click the Button tool (in the control bar below), draw a button on it, then click on him, then you can set his properties on the right. The following figure:

Now that the UI is ready, you need to add an event, select the Event Handlers tab in the BTN selection, and then the following figure:

Click the pressed event and a script window will pop up, where you can write your own scripting program. The following figure:

We fill in the script command to create a box:

Box name: "Box1" position:[10,10,10] height:20

Here's an explanation of this statement script:

Box is a box.

"" In the back of name is the name of box.

Position:[] is the position of box XYZ

Height:20 was his high.

After completing the above operation, save the project, the project is named Firstms.vms.

Then save it as a script file, with the name firstms.ms.

Here's another question, where the build just generated the script and did not create the creation window, so when you run the script, because the window is not created, it will not be displayed, so you need to add a word.

After you open the MS file with Notepad, you need to add a word to the back:

Createdialog testrollout 300 600

Okay now run the script, the MaxScript item in the menu has a run script, click Select we will change the MS file, and then we'll see our final result.

Create a window with a button on the window and click on it to create a box in Max.

The first project is over.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.