Editable_Poly Methods

Editable_Poly Topics:

Editable_Poly: GeometryClass

Editable_Poly Properties

Editable_Poly Mapping Methods(polyOp struct)

Interface: EditablePoly

Editable Poly Modify Panel Command Modes and Operations

A suite of methods provide the ability for a script to invoke Editable Poly Modify panel modes and operations, corresponding to buttons available at various sub-object levels. These methods reside in the polyOp and polyOps global structures. These methods effectively "push the button" in the 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_poly_node_or_modifier> should be interpreted as either an Editable Poly node where the modifier stack level is at the base object, or an Edit Poly modifier where the modifier stack level is at the Edit Poly. In all cases, the following methods work at the current sub-object level, but only if that level is appropriate for the invoked operation.

The follow methods invoke one of the 'user-interaction' button operations in the Editable Poly Modify panel, acting on the currently selected sub-objects. These methods highlight the corresponding button in the 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.

Many of the polyOp methods take as an argument <vertlist>, <facelist>, or <edgelist>. These arguments specify the sub object (SO) elements to operate on. These arguments can be specified as:

#all - all SO elements of that type

#selection - the current SO selection of that type

#none - none of the SO elements of that type

An array of integers, where each integer value specifies a SO element index

A bitarray, where each bit specifies a SO element index

A value convertable to an integer that specifies a SO element index

A VertexSelection, EdgeSelection, or FaceSelection value. The value type must match the specified SO type.

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.

Editable polys can have "dead" vertices, edges, and faces. These are SO elements that have been deleted from the poly, but have not yet been removed from the corresponding lists of SO elements. SO elements may be marked as dead in the process of performing certain operations on the poly, but the SO element lists are normally collapsed (that is, all dead SO elements removed) at the end of the operation. Thus, normally there should not be any dead SO elements present in the poly. If you flag a SO element as dead using one of the polyOp methods, you should also call collapseDeadStructs to collapse the SO element lists.

Other than methods that get/set SO element flags, dead SO elements are normally ignored by the polyOp methods. If a method returns a value other than OK, takes a single SO element index, and that SO element is dead, a value of UNDEFINED is normally returned.

Get/Set Selection

polyOp.getVertSelection <Poly poly>

Returns the current vertex selection as a bitarray

polyOp.setVertSelection <Poly poly> <vertlist>

Sets the current vertex selection based on <vertlist>

polyOp.getEdgeSelection <Poly poly>

Returns the current edge selection as a bitarray

polyOp.setEdgeSelection <Poly poly> <edgelist>

Sets the current edge selection based on <vertlist>

polyOp.getFaceSelection <Poly poly>

Returns the current face selection as a bitarray

polyOp.setFaceSelection <Poly poly> <facelist>

Sets the current face selection based on <facelist>

Get By Flag

polyOp.getVertsByFlag <Poly poly> <int flag> mask:<int maskflag>

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>.

The vertex level flags are:

bit 1: vertex is selected

bit 2: vertex is dead

bit 3: reserved

bit 4: indicates the vertex faces "backwards" in the current viewport

bit 5-24: reserved

bit 25-32: available for general use

Example:

theObj = plane isSelected:true

convertto theObj editable_poly

 

nVerts = theObj.numverts

 

bit30 = bit.set 0 30 true

bit31 = bit.set 0 31 true

bit32 = bit.set 0 32 true

 

-- set a bit on first 3/4 or so verts

(

flagsToSet = bit30

flagsToMask = 0

vertexSet = #{1..(3*nVerts/4)}

theObj.setVertexFlags vertexSet flagsToSet flagMask:flagsToMask generateUndoRecord:true

ok

)

-- and another on middle block

(

flagsToSet = bit31

flagsToMask = 0

vertexSet = #{(nVerts/3)..(nVerts-4)}

theObj.setVertexFlags vertexSet flagsToSet flagMask:flagsToMask generateUndoRecord:true

ok

)

-- set a bit on last 2 verts

(

flagsToSet = bit32

flagsToMask = 0

vertexSet = #{(nVerts-2)..nVerts}

theObj.setVertexFlags vertexSet flagsToSet flagMask:flagsToMask generateUndoRecord:true

ok

)

 

