您的位置:首页 > 其它

solidworks二次开发学习(2)如何选中一个草图并遍历草图中的所有直线(非草图编辑状态)

2015-03-17 10:18 411 查看
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System

Partial Class SolidWorksMacro

Public Sub main()

Dim swSelMgr As SelectionMgr
Dim swDoc As ModelDoc2 = Nothing
Dim swPart As PartDoc = Nothing
Dim boolstatus As Boolean = False
Dim longstatus As Integer = 0
Dim swSketch As Sketch
Dim swFeat As Feature
Dim vSketchSeg As Object
Dim swSketchSeg As SketchSegment
Dim k As Integer = 0

swDoc = CType(swApp.ActiveDoc, ModelDoc2)
boolstatus = swDoc.Extension.SelectByID2("AIR_LOW_SKETCH", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
swDoc = swApp.ActiveDoc
swSelMgr = swDoc.SelectionManager
swFeat = swSelMgr.GetSelectedObject6(1, 0)
swSketch = swFeat.GetSpecificFeature2
swDoc.ClearSelection2(True)
vSketchSeg = swSketch.GetSketchSegments
If Not IsNothing(vSketchSeg) Then
For k = 0 To UBound(vSketchSeg)
swSketchSeg = vSketchSeg(k)
swSketchSeg.SelectByMark(True, 0)
Next k
End If
End Sub

''' <summary>
''' The SldWorks swApp variable is pre-assigned for you.
''' </summary>
Public swApp As SldWorks

End Class
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