zoukankan      html  css  js  c++  java
  • solidworks二次开发学习(1)如何选中一个草图并遍历草图中的所有直线

     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
  • 相关阅读:
    图解测试之稳定性-如何开始稳定性测试
    系统稳定性保障
    系统稳定性评测
    分布式架构的架构稳定性
    app测试--稳定性测试
    服务器稳定性测试方法汇总
    服务端稳定性测试
    发票问题
    android x86 固件定制
    Nim游戏博弈(收集完全版)
  • 原文地址:https://www.cnblogs.com/frankwu2014/p/4343652.html
Copyright © 2011-2022 走看看