title: Maxscript with modfiers
body: <p>From creating a cube the following code should select the top two triangles, invert that selection and then delete those newly selected faces. So far so good. However, I seem to run into trouble when there’s a modifier (or more) on the base cube.</p>
  
  <pre><code>(
  --clear the listener
   clearListener()
  
   theObj = $
  
   -- init. an array to collect faces
   selArray = #{}
   invArray = #{}
  
   append selArray 3
   append selArray 4
  
   -- get the number of faces in the object
   theMeshCount = theObj.numfaces
  
   -- invert the array
   for f = 1 to theMeshCount do
   (
   if (selArray[f] == false) then invArray[f] = true
   else invArray[f] = false 
   )
  
   -- set the face selection in the EMesh
   setFaceSelection theObj invArray
  
   -- go to modify mode
   max modify mode
  
   -- select the mesh
   select theObj
  
   -- add the Mesh Select modifier
   modPanel.addModToSelection (Mesh_Select ())
  
   -- go to Face level
   subObjectLevel = 3
  
   --add a delete mesh, preserving the selection
   modPanel.addModToSelection (deleteMesh())
  )
  </code></pre>
  
  <p>So where am I going wrong?</p>