Advertisement
spookymunky

SymmThings 2.0 - Delete-X (VBS)

Mar 25th, 2013
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '-----------------------------------------------------------------------------------------------------------------'
  2. 'Adds a slice op to the selected object(s) and sets it to delete -x polygons, if the polymsh was asymmertrical you 'may have to adjust the slice op's offset% in the ppg that pops up.. I find adjusting the offset % so you can see 'the center of the object, then clicking "Snap Offset To Point" and selecting a point on the centerline is the 'simplest way.
  3. '-----------------------------------------------------------------------------------------------------------------'
  4.  
  5. dim oCol, oSelection, oSelecto, BP
  6.  
  7. 'Define a collection(oCol) for adding objects to
  8. Set oCol = CreateObject( "XSI.Collection" )
  9.  
  10. 'Check if an object is selected
  11. if application.selection.count > 0 Then
  12.  
  13.     Set oSelection = Application.Selection
  14.    
  15.     for i = 0 to (oSelection.Count - 1)
  16.         oCol.add oSelection(i)
  17.     next   
  18.  
  19. else
  20.  
  21.     'If no object is selected, start a picksession
  22.     LogMessage "Select a PolyMesh"
  23.     PickObject "Select a PolyMesh", " ", oSelecto
  24.  
  25.     oCol.add oSelecto
  26.    
  27. end if
  28.  
  29. for i = 0 to (oCol.count-1)
  30.  
  31.     set oSelecto = oCol(i)
  32.  
  33.     'Make sure the oSelecto is a Polymesh, if it isn't then give the user one last try to select one
  34.     set oSelecto = Dictionary.GetObject( oSelecto, false )
  35.    
  36.     if oSelecto.Type = "polymsh" then
  37.         ScriptCancel = "no"
  38.        
  39.     else
  40.    
  41.         LogMessage oSelecto & " is a " & oSelecto.Type & ",not a polymsh"
  42.        
  43.         BP = XSIUIToolkit.Msgbox( oSelecto & " is not a polymsh, do you want to select something else?", 4, "No Polygon Mesh Selected" )
  44.        
  45.             if BP = 6 then
  46.            
  47.                 PickObject "Please select a polygon mesh", " ", oSelecto
  48.                
  49.                 if oSelecto.Type = "polymsh" then  
  50.        
  51.                     ScriptCancel = "no"    
  52.        
  53.                     else               
  54.                    
  55.                     XSIUIToolkit.Msgbox "Bah, I give up.. " & oSelecto & " is a " & oSelecto.Type & " !", 1, "No Polygon Mesh Selected"
  56.                     Logmessage "Script Cancelled - Next time select a Polygon Mesh instead of a " & oSelecto.Type & "! :)"
  57.  
  58.                     ScriptCancel = "yes"
  59.  
  60.                     end if
  61.                    
  62.             else
  63.                
  64.             ScriptCancel = "yes"
  65.  
  66.             end if
  67.            
  68.     end if
  69.  
  70.     if ScriptCancel = "no" then
  71.    
  72.         'Add a slice op to Selection
  73.         ApplyTopoOp "SlicePolygons", oSelecto, siUnspecified, siPersistentOperation
  74.        
  75.         'Set the slice op's reference plane to local
  76.         SetValue oSelecto&".polymsh.slicepolygonsop.planeref", 1
  77.        
  78.         'Delete polys below (-x)
  79.         SetValue oSelecto&".polymsh.slicepolygonsop.sliceaction", 3
  80.  
  81.         'Inspect the Slice op if selection count is less than 2
  82.         if oCol.Count < 2 then
  83.             InspectOBJ oDupe&".polymsh.slicepolygonsop"
  84.         end if
  85.  
  86.         LogMessage oSelecto & " was chopped in half!"
  87.        
  88.         SelectObj oSelecto
  89.  
  90.     end if
  91.    
  92. next
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement