Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
85 views6 pages

Drawing Solidworks API Hide View Sketch

The document contains a Visual Basic for Applications (VBA) script for SolidWorks that hides view sketches in a model. It traverses the feature tree of the active document, identifies profile features, and blanks the corresponding sketches. The script utilizes various SolidWorks API objects and methods to achieve its functionality.

Uploaded by

Deepak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views6 pages

Drawing Solidworks API Hide View Sketch

The document contains a Visual Basic for Applications (VBA) script for SolidWorks that hides view sketches in a model. It traverses the feature tree of the active document, identifies profile features, and blanks the corresponding sketches. The script utilizes various SolidWorks API objects and methods to achieve its functionality.

Uploaded by

Deepak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

SW API HIDE VIEW SKETCH

Dim swApp As SldWorks.SldWorks

Dim swmodel As SldWorks.ModelDoc2

Dim swnode As SldWorks.TreeControlItem

Dim swchildnode As SldWorks.TreeControlItem

Dim swfirstnode As TreeControlItem

Dim bool As Boolean

Dim swfeatmgr As SldWorks.FeatureManager

Dim rootnode As SldWorks.TreeControlItem

Dim swfinalnode As SldWorks.TreeControlItem

Dim fnalfeature As SldWorks.TreeControlItem

Dim fnalfeature1 As SldWorks.TreeControlItem

Dim longstat As Long, war As Long


Dim swselmgr As SldWorks.SelectionMgr

Dim swfeat As SldWorks.Feature

Dim swview As SldWorks.View

Dim prt As SldWorks.ModelDoc2

Sub main()

Set swApp = Application.SldWorks

Set swmodel = swApp.ActiveDoc

Set prt = swApp.ActiveDoc

Set swfeatmgr = swmodel.FeatureManager

Set rootnode = swfeatmgr.GetFeatureTreeRootItem2(0)

Set swselmgr = swmodel.SelectionManager

Set swview = swselmgr.GetSelectedObject6(1, -1)

Debug.Print rootnode.Text
If Not rootnode Is Nothing Then

Set swnode = rootnode.GetFirstChild

Debug.Print swnode.Text

While Not swnode Is Nothing

Set swfirstnode = swnode.GetFirstChild

While Not swfirstnode Is Nothing

Debug.Print swfirstnode.Text

Set swchildnode = swfirstnode.GetFirstChild

If swview.Name = swfirstnode.Text Then

While Not swchildnode Is Nothing

Debug.Print swchildnode.Text

'*****************************************if loop

Set swfinalnode = swchildnode.GetFirstChild


While Not swfinalnode Is Nothing

Debug.Print swfinalnode.Text

Set fnalfeature = swfinalnode.GetFirstChild

While Not fnalfeature Is Nothing

Debug.Print fnalfeature.Text

Set fnalfeature1 = fnalfeature.GetFirstChild

While Not fnalfeature1 Is Nothing

Debug.Print fnalfeature1.Text

Set swfeat = fnalfeature1.Object

If swfeat.GetTypeName2 = "ProfileFeature" Then

bool = swfeat.Select2(False, -1)

prt.BlankSketch

' prt.ClearSelection2 True


' swmodel.ForceRebuild3 False

End If

Set fnalfeature1 = fnalfeature1.GetNext

Wend

Set fnalfeature = fnalfeature.GetNext

Wend

Set swfinalnode = swfinalnode.GetNext

Wend

'*******************

Set swchildnode = swchildnode.GetNext

Wend

End If

Set swfirstnode = swfirstnode.GetNext


Wend

Set swnode = swnode.GetNext

Wend

End If

End Sub

You might also like