(

-- get verts with bit30, 31, 32 set

format "30: %\n" (polyOp.getVertsByFlag theObj bit30)

format "31: %\n" (polyOp.getVertsByFlag theObj bit31)

format "32: %\n" (polyOp.getVertsByFlag theObj bit32)

 

-- get verts with bit30 set, but not bit31

format "30 and !31: %\n" (polyOp.getVertsByFlag theObj bit30 mask:(bit30+bit31))

 

-- get verts with bit31 not set, doesn't matter what the <flag>

-- value is as long as it's not bit31

format "!31: %\n" (polyOp.getVertsByFlag theObj bit30 mask:(bit31))

 

-- get verts with bit30 and bit31 set

format "30 and 31: %\n" (polyOp.getVertsByFlag theObj (bit30+bit31))

 

-- get verts with neither bit31 or bit32 set, doesn't matter what

-- the <flag> value is as long as it's not bit31 or bit32

format "!(31 or 32): %\n" (polyOp.getVertsByFlag theObj bit30 mask:(bit31+bit32))

)

 

polyOp.getVertFlags <Poly poly> <int vert>

Returns the flags bits for the vertex as an integer.

polyOp.setVertFlags <Poly poly> <vertlist> <int flag> mask:<int=0> undoable:<boolean=false>

Sets the flag bits on the specified vertices to the bits in <flag>. If mask is specified, the bits set in the mask value are cleared for all vertices in the poly prior to setting 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.

Example:

p=convertToPoly (plane())

p.selectedVerts = #{10..20}

i=1 -- selected bit

j=bit.set 0 30 true -- bit 30 set

oldflags = for k = 1 to p.numverts collect polyop.getVertFlags p k

theSet=#{5..15}

polyop.setvertflags p theSet j mask:i

for k = 1 to p.numverts do

(

nf=polyop.getVertFlags p k

format "% : % : %\n" k nf oldflags[k]

oldflags[k]=nf

)

j=bit.set 0 1 true -- bit 1 set

polyop.setvertflags p theSet j

for k = 1 to p.numverts do

(

nf=polyop.getVertFlags p k

format "% : % : %\n" k nf oldflags[k]

)

polyOp.getEdgesByFlag <Poly poly> <int flag> mask:<int maskflag>

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>.

The edge level flags are:

bit 1: edge is selected

bit 2: edge is dead

bit 3: reserved

bit 4: indicates the vertex faces "backwards" in the current viewport

bit 5-24: reserved

bit 25-32: available for general use

polyOp.getEdgeFlags <Poly poly> <int edge>

Returns the flags bits for the edge as an integer.

polyOp.setEdgeFlags <Poly poly> <edgelist> <int flag> mask:<int=0> undoable:<boolean=false>

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.

polyOp.getFacesByFlag <Poly poly> <int flag> mask:<int maskflag>

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>.

The face level flags are:

bit 1: face is selected

bit 2: face is dead

bit 3: reserved

bit 4: indicates the vertex faces "backwards" in the current viewport

bit 5-24: reserved

bit 25-32: available for general use

polyOp.getFaceFlags <Poly poly> <int face>

Returns the flags bits for the face as an integer.

polyOp.setFaceFlags <Poly poly> <facelist> <int flag> mask:<int=0> undoable:<boolean=false>

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.

 

Get Count

polyOp.getNumVerts <Poly poly>

Returns the number of vertices in the poly. Includes any dead vertices.

polyOp.getNumEdges <Poly poly>

Returns the number of edges in the poly. Includes any dead edges.

polyOp.getNumFaces <Poly poly>

Returns the number of faces in the poly. Includes any dead faces.

Get/Set Hidden

polyOp.getHiddenVerts <Poly poly>

Bits in the result bitarray are set if the corresponding vertex is hidden.

polyOp.setHiddenVerts <Poly poly> <vertlist>

Hides the corresponding vertices in the poly

polyOp.getHiddenFaces <Poly poly>

Bits in the result bitarray are set if the corresponding face is hidden.

polyOp.setHiddenFaces <Poly poly> <facelist>

Hides the corresponding faces in the poly

polyOp.unHideAllFaces <Poly poly>

Unhides all faces in the poly.

polyOp.unHideAllVerts <Poly poly>

Unhides all vertices in the poly.

Edge Visibility

polyOp.getEdgeVis <Poly poly> <int edge>

Returns true if the specified edge is visible, false otherwise.

polyOp.setEdgeVis <Poly poly> <edgelist> <boolean>

Sets the visibility of the specified edges.

Open Edges

polyOp.getOpenEdges <Poly poly>

Bits in the result bitarray are set if the corresponding edge is open (used by only 1 ace).

