标签:
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 11 Dim swDoc As ModelDoc2 = Nothing 12 Dim swPart As PartDoc = Nothing 13 Dim swDrawing As DrawingDoc = Nothing 14 Dim swAssembly As AssemblyDoc = Nothing 15 Dim boolstatus As Boolean = false 16 Dim longstatus As Integer = 0 17 Dim longwarnings As Integer = 0 18 swDoc = CType(swApp.ActiveDoc,ModelDoc2) 19 boolstatus = swDoc.Extension.SelectByID2("AIR_UP_SKETCH", "SKETCH", 0, 0, 0, False, 0, Nothing, 0) 20 swDoc.EditSketch() 21 swDoc.ClearSelection2(True) 22 23 Dim theSketch As Sketch 24 theSketch = swDoc.GetActiveSketch2 25 Dim vSketchSeg As Object 26 vSketchSeg = theSketch.GetSketchSegments 27 Dim swSketchSeg As SketchSegment 28 Dim k = 0 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 36 37 38 End Sub 39 40 ‘‘‘ <summary> 41 ‘‘‘ The SldWorks swApp variable is pre-assigned for you. 42 ‘‘‘ </summary> 43 Public swApp As SldWorks 44 45 46 End Class
solidworks二次开发学习(1)如何选中一个草图并遍历草图中的所有直线
标签:
原文地址:http://www.cnblogs.com/frankwu2014/p/4343652.html