Open DXF file in Illustrator without dialog box

Explorer ,
Mar 04, 2019 Mar 04, 2019

Copy link to clipboard

Copied

Hi, I'm trying to open a DXF with a extendScript in Illustrator without having a dialog box .

this is my script. Illustrator opens the file. But the dialog-box is presented. None of the open options are taken into account. Any Help?

var optRef = new OpenOptions();

            optRef.centerArtwork=true;

            optRef.globalScaleOption=AutoCADGlobalScaleOption.OriginalSize;

            optRef.globalScalePercent=100.0;

            optRef.mergeLayers=false;

            optRef.scaleLineweights=false;

            optRef.selectedLayoutName="Model";

            optRef.unit=AutoCADUnit.Millimeters;

            optRef.unitScaleRatio=1.0;

var testDocument = app.open(File('//mac-server-2/JOBS/2019/1902000/1902785/CAD/19AF0325_0201_450x320x140.dxf'), DocumentColorSpace.RGB, optRef);

TOPICS
Scripting

Views

932

Likes

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

Adobe Community Professional , Mar 05, 2019 Mar 05, 2019
your syntax is incorrect, use openOptions as followsapp.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;var optRef = app.preferences.AutoCADFileOptions;             optRef.centerArtwork=true;             optRef.globalScaleOption=AutoCADGlobalScaleOption.ScaleByValue;             optRef.globalScalePercent=100.0;             optRef.mergeLayers=false;             optRef.scaleLineweights=false;             optRef.selectedLayoutName="Model";             optRef.unit=AutoCADUnit.Inches;  ...

Likes

Translate

Translate
Valorous Hero ,
Mar 04, 2019 Mar 04, 2019

Copy link to clipboard

Copied

Not sure you can get rid of it. Just tried adding a non display alerts user interaction level and got an error.

var optRef = new OpenOptions(); 

   optRef.centerArtwork=true

   optRef.globalScaleOption=AutoCADGlobalScaleOption.OriginalSize

   optRef.globalScalePercent=100.0

   optRef.mergeLayers=false

   optRef.scaleLineweights=false

   optRef.selectedLayoutName="Model"

   optRef.unit=AutoCADUnit.Millimeters

   optRef.unitScaleRatio=1.0

 

var uil = app.userInteractionLevel;

try {

   app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

   var testDocument = app.open(File('/path/to/tutu.dxf'), DocumentColorSpace.RGB, optRef); 

}

catch(err) {}

app.userInteractionLevel = uil;

Likes

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
Explorer ,
Mar 04, 2019 Mar 04, 2019

Copy link to clipboard

Copied

The dialog is gone. BUT non of the OpenOptions is taken into account.

My DXF file has 3 LayoutNames. But the layout "Model" is never opend.

Bildschirmfoto 2019-03-04 um 15.27.01.png

Likes

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
Adobe Community Professional ,
Mar 05, 2019 Mar 05, 2019

Copy link to clipboard

Copied

LATEST

your syntax is incorrect, use openOptions as follows

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

var optRef = app.preferences.AutoCADFileOptions;

            optRef.centerArtwork=true;

            optRef.globalScaleOption=AutoCADGlobalScaleOption.ScaleByValue;

            optRef.globalScalePercent=100.0;

            optRef.mergeLayers=false;

            optRef.scaleLineweights=false;

            optRef.selectedLayoutName="Model";

            optRef.unit=AutoCADUnit.Inches;

            optRef.unitScaleRatio=1;

var testDocument = app.open(File('c:/temp/autocadOpenTest.dxf'), DocumentColorSpace.RGB);

app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS;

Likes

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