• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Export file as a DXF

Participant ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

My script is working nice until I try to export my document. I am trying to export my document as a DXF file.  Using the Illustrator CS6 Scripting Reference I am using the TIFF export as a reference as there are no examples for exporting as a DXF (my luck!).  This is what I have in VBscript.  With this script I get the following error on the second to last line:

"Illegal argument - argument 2 - Enumerated value expected"

As you can see I do have one: "0" so I suspect the error lies elsewhere in the code?  I'll take a JavaScript example if you are not into VBscript since the two look very similar and I think I can adapt it.

Set App = CreateObject("Illustrator.Application")

Set FSO = CreateObject("Scripting.FileSystemObject")

Dim dest

dest = "S:\SOCAL\Section_32\Veg DXFs LC\SOCAL_CK67_pineLC"

Set DXFexport = CreateObject("Illustrator.ExportOptionsAutoCAD")

    If App.Documents.Count > 0 Then

        Set docRef = App.ActiveDocument

        Call docRef.Export (dest, 0, DXFexport)      ' 0 = aiDXF

    End If

TOPICS
Scripting

Views

4.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Aug 05, 2017 Aug 05, 2017

Got this to work for me:

Set App = CreateObject("Illustrator.Application")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set SourceFolder = FSO.GetFolder("full path to your source folder")
Dim destFolder : destFolder = "full path to your destination folder"

Dim docRef


     If App.Documents.Count > 0 Then
           destFile = destFolder + "\your filename.dxf"
           Set docRef = App.ActiveDocument
           Set dxfExport = CreateObject("Illustrator.ExportOptionsAutoCAD")
           dxfExport.E

...

Votes

Translate

Translate
Adobe
Valorous Hero ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

At least in JS, when it talks about enumerated values, it expects something like: TheObject.THEVALUE.

In your case it would be looking for the "ExportType" enumerated object.

Its values as described in OMV are:

ExportType.AUTOCAD

ExportType.FLASJH

ExportType.GIF

ExportType.JPEG

ExportType.PHOTOSHOP

ExportType.PNG24

ExportType.PNG8

ExportType.SVG

ExportType.TIFF

ExportType.WOSVG

Looks like DXF is not in the export options at all!

But, in the app's ui export dialog, there's options for AutoCAD DWG and AutoCAD DXF files.

However, in the ExportOptionsAutoCAD object, there's the 'exportFileFormat' which lets you choose between the DXF and DWG formats.


Try to use whatever the VB equivalent of ExportType.AUTOCAD is with the appropriate properties set in the ExportOptionsAutoCAD object.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 05, 2017 Aug 05, 2017

Copy link to clipboard

Copied

LATEST

Got this to work for me:

Set App = CreateObject("Illustrator.Application")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set SourceFolder = FSO.GetFolder("full path to your source folder")
Dim destFolder : destFolder = "full path to your destination folder"

Dim docRef


     If App.Documents.Count > 0 Then
           destFile = destFolder + "\your filename.dxf"
           Set docRef = App.ActiveDocument
           Set dxfExport = CreateObject("Illustrator.ExportOptionsAutoCAD")
           dxfExport.ExportFileFormat = 0           ' 0 = aiDXF
           docRef.Export dFile, 8, DXFexport
     End If

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines