' ******************************************************************************
' C:\TEMP\swx266\Macro1.swb - macro recorded on 08/13/02 by Chen
' ******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Sub deleteplanes()
Dim SubFeatObj As Object
Dim FeatObj As Object
Dim FeatType As String
Dim retval As Variant
Set FeatObj = Part.FirstFeature
Do While Not FeatObj Is Nothing
FeatType = FeatObj.GetTypeName
If FeatType = "RefPlane" And FeatObj.Name <> "Front" _
And FeatObj.Name <> "Top" And FeatObj.Name <> "Right" _
Then 'a sketch - select it
retval = FeatObj.GetChildren()
If IsEmpty(retval) Then
Part.AndSelectByID FeatObj.Name, "PLANE", 0, 0, 0
End If
End If
Set FeatObj = FeatObj.GetNextFeature
Loop
Part.DeleteSelection (False)
End Sub
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
If (Part Is Nothing) Then
swApp.SendMsgToUser2 _
"No Active Part !! " _
, swMbWarning, swMbOk
Exit Sub
End If
If (Part.GetType <> 1) Then ' If not an assembly or parts, then
exit
swApp.SendMsgToUser2 "Only for use with parts.", swMbWarning,
swMbOk
Exit Sub
End If
Set SelMgr = Part.SelectionManager() ' Get the selection manager
object
Part.ClearSelection
Call deleteplanes
End Sub [\code]
Hope it helps
Pete