- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I have combined several scripts in here and have read most of the scripts regarding the flat pattern.
My goal was to create a script so that it can export 2 identical dxfs to two separate defined by me, folder locations.
In first place i wanted to export from the drawing environment the flat pattern in dxf but unfortunately it didn't worked out.
Then i made the script bellow which works very good in sheet metal enviroment except from the fact that the generated dxf,s are empty inside and i get an error message. See attached dxf.
Anyone has a clue why this is happening? Thanks a lot in advance.
This is what shows up when i open the dxf file.
And this is what shows when i put it on autodesk viewer
Sub Main() 'query user question = MessageBox.Show(" create DXF?", "attention",MessageBoxButtons.YesNo,MessageBoxIcon.Question) 'set condition based on answer If question = vbYes Then ' Get the DXF translator Add-In. path_and_nameDXF = ThisDoc.PathAndFileName(False) 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 oDataMedium3 As DataMedium oDataMedium3 = ThisApplication.TransientObjects.CreateDataMedium ' Create a DataMedium object Dim oDataMedium4 As DataMedium oDataMedium4 = ThisApplication.TransientObjects.CreateDataMedium If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then Dim strIniFile As String strIniFile = "C:\Work\DXF_EXPORT.ini" oOptions.Value("Export_Acad_IniFile") = strIniFile End If 'Set the destination file name oDataMedium3.FileName = "C:\Users\KTrifonidisNyfan\Documents\NyfanDXF\" & (Left(ThisDoc.FileName(False), 11)) & ".DXF" oDataMedium4.FileName = "C:\Users\KTrifonidisNyfan\Documents\NyfanDXF2\" & (Left(ThisDoc.FileName(False), 11)) & ".DXF" On Error GoTo handleDXFLock 'Publish document. Call DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium3) Call DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium4) 'Show message box MessageBox.Show("dxfs are ready at C:\Users\KTrifonidisNyfan\Documents\NyfanDXF and C:\Users\KTrifonidisNyfan\Documents\NyfanDXF2 ", "success !") End If Exit Sub handleDXFLock:MessageBox.Show("can't create dxf", "sorry " & ThisApplication.GeneralOptions.UserName & "!") Resume Next End Sub
Solved! Go to Solution.