polyOp.getBorderFromEdge <Poly poly> <int edge>

Bits in the result bitarray are set for open edges in the poly that are connected via open edges to the specified edge.

All one-sided edges in polys can be grouped into chains, end to end, that 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 isn't open, the resulting bitarray is empty.

Get By Face

polyOp.getFaceVerts <Poly poly> <int face>

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.

polyOp.getFaceEdges <Poly poly> <int 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.

polyOp.getFaceDeg <Poly poly> <int face>

Returns the number of vertices in the specified face.

Get By Edge

polyOp.getEdgeVerts <Poly poly> <int edge>

Returns the edge's vertices as a 2 element array.

polyOp.getEdgeFaces <Poly poly> <int edge>

Returns the faces using the specified edge. Normally a 1 element (open edge) or 2 element array.

Get Dead Elements

polyOp.getDeadVerts <Poly poly>

Returns the current dead vertices selection as a bitarray. Normally this will return an empty bitarray.

polyOp.getDeadEdges <Poly poly>

Returns the current dead edges selection as a bitarray. Normally this will return an empty bitarray.

polyOp.getDeadFaces <Poly poly>

Returns the current dead faces selection as a bitarray. Normally this will return an empty bitarray.

polyOp.GetHasDeadStructs <Poly poly>

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.

He is dead, Jim

polyOp.isFaceDead <Poly poly> <int face>

Returns true if the specified face is dead.

polyOp.isEdgeDead <Poly poly> <int edge>

Returns true if the specified edge is dead.

polyOp.isVertDead <Poly poly> <int vert>

Returns true if the specified vertex is dead.

polyOp.CollapseDeadStructs <Poly poly>

Removes all dead SO elements from the poly.

Face Material IDs

polyOp.getFaceMatID <Poly poly> <int face>

Returns the material ID assigned to the face

polyOp.setFaceMatID <Poly poly> <facelist> <int MatID>

Assigns the material ID to the face

Manipulate Vertex

polyOp.getVert <Poly poly> <int vertex> node:<node=unsupplied>

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.

polyOp.setVert <Poly poly> <vertlist> <point3 pos> node:<node=unsupplied>

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.

polyOp.moveVert <Poly poly> <vertlist> <point3 offset> node:<node=unsupplied>

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.

Fill In Mesh

polyOp.isMeshFilledIn <Poly poly>

Returns true if all topological links, such as the list of edges, are complete for the poly.

polyOp.fillInMesh <Poly poly>

Recomputes the internal MNEdges and MNFace::edg, MNVert::edg, and MNVert::fac lists based on the information in the MNFace::vtx lists.

Get A Using B

polyOp.getEdgesUsingVert <Poly poly> <vertlist>

Bits in the result bitarray are set if the corresponding edge uses one of the vertices in <vertlist>.

polyOp.getFacesUsingVert <Poly poly> <vertlist>

Bits in the result bitarray are set if the corresponding face uses one of the vertices in <vertlist>.

polyOp.getVertsUsingEdge <Poly poly> <edgelist>

Bits in the result bitarray are set if the corresponding vertex uses one of the edges in <edgelist>.

polyOp.getFacesUsingEdge <Poly poly> <edgelist>

Bits in the result bitarray are set if the corresponding face uses one of the edges in <edgelist>.

polyOp.getVertsUsingFace <Poly poly> <facelist>

Bits in the result bitarray are set if the corresponding vertex uses one of the faces in <facelist>.

polyOp.getEdgesUsingFace <Poly poly> <facelist>

Bits in the result bitarray are set if the corresponding edge uses one of the faces in <facelist>.

polyOp.getElementsUsingFace <Poly poly> <facelist> fence:<fence_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 will be considered "walls" for this processing and will not be evaluated. That is, if face i is specified in <facelist>, and a ring of faces around it is specified in <fence_facelist>, the algorithm will stop at that ring.

polyOp.getVertsUsedOnlyByFaces <Poly poly> <facelist>

Bits in the result bitarray are set if the corresponding vertex is only used by faces in <edgelist>.

Get Face Center, Normal and Area

polyOp.getFaceCenter <Poly poly> <int face> node:<node=unsupplied>

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.

