The following topic lists the polyOp methods which are applicable to objects collapsed to Editable_Poly base object.
Topic Navigation: |
|
---|---|
Get Face, Center, Normal and Area |
All polyOp methods take as an argument <poly>, the poly to operate on. This argument can be either a node value where the base object of the node is an Editable_Poly, or the Editable_Poly base object.
About polyOp Methods Sub-Object Arguments:
Many of the polyOp methods take as an argument <vertlist>, <facelist>, or <edgelist>.
These arguments specify the Sub-Object elements to operate on.
These arguments can be specified as:
#all - all Sub-Object elements of that type.
#selection - the current Sub-Object selection of that type.
#none - none of the Sub-Object elements of that type.
An array of integers, where each integer value specifies a Sub-Object element index.
A bitarray, where each bit specifies a Sub-Object element index.
A value convertible to an integer that specifies a Sub-Object element index.
A VertexSelection, EdgeSelection, or FaceSelection value. The value type must match the specified Sub-Object type.
Editable polys can have "dead" vertices, edges, and faces.
These are Sub-Object elements that are deleted from the poly, but are not removed from the corresponding lists of Sub-Object elements.
Sub-Object elements might be marked as dead in the process of performing certain operations on the poly, but the Sub-Object element lists are normally collapsed (all the dead Sub-Object elements removed) at the end of the operation or at file I/O operations. Thus, normally there must not be any dead Sub-Object elements present in the poly.
If you flag a Sub-Object element as dead using one of the polyOp methods, you must also call polyOp.collapseDeadStructs() to collapse the Sub-Object element lists.
Other than the methods that get/set Sub-Object element flags, the dead Sub-Object elements are normally ignored by the polyOp methods. If a method returns a value other than OK, takes a single Sub-Object element index, and that SO element is dead, a value of undefined is normally returned.
Returns the current vertex selection as a bitarray.
Sets the current vertex selection based on <vertlist>.
Returns the current edge selection as a bitarray.
Sets the current edge selection based on <vertlist>.
Each vertex in a poly contains a 32 bit flag variable.
This method returns a bitarray of the vertices that have specific bits in this flag variable set, where the bits being tested are based on a combination of <flag> and <maskflag>.
The default value for <maskflag> is 0.
Internally, if <maskflag> is 0 then <maskflag> is set to the <flag> value, otherwise <flag> is set to the bitwise-AND of <flag> and <maskflag>. Bit 2 of <maskflag> is then set, which prevents dead vertices from being included in the resulting bitarray unless this bit was set in <mask>. Each bit in the resulting bitarray is set if the bitwise-AND of the flag variable and <maskflag> is equal to the bitwise-AND of <flag> and <maskflag>.
bit 4 : indicates the vertex faces "backwards" in the current viewport
bit 25-32 : available for general use
Returns the flags bits for the vertex as an integer.
Sets the flag bits on the specified vertices to the bits in <flag>.
If the mask is specified, the bits set in the mask: value are cleared for all vertices in the poly prior to setting the flag bits on the specified vertices.
If undoable:true is specified, this operation is undoable. If bits 1 or 2 of <flag> are set (selected and dead flag bits), this operation is always undoable.
Each edge in a poly contains a 32 bit flag variable. This method returns a bitarray of the edges that have specific bits in this flag variable set, where the bits being tested are based on a combination of <flag> and <maskflag>.
The default value for <maskflag> is 0.
Internally, if <maskflag> is 0 then <maskflag> is set to the <flag> value, otherwise <flag> is set to the bitwise-AND of <flag> and <maskflag>. Bit 2 of <maskflag> is then set, which prevents dead edges from being included in the resulting bitarray unless this bit was set in <mask>. Each bit in the resulting bitarray is set if the bitwise-AND of the flag variable and <maskflag> is equal to the bitwise-AND of <flag> and <maskflag>.
bit 4: indicates that the vertex faces "backwards" in the current viewport
bit 25-32: available for general use
Returns the flag bits for the edge as an integer.
Sets the flag bits on the specified edges to the bits in <flag>. If mask is specified, the bits set in the mask: value are cleared for all edges in the poly prior to setting flag bits on the specified edges. If undoable:true is specified, this operation is undoable. If bits 1 or 2 of <flag> are set (selected and dead flag bits), this operation is always undoable.
Each face in a poly contains a 32 bit flag variable. This method returns a bitarray of the faces that have specific bits in this flag variable set, where the bits being tested are based on a combination of <flag> and <maskflag>.
The default value for <maskflag> is 0.
Internally, if <maskflag> is 0 then <maskflag> is set to the <flag> value, otherwise <flag> is set to the bitwise-AND of <flag> and <maskflag>. Bit 2 of <maskflag> is then set, which prevents dead faces from being included in the resulting bitarray unless this bit was set in <mask>. Each bit in the resulting bitarray is set if the bitwise-AND of the flag variable and <maskflag> is equal to the bitwise-AND of <flag> and <maskflag>.
bit 4 : indicates the vertex faces "backwards" in the current viewport
bit 25-32 : available for general use
Returns the flags bits for the face as an integer.
Sets the flag bits on the specified faces to the bits in <flag>.
If mask: is specified, the bits set in the mask: value are cleared for all faces in the poly prior to setting flag bits on the specified faces.
If undoable:true is specified, this operation is undoable.
If bits 1 or 2 of <flag> are set (selected and dead flag bits), this operation is always undoable.
Returns the number of vertices in the poly. Includes any dead vertices.
Returns the number of edges in the poly. Includes any dead edges.
Returns the number of faces in the poly. Includes any dead faces.
Bits in the result bitarray are set if the corresponding vertex is hidden.
Hides the corresponding vertices in the poly.
Bits in the result bitarray are set if the corresponding face is hidden.
Hides the corresponding faces in the poly
Bits in the result bitarray are set if the corresponding edge is open (used by only 1 ace).
Bits in the result bitarray are set for open edges in the poly that are connected using open edges to the specified edge.
All one-sided edges in polys can be grouped into chains, end to end, which represent boundaries of the poly. For instance, in a box with one side deleted, all the one-sided edges are part of the chain that goes around the hole. If the specified edge is not open, the resulting bitarray is empty.
Returns the face's vertices as an array. The order of the vertices in the array corresponds to the order of the vertices in the face.
<array_array> polyop.getFacesVerts <Poly poly> <facelist>
NEW in 3ds Max 2018.2: Returns the vertices of each of the specified faces as an array of arrays. The order of the vertices in the arrays corresponds to the order of the vertices in the face.
Returns the face's edges as an array. The order of the edges in the array corresponds to the order of the edges in the face.
<array_array> polyop.getFacesEdges <Poly poly> <facelist>
NEW in 3ds Max 2018.2: Returns the edges of each of the specified faces as an array of arrays. The order of the edges in the array corresponds to the order of the edges in the face.
Returns the edge's vertices as a two element array.
<array_array> polyop.getEdgesVerts <Poly poly> <edgelist>
NEW in 3ds Max 2018.2: Returns the vertices of the specified edges as an array of two element arrays.
Returns the faces using the specified edge. Normally a one element (open edge) or two element array.
<array_array>polyop.getEdgesFaces <Poly poly> <edgelist>
Returns the current dead vertices selection as a bitarray. Normally, this returns an empty bitarray.
Returns the current dead edges selection as a bitarray. Normally, this returns an empty bitarray.
Returns the current dead faces selection as a bitarray. Normally, this returns an empty bitarray.
Bit 1 in the return value is set if the poly has any dead vertices, bit 2 if any dead edges, and bit 3 if any dead faces.
Returns true if the specified face is dead.
Returns true if the specified edge is dead.
Returns the position of the specified vertex. If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, the position returned is in the current coordinate system context. If <poly> is an Editable Poly and <node> is not specified, the return value is in the poly's local coordinate system.
<point3_array> polyop.getVerts <Poly poly> <verlist> \ node:<node=unsupplied>
NEW in 3ds Max 2018.2: Returns the positions of the specified vertices as an array of point3. If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, the position returned is in the current coordinate system context. If <poly> is an Editable Poly and <node> is not specified, the return values are in the poly's local coordinate system.
Sets the position of the specified vertices.
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, the position is in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, the position is in the poly's local coordinate system.
In 3ds Max 2008 and higher, this method allows the position to be specified as array. In that case, the number of values in <pos_array> must match the number of vertices specified in <vertlist>. This feature was previously part of the Avguard Extensions.
polyop.moveVert <Poly poly> <vertlist> {<point3 offset>|<point3 offset_array>} \ node:<node> useSoftSel:<bool>
Moves the specified vertices by <offset>.
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, the offset is in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, the offset is in the poly's local coordinate system.
In 3ds Max 2008 and higher, this method allows the position to be specified as array. In that case, the number of values in <pos_array> must match the number of vertices specified in <vertlist>. This feature was previously part of the Avguard Extensions .
If useSoftSel: is true, and the mesh's soft selection data channel is present, the specified offsets are multiplied by the vertex's soft selection value.
Returns true if all topological links such as, the list of edges are complete for the poly.
Recomputes the internal MNEdges and MNFace::edg , MNVert::edg , and MNVert::fac lists based on the information in the MNFace::vtx lists .
Bits in the result bitarray are set if the corresponding edge uses one of the vertices in <vertlist> .
Bits in the result bitarray are set if the corresponding face uses one of the vertices in <vertlist> .
Bits in the result bitarray are set if the corresponding vertex uses one of the edges in <edgelist> .
Bits in the result bitarray are set if the corresponding face uses one of the edges in <edgelist> .
Bits in the result bitarray are set if the corresponding vertex uses one of the faces in <facelist> .
Bits in the result bitarray are set if the corresponding edge uses one of the faces in <facelist> .
Bits in the result bitarray are set for all faces in the same "element" or connected component with faces in <facelist>.
If <fence_facelist> is specified, those faces are considered as "walls" for this processing and are not evaluated. That is, if face i is specified in <facelist>, and a ring of faces around it is specified in <fence_facelist>, the algorithm stops at that ring.
Bits in the result bitarray are set if the corresponding vertex is only used by faces in <edgelist>.
Returns the center of the face by taking the average of all its vertices.
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, the position returned is in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, the return value is in the poly's local coordinate system.
Returns the "safe" center of the face, if possible.
For non-convex faces, the average point found using getFaceCenter is unsuitable for some applications because it can lie outside the face completely, or in a region where it cannot see all the face's vertices (line segments from the center to the corner pass outside of the face).
If a safe center cannot be found, a value of undefined is returned.
This routine provides a better solution in some cases by finding the center of the convex hull of the face. The convex hull is defined as the region in a face with a clear line-of-sight to all the corners. Some faces such as, the top face in an extruded letter M have an empty convex hull, in which case this routine fails and merely provides the regular center given by ComputeCenter .
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, the position returned is in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, the return value is in the poly's local coordinate system.
Returns the face normal of the face.
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, the direction vector returned is in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, the return value is in the poly's local coordinate system.
Attaches <source>, converted to a polymesh if necessary, to <poly>.
If <source> or <poly> is not a node value, the corresponding targetNode: or sourceNode: must be specified.
Deletes the specified vertices.
If <delIsoVerts> is true , any vertices that are no longer used by faces are also deleted.
If <delIsoVerts> is true , any vertices that are no longer used by edges are also deleted.
The behavior of the methods PolyOp.deleteEdges() , PolyOp.deleteVerts() , and PolyOp.deleteFaces() changed in 3ds Max 5. When using these methods, all sub-object elements that use the deleted elements are also deleted. What used to be the (internal) Delete method is now the (internal) Remove method. This new method is not exposed through the polyOp structure, so you need to work through the EditablePoly interface, Remove method.
An example replacement function which works in both version 4 and higher is:
Welds the specified vertices that are within the threshold distance.
The threshold distance is a property (weldThreshold) of the editable poly.
Only vertices on a border can be welded.
Welds the two specified vertices with the resulting vertex positioned at the specified location.
Only vertices on a border can be welded.
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, the location is in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, the location is in the poly's local coordinate system.
Welds the vertices associated with the specified edges that are within the threshold distance.
The threshold distance is a property ( weldThreshold ) of the editable poly.
Only vertices on a border can be welded.
Creates a vertex as the specified position.
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, the position is in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, the position is in the poly's local coordinate system.
Returns the index of the created vertex or undefined if no vertex was created.
Creates an edge using the two specified vertices.
The vertices must be used by a common face.
Returns the index of the created edge or undefined if no edge was created.
Creates a face using the specified vertices.
The order of the vertices in the face is the order in the vertex array. For each successive vertex pair, at most one edge might exist between the vertices and that edge must not go from the first to second vertex.
The default triangulation for a face with the specified number of vertices is used if the face is not convex. This triangulation might be inappropriate.
If this is the case, call retriangulate() on this face after it is created.
Returns the index of the created face or undefined if no face was created.
Performs an auto smooth of the poly.
The face smoothing threshold angle is a property ( autoSmoothThreshold ) of the editable poly.
Flips the normal of the specified faces.
Retriangulates the specified faces.
Sets a diagonal of the face between the two vertices.
The face must have a degree greater than three and the two vertices must not be connected by an edge.
Forces an update of the surface subdivision at the next viewport redraw.
Use when NURMS Subdivision is on and Update Options is Manually.
Smooths the faces associated with the specified vertices.
Uses the .smoothness , .separateBySmoothing , and .separateByMaterial properties of the editable poly.
Uses the .smoothness , .separateBySmoothing , and .separateByMaterial properties of the editable poly.
Smooths the faces associated with the specified edges.
Uses the .smoothness , .separateBySmoothing , and .separateByMaterial properties of the editable poly.
Sets the smoothing groups for the specified faces.
The state of each bit in <smoothing_group> specifies whether the face belongs to the corresponding smoothing group.
If <add> is true , <smoothing_group> is added to the existing smoothing group data specified for each face.
If <add> is false , the existing smoothing group data is overwritten.
Returns the smoothing group data for the specified face as an integer.
The state of each bit in the result specifies whether the face belongs to the corresponding smoothing group.
For each vertex in <vertlist>, N-1 new vertices are created at the same location, where N is the number of faces using that vertex.
Each of these faces will use one of these vertices.
Divides the specified edge at the specified fractional distance along the edge.
The return value is the index of the new vertex or undefined if no vertex was created.
Divides the specified face with the new vertex being created at the closest point on the face to the specified position.
If the specified position is outside the face, the vertex is created at the center of the face.
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, the position is in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, the position is in the poly's local coordinate system.
Collapses each cluster of vertices in the specified vertices to a single vertex.
A vertex cluster is a set of vertices that are directly connected to one another.
Collapses the vertices associated with each cluster of faces in the specified faces to a single vertex.
A face cluster is a set of faces that are directly connected to one another.
Collapses the vertices associated with each cluster of edges in the specified edges to a single vertex.
An edge cluster is a set of edges that are directly connected to one another.
polyop.propagateFlags <Polypoly> <toSOLevel> <toFlag_int><fromSOLevel> <fromFlag_int> \ ampersand:<boolean=false> set:<boolean=true> undoable:<boolean=true>
where toSOLevel/fromSOLevel = {#object | #vertex | #edge | #face}
For each <fromSOLevel> element that has flag <fromFlag_int> set, the <toSOLevel> elements that use or are used by the element have their internal flag variable bits set based on <toFlag_int>.
Only the bits corresponding to the bits that are set in <toFlag_int> are affected.
If <ampersand> is false , and <fromFlag_int> has more than one bit set, the <fromSOLevel> elements are tested to see whether they have any of the corresponding bits set. If true , the <fromSOLevel> component elements are tested to see whether they have all the corresponding bits set.
If <set> is true , the <toSOLevel> elements have flags <toFlag_int> set. If false , these flags are cleared.
If <undoable> is true , the operation in undoable, otherwise it is not.
If bits 1 or 2 of <toFlag_int> are set (selected and dead flag bits), this operation is always undoable.
Returns the number of <fromSOLevel> elements that tested positive for the <fromFlag_int> flags.
Tessellates the faces used by the specified vertices.
Uses the .tesselateBy and .tessTension properties of the editable poly.
Tessellates the specified faces.
Uses the .tesselateBy and .tessTension properties of the editable poly.
Tessellates the faces used by the specified edges.
Uses the .tesselateBy and .tessTension properties of the editable poly.
polyop.detachFaces <Poly poly> <facelist> delete:<boolean=true> \ asNode:<boolean=false> name:<string="Object01"> node:<node=unsupplied>
If <delete> is true , the faces are deleted after being detached.
If <delete> is false , the faces are not deleted.
If <asNode> is true , the faces are detached as a separate node.
If <asNode> is false , the faces are detached as an element in the poly.
If <asNode> is true , <name> specifies the name of the new node.
If <asNode> is true and <poly> is an Editable Poly (not a node), <node> must be specified.
Returns true if the operation is successful.
polyop.detachEdges <Poly poly> <edgelist> delete:<boolean=true>\ asNode:<boolean=false> name:<string="Object01"> node:<node=unsupplied>
Detaches the faces used by the specified edges.
If <delete> is true , the faces are deleted after being detached.
If <delete> is false , the faces are not deleted.
If <asNode> is true , the faces are detached as a separate node.
If <asNode> is false , the faces are detached as an element in the poly.
If <asNode> is true , <name> specifies the name of the new node.
If <asNode> is true and <poly> is an Editable Poly (not a node), <node> must be specified.
Returns true if the operation is successful.
polyop.detachVerts <Poly poly> <vertlist> delete:<boolean=true> \ asNode:<boolean=false> name:<string="Object01"> node:<node=unsupplied>
Detaches the faces used by the specified vertices.
If <delete> is true , the faces are deleted after being detached.
If <delete> is false , the faces are not deleted.
If <asNode> is true , the faces are detached as a separate node.
If <asNode> is false , the faces are detached as an element in the poly.
If <asNode> is true , <name> specifies the name of the new node.
If <asNode> is true and <poly> is an Editable Poly (not a node), <node> must be specified.
Returns the location and direction of the slice plane as a Ray value.
If <size> is specified, the size of the slice plane is returned in the referenced variable.
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, the ray returned is in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, the return value is in the poly's local coordinate system.
Sets the slice plane to the location and direction as specified by <plane_and_dir>, and the size as specified by <size>.
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, the ray is in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, the ray is in the poly's local coordinate system.
Slices the poly based on the plane and direction as specified by <plane_and_dir>.
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, the ray is in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, the ray is in the poly's local coordinate system.
Uses the split property of the editable poly. Returns true if the slice is successful.
Returns true if the editable poly is in the slice mode, false otherwise.
polyop.cutVert <Poly poly> <int start_vert> <point3 destination> <point3 projdir> \ node:<node=unsupplied>
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, <destination> and <projdir> are in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, <destination> and <projdir> are in the poly's local coordinate system.
Returns the index of the new vertex if created, or undefined if no vertex is created.
polyop.cutFace <Poly poly> <int face> <point3 start> <point3 destination> <point3 projdir> \ node:<node=unsupplied>
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, <start>, <destination>, and <projdir> are in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, <start>, <destination>, and <projdir> are in the poly's local coordinate system.
Returns the index of the new vertex if created, or undefined if no vertex is created.
polyop.cutEdge <Poly poly> <int edge1> <float prop1> <int edge2> \ <float prop2><point3 projdir> node:<node=unsupplied>
If <poly> is a node, or if <poly> is an Editable Poly and <node> is specified, <projdir> is in the current coordinate system context.
If <poly> is an Editable Poly and <node> is not specified, <projdir> is in the poly's local coordinate system.
Returns the index of the new vertex if created, or undefined if no vertex is created.
Finds any borders that use one or more of the specified vertices, and builds faces to cap the holes.
Returns true if one or more holes were capped.
Finds any borders that use one or more of the vertices associated with the specified faces, and builds faces to cap the holes.
Returns true if one or more holes were capped.
Finds any borders that use one or more of the vertices associated with the specified edges, and builds faces to cap the holes.
Moves the specified vertices so that they are planar.
polyop.moveVertsToPlane <Poly poly> <vertlist> <Point3 planeNormal> <float planeOffset> \ node:<node>
Moves the specified vertices into the specified plane.
The target plane is defined as all points that return offset when DotProducted with N.
All vertices are moved along the normal vector N.
Moves the vertices associated with the specified edges so that they are planar.
polyop.moveEdgesToPlane <Poly poly> <edgelist> <Point3 planeNormal> <float planeOffset> \ node:<node=unsupplied>
Moves the vertices associated with the specified edges into the specified plane.
The target plane is defined as all points that return offset when DotProducted with N.
All vertices are moved along the normal vector N.
Moves the vertices associated with the specified faces so that they are planar.
polyop.moveFacesToPlane <Poly poly> <facelist> <Point3 planeNormal> <float planeOffset> \ node:<node=unsupplied>
Moves the vertices associated with the specified faces into the specified plane.
The target plane is defined as all points that return offset when DotProducted with N.
polyop.createShape <Poly poly> <edgelist> \ smooth:<boolean=false> name:<string="Shape01"> node:<node=unsupplied>
Creates a shape node from the specified edges.
If <smooth> is true , the shape is created as a smooth curve.
The name of the new node is specified by <name>.
If <poly> is an Editable Poly (not a node), <node> must be specified.
Extrudes the specified faces by the specified amount. Uses the .extrustionType property of the Editable Poly.
Bevels the specified faces. Extrudes the specified faces by the specified height, and then scales the new top faces by <outline>.
Uses the .extrustionType property of the Editable Poly.