hi :-)
I created a vb.net version of macro as in
My vb.net macro is not working but vba macro is working.
'-------------------------------------------------------------------------------------------
' VB.NET
' Preconditions: Part document is open and contains a solid body that has been split.
' Postconditions: C:\temp\p1.sldprt, C:\temp\p2.sldprt,C:\temp\p3.sldprt,
' and C:\temp\asm.sldasm are created.
'-------------------------------------------------------------------------------------------
Imports SolidWorks.Interop.sldworks
Partial Class SolidWorksMacro
Public swModel As ModelDoc2
Public swFeat As Feature
Public swFeatMgr As FeatureManager
Public swBodyFolder As BodyFolder
Public bodyListVar As Object
Public fileNames(2) As String
Public fileNameVar As Object
Public Sub main()
swModel = swApp.ActiveDoc
swFeat = swModel.FirstFeature
swFeatMgr = swModel.FeatureManager
Dim contLoop As Boolean = True
Dim Name As String
While Not swFeat Is Nothing And contLoop = True
Name = swFeat.GetTypeName2
If (Name = "SolidBodyFolder") Then
swBodyFolder = swFeat.GetSpecificFeature2
bodyListVar = swBodyFolder.GetBodies
contLoop = False
ElseIf (contLoop = True) Then
swFeat = swFeat.GetNextFeature
End If
End While
fileNames(0) = "C:\temp\p1.sldprt"
fileNames(1) = "C:\temp\p2.sldprt"
fileNames(2) = "C:\temp\p3.sldprt"
fileNameVar = fileNames
swFeatMgr.CreateSaveBodyFeature(bodyListVar, fileNameVar, "C:\temp\ass.sldasm", True, True)
End Sub
Public swApp As SldWorks
End Class
Message was edited by: Ar K
SolidworksApi macros