Message 1 of 3
DXF export filename without sheet name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have a script that renames each sheet name to the below format. My issue is that when a drawing is exported to DXF, this sheet name is automatically tagged on to the end of each dxf sheet file name. (Often long descriptions will make the filename too long to open in other programs).
Is there a way to revert back to having just the sequential sheet number for the DXF filenames only?
Below is the script I use for exporting to DXF
' Get the DXF translator Add-In. Dim DXFAddIn As TranslatorAddIn DXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}") 'Set a reference to the active document (the document to be published). Dim oDocument As Document oDocument = ThisApplication.ActiveDocument Dim oContext As TranslationContext oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism ' Create a NameValueMap object Dim oOptions As NameValueMap oOptions = ThisApplication.TransientObjects.CreateNameValueMap ' Create a DataMedium object Dim oDataMedium As DataMedium oDataMedium = ThisApplication.TransientObjects.CreateDataMedium ' Check whether the translator has 'SaveCopyAs' options If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then Dim strIniFile As String strIniFile = "C:\temp\dxfout.ini" ' Create the name-value that specifies the ini file to use. oOptions.Value("Export_Acad_IniFile") = strIniFile End If 'Set the destination file name Dim IPJ As String Dim IPJ_Name As String Dim IPJ_Path As String Dim FNamePos As Long IPJ = ThisApplication.FileLocations.FileLocationsFile FNamePos = InStrRev(IPJ, "\", -1) IPJ_Name = Right(IPJ, Len(IPJ) - FNamePos) IPJ_Folder_Location = Left(IPJ, Len(IPJ) -Len(IPJ_Name)) 'Sets the Dirctory that the PDF should be saved in DXFPath = IPJ_Folder_Location & "DXF" & "\" & ThisDoc.FileName(False) & "-rev" & iProperties.Value("Project", "Revision Number") DXFName = DXFPath & "\" & ThisDoc.FileName(False) & "-rev" & iProperties.Value("Project", "Revision Number") & ".dxf" 'Set the DXF target file name oDataMedium.FileName = DXFName MessageBox.Show(DXFName, "Title") 'Checks to see if that directory exists, if not, it is created If(Not System.IO.Directory.Exists(DXFPath)) Then System.IO.Directory.CreateDirectory(DXFPath) End If oDataMedium.FileName = DXFName 'same folder, or uncomment: 'oDataMedium.FileName = "C:\myDXFfolder\" & ThisDoc.FileName(False) & ".dxf" 'fixed folder 'Publish document. DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) 'Launch the dxf file in whatever application Windows is set to open this document type with i = MessageBox.Show("Preview the DXF file?", "Title",MessageBoxButtons.YesNo,MessageBoxIcon.Question) If i = vbYes Then ThisDoc.Launch(oDataMedium.FileName)