Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '-----------------------------------------------------------------------------------------------------------------'
- '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.
- '-----------------------------------------------------------------------------------------------------------------'
- dim oCol, oSelection, oSelecto, BP
- 'Define a collection(oCol) for adding objects to
- Set oCol = CreateObject( "XSI.Collection" )
- 'Check if an object is selected
- if application.selection.count > 0 Then
- Set oSelection = Application.Selection
- for i = 0 to (oSelection.Count - 1)
- oCol.add oSelection(i)
- next
- else
- 'If no object is selected, start a picksession
- LogMessage "Select a PolyMesh"
- PickObject "Select a PolyMesh", " ", oSelecto
- oCol.add oSelecto
- end if
- for i = 0 to (oCol.count-1)
- set oSelecto = oCol(i)
- 'Make sure the oSelecto is a Polymesh, if it isn't then give the user one last try to select one
- set oSelecto = Dictionary.GetObject( oSelecto, false )
- if oSelecto.Type = "polymsh" then
- ScriptCancel = "no"
- else
- LogMessage oSelecto & " is a " & oSelecto.Type & ",not a polymsh"
- BP = XSIUIToolkit.Msgbox( oSelecto & " is not a polymsh, do you want to select something else?", 4, "No Polygon Mesh Selected" )
- if BP = 6 then
- PickObject "Please select a polygon mesh", " ", oSelecto
- if oSelecto.Type = "polymsh" then
- ScriptCancel = "no"
- else
- XSIUIToolkit.Msgbox "Bah, I give up.. " & oSelecto & " is a " & oSelecto.Type & " !", 1, "No Polygon Mesh Selected"
- Logmessage "Script Cancelled - Next time select a Polygon Mesh instead of a " & oSelecto.Type & "! :)"
- ScriptCancel = "yes"
- end if
- else
- ScriptCancel = "yes"
- end if
- end if
- if ScriptCancel = "no" then
- 'Add a slice op to Selection
- ApplyTopoOp "SlicePolygons", oSelecto, siUnspecified, siPersistentOperation
- 'Set the slice op's reference plane to local
- SetValue oSelecto&".polymsh.slicepolygonsop.planeref", 1
- 'Delete polys below (-x)
- SetValue oSelecto&".polymsh.slicepolygonsop.sliceaction", 3
- 'Inspect the Slice op if selection count is less than 2
- if oCol.Count < 2 then
- InspectOBJ oDupe&".polymsh.slicepolygonsop"
- end if
- LogMessage oSelecto & " was chopped in half!"
- SelectObj oSelecto
- end if
- next
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement