Editable_Poly Get By Flag Methods

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

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