Editable_Poly Methods

 

   

Editable Poly - Quick Navigation

The following topic lists the polyOp methods which are applicable to objects collapsed to Editable_Poly base object.

Topic Navigation:

 

Get/Set Selection

Get By Flag

Get Count

Get/Set Hidden

Edge Visibility

Open Edges

Get By Face

Get By Edge

Get Dead Elements

Dead Structures

Face Material IDs

Manipulate Vertex

Get A Using B

Get Face, Center, Normal and Area

Attach

Delete

Weld

Create

Auto-Smooth

Triangulation

Subdivisions

Face_Smoothing_Groups

Break, Divide, Split

Collapse

Propagate_Flags

Tessellate

Detach

Slice Plane

Cut

Cap Holes

Make Planar

Create Shape From Edges

Extrude, Bevel, Chamfer

About polyOp Methods First Argument:

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

About Editable_Poly Dead Sub-Object Elements:

Editable polys can have "dead" vertices, edges, and faces.

These are Sub-Object elements that have been deleted from the poly, but have not yet been removed from the corresponding lists of Sub-Object elements.

Sub-Object elements may be marked as dead in the process of performing certain operations on the poly, but the Sub-Object element lists are normally collapsed (that is, all dead Sub-Object elements removed) at the end of the operation or at file I/O operations. Thus, normally there should 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 should also call polyOp.collapseDeadStructs() to collapse the Sub-Object element lists.

Other than methods that get/set Sub-Object element flags, 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.

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 top.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>|<point3 pos_array>} \
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.

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.

NOTE:It is very important to pass the <vertlist> argument as a bitArray value and not as an array. Passing the argument as an array will cause a significant performance hit (orders of magnitude!)This applies to all methods operating on sub-object lists.

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

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 <add> is 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 <Polypoly> <toSOLevel> <toFlag_int><fromSOLevel> <fromFlag_int> \
ampersand:<boolean=false> set:<boolean=true> undoable:<boolean=true>

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

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

   

Detach

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}
)
)

   

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

See Also