AnsweredAssumed Answered

Need clarification on the macro

Question asked by Kishore K. on Nov 20, 2019
Latest reply on Nov 25, 2019 by Kishore K.

Hi,

I got this macro from the forum and was not able to generate .Iges file from the assembly. Can some one help me to find out the error in macro.

 

This macro will helps me to generate the Iges format for individual parts from the assembly file.

 

Dim swApp As SldWorks.SldWorks

Dim SWMODEL As SldWorks.ModelDoc2

Dim Swassm As SldWorks.AssemblyDoc

Dim Swcomp As SldWorks.Component2

Dim Swcompmodel As SldWorks.ModelDoc2

Dim swExportPDFData As SldWorks.ExportPdfData

Dim Vcomps As Variant

Dim i As Integer

Dim lErrors As Long

Dim lWarnings As Long

Dim fileloc As String

Dim Filename As String

 

Sub main()

Set swApp = Application.SldWorks

Set SWMODEL = swApp.ActiveDoc

Set Swassm = SWMODEL

fileloc = Left(SWMODEL.GetPathName, Len(SWMODEL.GetPathName) - Len(SWMODEL.GetTitle))

Vcomps = Swassm.GetComponents(True)

For i = 0 To UBound(Vcomps)

Set Swcomp = Vcomps(i)

Set Swcompmodel = Swcomp.GetModelDoc2

Filename = Left(Swcompmodel.GetTitle, Len(Swcompmodel.GetTitle) - 6)

Swcompmodel.Extension.SaveAs Filename + "IGES", 0, 0, swExportPDFData, lErrors, lWarnings

Next

End Sub

 

Regards,

Kishore

Outcomes