1 Imports SolidWorks.Interop.sldworks
2 Imports SolidWorks.Interop.swconst
3 Imports System.Runtime.InteropServices
4 Imports System
5
6 Partial Class SolidWorksMacro
7
8 Public Sub main()
9
10 Dim swSelMgr As SelectionMgr
11 Dim swDoc As ModelDoc2 = Nothing
12 Dim swPart As PartDoc = Nothing
13 Dim boolstatus As Boolean = False
14 Dim longstatus As Integer = 0
15 Dim swSketch As Sketch
16 Dim swFeat As Feature
17 Dim vSketchSeg As Object
18 Dim swSketchSeg As SketchSegment
19 Dim k As Integer = 0
20
21 swDoc = CType(swApp.ActiveDoc, ModelDoc2)
22 boolstatus = swDoc.Extension.SelectByID2("AIR_LOW_SKETCH", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
23 swDoc = swApp.ActiveDoc
24 swSelMgr = swDoc.SelectionManager
25 swFeat = swSelMgr.GetSelectedObject6(1, 0)
26 swSketch = swFeat.GetSpecificFeature2
27 swDoc.ClearSelection2(True)
28 vSketchSeg = swSketch.GetSketchSegments
29 If Not IsNothing(vSketchSeg) Then
30 For k = 0 To UBound(vSketchSeg)
31 swSketchSeg = vSketchSeg(k)
32 swSketchSeg.SelectByMark(True, 0)
33 Next k
34 End If
35 End Sub
36
37 ''' <summary>
38 ''' The SldWorks swApp variable is pre-assigned for you.
39 ''' </summary>
40 Public swApp As SldWorks
41
42
43 End Class