AnsweredAssumed Answered

Macro Used to Save a file .IGES with Coordinate System

Question asked by Andre Faria on Nov 8, 2019

Hi guys! I hope someone can help me! I have this code below, that is used to save a part as .IGES file with cordinate system. My problem at the moment is that when i get the IGES file, the macro can't return the part name, it always return the name "Default", instead of the real part name. I hope someone can help me.

 

I adapted the code to my needs. The possible creator of this code is in this forum (API/Macro Batch Save as .SAT using Coordinate System )

 

Thanks and best regards,

André Faria

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

 

Option Explicit

Dim swApp As SldWorks.SldWorks

Dim Model As ModelDoc2

Dim LongStatus As Long

Sub main()

Set swApp = Application.SldWorks
Set Model = swApp.ActiveDoc
Dim ConfigMgr As ConfigurationManager
Dim C1a As Configuration
Dim SelMgr As SelectionMgr
Set SelMgr = Model.SelectionManager
Set ConfigMgr = Model.ConfigurationManager

Model.ShowConfiguration2 ("Default")

Set C1a = Model.GetActiveConfiguration

Dim V As Variant

V = swApp.GetConfigurationNames(Model.GetPathName)

Dim i As Long

Debug.Print "Names of configurations in part:"

Dim Folder As String

Folder = InputBox("Please enter the path to the folder where you want to store the .IGES files", ".IGES Configuration Export File", "C:\Users\andrefaria\Desktop")

For i = 0 To UBound(V)

Debug.Print " " & V(i)

Model.ShowConfiguration2 (V(i))

Model.Extension.SetUserPreferenceString swFileSaveAsCoordinateSystem, 0, "Coordinate System1"

LongStatus = Model.SaveAs3(Folder & "\" & V(i) & ".IGS", 0, 0)

Next

End Sub

Outcomes