在solidworks装配体中更改一个子装配体或零件的Configuration的方法

Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System

Partial Class SolidWorksMacro

    Public Sub main()

            Dim swDoc As ModelDoc2 = Nothing
            Dim swPart As PartDoc = Nothing
            Dim swDrawing As DrawingDoc = Nothing
            Dim swAssembly As AssemblyDoc = Nothing
            Dim boolstatus As Boolean = false
            Dim longstatus As Integer = 0
            Dim longwarnings As Integer = 0
            swDoc = CType(swApp.ActiveDoc,ModelDoc2)
        boolstatus = swDoc.Extension.SelectByID2("tam22ncc_topasm-1@tam22n", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
        swDoc.CompConfigProperties4(2, 0, True, True, "TA22NCCNN00ND30", False) '更改装配体中零件的配置
        swDoc.ClearSelection2(True)

    End Sub

    ''' 
    ''' The SldWorks swApp variable is pre-assigned for you.
    ''' 
    Public swApp As SldWorks


End Class

你可能感兴趣的:(API)