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


     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
  • 相关阅读:
    链表 | 递归删除不带头结点链表所有x元素
    A1016 | 磨人的大模拟
    Ubuntu 下安装 Qt Designer
    shell札记
    A1102 | 反转二叉树
    顺序表 | 二分查找:两个数组合并后的中位数
    A1113 | Integer Set Partition (25)
    A1128 | 逻辑想象能力、简洁高效美观的代码、memset的使用情景
    05.字符串
    04.序列的应用
  • 原文地址:https://www.cnblogs.com/frankwu2014/p/4343710.html
Copyright © 2020-2023  润新知