polyOp.getSafeFaceCenter <Poly poly> <int face> node:<node=unsupplied>

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 (i.e., 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.

polyOp.getFaceNormal <Poly poly> <int face> node:<node=unsupplied>

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.

polyOp.getFaceArea <Poly poly> <int face>

Returns the area of the specified face.

Attach

polyOp.attach <Poly poly> <source> targetNode:<node=unsupplied> sourceNode:<node=unsupplied>

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. The source node is deleted after the attach is performed.

Delete

polyOp.deleteVerts <Poly poly> <vertlist>

Deletes the specified vertices.

polyOp.deleteFaces <Poly poly> <facelist> delIsoVerts:<boolean=true>

Deletes the specified faces. If <delIsoVerts> is true, any vertices that are no longer used by faces are also deleted.

polyOp.deleteEdges <Poly poly> <edgelist> delIsoVerts:<boolean=true>

Deletes the specified edges. 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. Now 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 isn't exposed through the polyOp structure, so you will need to work through the EditablePoly interface, Remove method.

An example replacement function which will work in both version 4 and higher is:

Example:

fn polyop_deleteEdges obj which delIsoVerts:=

if (MaxVersion())[1] >= 5000 then

(

local bit30 = bit.set 0 30 true

polyop.setEdgeFlags obj which bit30

obj.EditablePoly.remove selLevel:#edge flag:bit30

if delIsoVerts == true do polyop.deleteIsoVerts obj

)

else

polyop.deleteEdges obj which delIsoVerts:delIsoVerts

)

polyOp.deleteIsoVerts <Poly poly>

Deletes any vertices not used by any faces.

Weld

polyOp.weldVertsByThreshold <Poly poly> <vertlist>

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.

polyOp.weldVerts <Poly poly> <int vert1> <int vert2> <point3 location> node:<node=unsupplied>

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.

polyOp.weldEdgesByThreshold <Poly poly> <edgelist>

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.

polyOp.weldEdges <Poly poly> <int edge1> <int edge2>

Welds the vertices associated with the specified edges. Only vertices on a border can be welded.

Create

polyOp.createVert <Poly poly> <point3 pos> node:<node=unsupplied>

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.

polyOp.createEdge <Poly poly> <int vert1> <int vert2>

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.

polyOp.createPolygon <Poly poly> <vertex array>

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 1 edge may 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 may be inappropriate.

If this is the case, call retriangulate() on this face after it's created. This returns the index of the created face or undefined if no face was created.

Auto-Smooth

polyOp.autoSmooth <Poly poly>

Performs an auto smooth of the poly. The face smoothing threshold angle is a property (autoSmoothThreshold) of the editable poly.

Triangulation

polyOp.flipNormals <Poly poly> <facelist>

Flips the normal of the specified faces.

polyOp.retriangulate <Poly poly> <facelist>

Retriangulates the specified faces.

polyOp.setDiagonal <Poly poly> <int face> <int face_vert1> <int face_vert2>

Sets a diagonal of the face between the two vertices. The face must have a degree greater than 3 and the two vertices must not be connected by an edge.

Subdivisions

polyOp.forceSubdivision <Poly poly>

Forces an update of the surface subdivision at the next viewport redraw. Use when NURMS Subdivision is on and Update Options is Manually.

polyOp.meshSmoothByVert <Poly poly> <vertlist>

Smooths the faces associated with the specified vertices. Uses the smoothness, separateBySmoothing, and separateByMaterial properties of the editable poly.

polyOp.meshSmoothByFace <Poly poly> <facelist>

Smooths the specified faces. Uses the smoothness, separateBySmoothing, and separateByMaterial properties of the editable poly.

polyOp.meshSmoothByEdge <Poly poly> <edgelist>

Smooths the faces associated with the specified edges. Uses the smoothness, separateBySmoothing, and separateByMaterial properties of the editable poly.

Face Smoothing Groups

polyOp.setFaceSmoothGroup <Poly poly> <facelist> <int smoothing_group> add:<boolean=false>

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 false, the existing smoothing group data is overwritten.

polyOp.getFaceSmoothGroup <Poly poly> <int face>

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.

Break/Divide/Split

polyOp.breakVerts <Poly poly> <vertlist>

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.

polyOp.divideEdge <Poly poly> <int edge> <float fraction>

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.

polyOp.divideFace <Poly poly> <int face> <point3 pos> node:<node=unsupplied>

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 will be 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. Returns the index of the created vertex.

polyOp.splitEdges <Poly poly> <edgelist>

Splits the specified edges at their middle.

Collapse

polyOp.collapseVerts <Poly poly> <vertlist>

Collapses each cluster of vertices in the specificed vertices to a single vertex. A vertex cluster is a set of vertices that are directly connected to one another.

