Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch DXF export

Status
Not open for further replies.

Goof2014

Automotive
Joined
Dec 5, 2013
Messages
9
Location
DE
Hello together,

I found the following journal:


But I could not get it running in NX 9.0.

I recorded the following journal. How could I modify it to batch export a complete folder with files?

Code:
' NX 9.0.1.3
Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String) 

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work

Dim displayPart As Part = theSession.Parts.Display

' ----------------------------------------------
'   Menu: Orient View->Front
' ----------------------------------------------
workPart.ModelingViews.WorkView.Orient(View.Canned.Front, View.ScaleAdjustment.Current)

' ----------------------------------------------
'   Menu: View->Operation->Fit
' ----------------------------------------------
workPart.ModelingViews.WorkView.Fit()

' ----------------------------------------------
'   Menu: File->Export->AutoCAD DXF/DWG...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")

Dim dxfdwgCreator1 As DxfdwgCreator
dxfdwgCreator1 = theSession.DexManager.CreateDxfdwgCreator()

dxfdwgCreator1.ExportData = DxfdwgCreator.ExportDataOption.Drawing

dxfdwgCreator1.AutoCADRevision = DxfdwgCreator.AutoCADRevisionOptions.R2004

dxfdwgCreator1.ViewEditMode = True

dxfdwgCreator1.FlattenAssembly = True

dxfdwgCreator1.SettingsFile = "C:\Program Files\Siemens\NX 9.0\DXFDWG\dxfdwg.def"

dxfdwgCreator1.OutputFile = "C:\Temp\Test_01.dxf"

dxfdwgCreator1.ExportData = DxfdwgCreator.ExportDataOption.Modeling

dxfdwgCreator1.ObjectTypes.Curves = True

dxfdwgCreator1.ObjectTypes.Annotations = True

dxfdwgCreator1.ObjectTypes.Structures = True

dxfdwgCreator1.FlattenAssembly = False

dxfdwgCreator1.InputFile = "C:\Temp\Test_01.prt"

theSession.SetUndoMarkName(markId1, "AutoCAD DXF/DWG Export Wizard  Dialog")

' ----------------------------------------------
'   Dialog Begin AutoCAD DXF/DWG Export Wizard 
' ----------------------------------------------

Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "AutoCAD DXF/DWG Export Wizard ")

theSession.DeleteUndoMark(markId2, Nothing)

Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "AutoCAD DXF/DWG Export Wizard ")

dxfdwgCreator1.TextFontMappingFile = "C:\Users\User\AppData\Local\Temp\User16C4C08573fr.txt"

dxfdwgCreator1.WidthFactorMode = DxfdwgCreator.WidthfactorMethodOptions.AutomaticCalculation

dxfdwgCreator1.CrossHatchMappingFile = "C:\Users\User\AppData\Local\Temp\User16C4C08573fs.txt"

dxfdwgCreator1.LineFontMappingFile = "C:\Users\User\AppData\Local\Temp\User16C4C08573ft.txt"

dxfdwgCreator1.LayerMask = "1-256"

dxfdwgCreator1.ViewList = "Left"

Dim nXObject1 As NXObject
nXObject1 = dxfdwgCreator1.Commit()

theSession.DeleteUndoMark(markId3, Nothing)

theSession.SetUndoMarkName(markId1, "AutoCAD DXF/DWG Export Wizard ")

dxfdwgCreator1.Destroy()

End Sub
End Module

Thank you very much

Goof

Siemens NX 8.5 / 9.0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top