Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
CCarreiras
621 Views, 9 Replies

Exporting DWG Sheets to DXF (name starting with an extra underscore !?!)

HI!

 

I use the code below to export any DWG sheet to the respective DXF files.

(It uses a ini file with the dxf definitions. All the files are in attach to try them)


The DXF files will get the sheet name, but it add a prefix undercore, ex:
The dxf will be:

 

_Sheet_1.dxf      instead of        Sheet_1.dxf

 

I would like to remove the initial underscore, i don't even understand why it appears.
Some help, please!! Thank you!

' 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 = ThisDoc.WorkspacePath() & "\INI_FILES\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
SavePath=ThisDoc.WorkspacePath()&"\Z_CUT\"
oDataMedium.FileName = SavePath &".dxf"
'Publish document.
DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

 

CCarreiras

EESignature