' 
' MeshSplit 
' A tool to split a mesh into two new meshes 
' Composed of selected faces in the one object, 
' Unselected faces in the other. 
' The source object remains untouched. 
' 
' Kim Aldis 1/2000 
' 
''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 

set mySelection = Selection(0) 



' The selection will be a subelement so we 
' need to extract the actual object from the 
' selection.value. 

myObjName = split( mySelection.value, "." )(0) 
set myObj = Application.ActiveProject.ActiveScene.Root.FindChild( myObjName ) 

'''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
' 
' MeshSplit 
' A tool to split a mesh into two new meshes 
' Composed of selected faces in the one object, 
' Unselected faces in the other. 
' The source object remains untouched. 
' 
' Kim Aldis 1/2000 
' 
''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 

set mySelection = Selection(0) 



' The selection will be a subelement so we 
' need to extract the actual object from the 
' selection.value. 

myObjName = split( mySelection.value, "." )(0) 
set myObj = 
Application.ActiveProject.ActiveScene.Root.FindChild( myObjName ) 




' Now make 2 duplicates of the original, toggling 
' the poly selection in one. 
' By selecting each object in poly mode 
' we can extract the selected faces in a form that 
' ApplyTopoOp can understand when we come to delete the polys 

myDupA = Duplicate( myObj,1,,siSharedParent ) 
SetSelFilter "Polygon" 

set mySelection = selection(0) 
myDeleteA = mySelection.Value 



myDupB = Duplicate( myObj,1,,siSharedParent ) 
SetSelFilter "Polygon" 

ToggleSelection myDupB & ".poly[*]", , True 
set mySelection = selection(0) 
myDeleteB = mySelection.Value 



' And now, do the delete 

ApplyTopoOp "DeleteComponent", myDeleteA, siUnspecified, 
siPersistentOperation 
ApplyTopoOp "DeleteComponent", myDeleteB, siUnspecified, 
siPersistentOperation 


