Try this code-from an assembly, saves all the individual parts to IGS
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
Set swApp = Application.SldWorks
Set SWMODEL = swApp.ActiveDoc
Set Swassm = SWMODEL
fileloc = Left(SWMODEL.GetPathName, Len(SWMODEL.GetPathName) - Len(SWMODEL.GetTitle))
Vcomps = Swassm.GetComponents(False)
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 fileloc + Filename + "igs", 0, 0, swExportPDFData, lErrors, lWarnings
This would also save subassemblies too.
This is saving off igs named as each detail, but it contains the entire assembly, not only the individual details.
Am i doing something wrong? I have the assembly open and I'm running this from there.
All the file sizes are the same size as well.
Sorry to resurrect an older thread.
I just read the active model requirement in the API manual, good timing!
After adjusting some of my igs export preference, It's saving the igs to my desktop and those appear to be fine... but the target folder we're pulling in 'fileloc' and referencing in 'saveas' is correct, and is NOT my desktop. I'm not sure why it's dumping there.
In my target folder I'm getting 94KB file for each igs being generated... not sure what those are or what they do.
Target Folder Random Files
Desktop with working igs