polyOp.collapseFaces <Poly poly> <facelist>

Collapses the vertices associated with each cluster of faces in the specificed faces to a single vertex. A face cluster is a set of faces that are directly connected to one another.

polyOp.collapseEdges <Poly poly> <edgelist>

Collapses the vertices associated with each cluster of edges in the specificed edges to a single vertex. An edge cluster is a set of edges that are directly connected to one another.

Propagate Flags

polyOp.propagateFlags <Poly poly> <toSOLevel> <toFlag_int> <fromSOLevel> <fromFlag_int> ampersand:<boolean=false> set:<boolean=true> undoable:<boolean=true>

where toSOLevel/fromSOLevel = {#object | #vertex | #edge | #face}

Propogates component flags. For each <fromSOLevel> element that has flag <fromFlag_int> set, the <toSOLevel> elements that use or are used by the element will 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 will be tested to see if they have any of the corresponding bits set. If true, the <fromSOLevel> components elements be tested to see if they have all the corresponding bits set. If <set> is true, the <toSOLevel> elements have flags <toFlag_int> set. If false, these flags will be cleared instead.

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.

Tessellate

polyOp.tessellateByVert <Poly poly> <vertlist>

Tessellates the faces used by the specified vertices. Uses the tesselateBy and tessTension properties of the editable poly.

polyOp.tessellateByFace <Poly poly> <facelist>

Tessellates the specified faces. Uses the tesselateBy and tessTension properties of the editable poly.

polyOp.tessellateByEdge <Poly poly> <edgelist>

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>

Detaches the specified faces. 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 was successful.

Script:

--The following script explodes an EditablePoly object to elements,

--each polygon becomes one element

macroScript PolyToElements category:"Help_Examples"

(

on isEnabled return

selection.count == 1 and classof selection[1].baseobject == Editable_Poly

 

on execute do

(

obj = selection[1]

for p = polyop.getNumFaces obj to 1 by -1 do

polyOp.detachFaces obj #{p}

)

)

Detach

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 was 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 true if the operation was successful.

Slice Plane

polyOp.resetSlicePlane <Poly poly>

Resets the slice plane.

polyOp.getSlicePlane <Poly poly> size:<&size_float_var> node:<node=unsupplied>

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.

polyOp.setSlicePlane <Poly poly> <ray plane_and_dir> <float size> \

node:<node=unsupplied>

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.

polyOp.slice <Poly poly> <facelist> <ray plane_and_dir> \

node:<node=unsupplied>

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 was successful.

polyOp.inSlicePlaneMode <Poly poly>

Returns true if the editable poly is in slice mode, false otherwise.

Cut

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 was 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 was 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 was created.

Cap Holes

polyOp.capHolesByVert <Poly poly> <vertlist>

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.

polyOp.capHolesByFace <Poly poly> <facelist>

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.

polyOp.capHolesByEdge <Poly poly> <edgelist>

Finds any borders that use one or more of the vertices associated with the specified edges, and builds faces to cap the holes. Returns true if one or more holes were capped.

Make Planar

polyOp.makeVertsPlanar <Poly poly> <vertlist>

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 which, when DotProducted with N, return offset. All vertices are moved along the normal vector N.

polyOp.makeEdgesPlanar <Poly poly> <edgelist>

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 which, when DotProd'd with N, return offset. All vertices are moved along the normal vector N.

polyOp.makeFacesPlanar <Poly poly> <facelist>

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 which, when DotProd'd with N, return offset. All vertices are moved along the normal vector N.

Create Shape From Edges

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.

 

Extude/Bevel/Chamfer

polyOp.extrudeFaces <Poly poly> <facelist> <float amount>

Extrudes the specified faces by the specified amount. Uses the extrustionType property of the Editable Poly.

polyOp.bevelFaces <Poly poly> <facelist> <float height> <float outline>

Bevels the specified faces. Extrudes the specified faces the specified height, and then scales the new top faces by <outline>. Uses the extrustionType property of the Editable Poly.

polyOp.chamferVerts <Poly poly> <vertlist> <float amount>

Chamfers the specified vertices by the specified amount.

polyOp.chamferEdges <Poly poly> <edgelist> <float amount>

Chamfers the specified edges by the specified amount.

Editable_Poly Topics:

Editable_Poly: GeometryClass

Editable_Poly Properties

Editable_Poly Methods

Editable_Poly Mapping Methods(polyOp struct)

Interface: EditablePoly