Export igs

Hello

I'm trying save in IGS the selected object that i already have in a taglist

Till now i found that i can save all i have in IGS with this code

partSaveStatus1 = workPart.SaveAs( exportFileName & ".igs")

How can i convert this code to export only the bodys that i have on a laglist?

Below is a subroutine that I have used to export certain, desired geometry out to an IGES file. It should work as a good starting point for your own code.

Sub IgesExport(ByVal exportFileName As String, ByVal theBodies As List(Of Body), ByVal theCurves As List(Of Curve), _
ByVal thePoints As List(Of Point), ByVal theCsys As List(Of CoordinateSystem))

Dim IgesSettingsFile As String = ""
'Get UG install directory using NXOpen API
Dim IGES_DIR As String = theSession.GetEnvironmentVariableValue("IGES_DIR")
IgesSettingsFile = IO.Path.Combine(IGES_DIR, "igesexport.def")
'lg.WriteLine("looking for IGES settings file: " & IgesSettingsFile)
'check if the IgesSettingsFile exists
If Not IO.File.Exists(IgesSettingsFile) Then
'file does not exist in default directory or user specified directory
'lg.WriteLine("The IGES settings file was not found in the specified location: " & IgesSettingsFile)
MsgBox("The IGES settings file (igesexport.def) was not found." & vbCrLf & _
"IGES file export will be skipped.", vbOKOnly + vbExclamation, "Warning")
Return
End If

'does file exist? if so, try to delete it (overwrite)
Try
DeleteFile(exportFileName)
Catch ex As Exception
'file delete failed
MsgBox("IGES file overwrite failed")
'exit subroutine
Return
End Try

Dim igesCreator1 As IgesCreator
igesCreator1 = theSession.DexManager.CreateIgesCreator()

Try
With igesCreator1
.SettingsFile = IgesSettingsFile
.ExportModelData = True
.ExportDrawings = False
.MapTabCylToBSurf = True
.BcurveTol = 0.002
.IdenticalPointResolution = 0.00004
.ObjectTypes.Curves = True
.ObjectTypes.Surfaces = True
.ObjectTypes.Solids = True
.ObjectTypes.Csys = True
'.ObjectTypes.Annotations = True
'.ObjectTypes.Structures = True
.FileSaveFlag = False
.LayerMask = "1-256"
.ViewList = "Top,Front,Right,Back,Bottom,Left,Isometric,Trimetric,User Defined"
.SysDefmaxThreeDMdlSpace = True
.SysDefidenticalPointResolution = True
.ExportSelectionBlock.SelectionScope = ObjectSelector.Scope.SelectedObjects

.InputFile = displayPart.FullPath
.OutputFile = exportFileName

Dim added1 As Boolean
added1 = .ExportSelectionBlock.SelectionComp.Add(theBodies.ToArray)

Dim added2 As Boolean
added2 = .ExportSelectionBlock.SelectionComp.Add(theCurves.ToArray)

Dim added3 As Boolean
added3 = .ExportSelectionBlock.SelectionComp.Add(thePoints.ToArray)

Dim added4 As Boolean
added4 = .ExportSelectionBlock.SelectionComp.Add(theCsys.ToArray)

End With

Dim nXObject1 As NXObject
nXObject1 = igesCreator1.Commit()

Catch ex As Exception
MsgBox("Error: " & ex.Message, vbOKOnly + vbCritical, "Error")
Return
Finally
igesCreator1.Destroy()

End Try

End Sub

Now i will try convert your code to what i need.

Thank you