A suite of methods provide the ability for a script to invoke Editable Mesh and Edit Mesh Modify panel modes and operations, corresponding to buttons available at various mesh sub-object levels. These methods reside in the meshOps global structure. These methods effectively "push the button" in the 3ds Max Modify panel. In order to use these methods, the node must be selected and the Modify panel open. In the description of these methods, the first argument <editable_mesh_node_or_modifier> should be interpreted as either an Editable Mesh node where the modifier stack level is at the base object, or an Edit Mesh modifier where the modifier stack level is at the Edit Mesh. In all cases, the following methods work at the current sub-object level, but only if that level is appropriate for the invoked operation.
PLEASE NOTE: |
---|
This page describes the meshOps structure related to controlling the Modify Panel command modes and operations. For methods directly manipulating vertex, edge and face data, please see the meshOp structure and the Editable_Mesh : GeometryClass and TriMesh : Value topic! |
If you have made scripted changes to the mesh you must call the update() method on the mesh before calling these methods. You do not need to call update() after just calling one of these methods, as 3ds Max will take care of updating the mesh.
The following methods invoke one of the 'user-interaction' button operations in the Editable Mesh Modify panel, acting on the currently selected sub-objects. These methods highlight the corresponding button in the Edit Geometry rollout and start the operation, at which point the user interactively completes the operation. These methods return after starting the operation, and before the user completes the operation, so care should be taken to ensure that your script does not interfere with the operation. Invoking any of these methods is the same as clicking on the associated button in the Modify panel. Calling a method when the operation is already in effect (either due to a user action or a MAXScript command) causes the operation to be terminated and the highlight is removed from the button.
Enters "Attach" command mode - valid in Vertex, Face, Polygon, and Element Sub-Object levels, and when not in Sub-Object mode.
Enters "Bevel" command mode - valid in Edge, Face, Polygon, and Element Sub-Object levels.
Enters "Chamfer" command mode - valid in Vertex and Edge Sub-Object levels.
Enters "Create" command mode, valid in Vertex, Face, Polygon, and Element Sub-Object levels.
Enters "Cut" command mode - valid in Edge, Face, Polygon, and Element Sub-Object levels.
Divides selected edges into 2 edges, for selected face into 3 faces - valid in Edge, Face, Polygon, and Element Sub-Object levels.
Enters "Extrude" command mode - valid in Face, Polygon, and Element Sub-Object levels.
Enters "Flip Normal" command mode - valid in Face, Polygon, and Element Sub-Object levels.
Enters "Slice Plane" command mode - valid in all Sub-Object levels, and when not in Sub-Object mode.
Enters "Turn" command mode - valid in Edge Sub-Object level.
Enters "Weld Target" command mode - valid in Vertex Sub-Object level.
The following methods invoke one of the 'instantaneous' button operations in the Editable Mesh Modify panel, acting on the currently selected sub-objects:
Automatically sets the edge visibility on the selected sub-objects - valid in Edge Sub-Object level.
Creates a new vertex for each face attached to the selected sub-objects - valid in Vertex Sub-Object level.
Collapses the selected sub-objects - valid in Vertex, Edge, Face, Polygon, and Element Sub-Object levels.
Displays Create Shape dialog allowing the user to specify an object name, shape type, and whether to ignore hidden edges. Valid in Edge Sub-Object level.
Deletes the selected sub-objects - valid in Vertex, Face, Polygon, and Element Sub-Object levels.
Displays Detach dialog allowing the user to specify an object name or to detach as element, and whether to clone the selected subobjects. Valid in Vertex, Face, Polygon, and Element Sub-Object levels.
Displays Explode to Objects dialog allowing the user to specify an object name.Explodes the selected faces into multiple elements or objects based on the angles of its edges. Valid in Vertex, Face, Polygon, and Element Sub-Object levels.
Flips the normal of the selected faces - valid in Face, Polygon, and Element Sub-Object levels.
Aligns the selected sub-objects to the construction plane - valid in Vertex, Edge, Face, Polygon, and Element Sub-Object levels.
Hides the selected sub-objects - valid in Vertex, Face, Polygon, and Element Sub-Object levels.
Sets selected edges invisible.Valid in Vertex Sub-Object level.
Forces all selected sub-objects to become coplanar - valid in Vertex, Edge, Face, Polygon, and Element Sub-Object levels.
Deletes all isolated vertices in the object regardless of the current selection.
Selects all edges with only one face. Valid in Edge Sub-Object level.
Subdivides edges and faces based on Slice Plane. meshOps.startSlicePlane() must be called to enter the "Slice Plane" command mode before slice is valid. Valid in all Sub-Object levels, and when not in Sub-Object mode.
Tessellates the selected sub-objects - valid in Face, Polygon, and Element Sub-Object levels.
Unhides the hidden sub-objects at the current Sub-Object level - valid in Vertex, Face, Polygon, and Element Sub-Object levels.
Unifies the normals of the selected faces - valid in Face, Polygon, and Element Sub-Object levels.
Aligns all selected sub-objects to the 0,0,0 plane of the active viewport - valid in Vertex, Edge, Face, Polygon, and Element Sub-Object levels.
Sets selected edges visible.Valid in Edge Sub-Object level.
Welds the selected vertices - valid in Vertex Sub-Object level.
The meshOps methods depend on the Modify panel being open and the desired object, either an Editable Mesh base object or Edit Mesh modifier, being currently open in the panel. The meshOps methodsdo not perform any operation if these conditions aren't met. You will need to use MAXScript functions like max modify mode or setCommandPanelTaskMode mode:#modify to open the Modify panel, select <obj> to select the object, subObjectLevel = <n> to set the Sub-Object level, and modPanel.setCurrentObject <obj_or_modifier> to establish the right context for the new functions to operate. For example: