Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy way to find extra features? 1

Status
Not open for further replies.

bvanhiel

Mechanical
Oct 23, 2001
510
I was just wondering if there was a quick way to find childless features that sometimes accumulate in large models. Things like extra planes, sketches, etc.

-b
 
Replies continue below

Recommended for you

Hi B,

There is no command per se that can do this.

However, there is a best practice that I do for modeling...

When there is a feature one likes, and one knows it will be used, put it in a folder. That way when you are finished creating a model anything in the feature tree that is not in a folder, can be deleted.

cheers,
 
I got this macro from Chen Gingold some time ago, it removes redundant planes.
Code:
' ***************************************************************************­*** 
' 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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor