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

Open DXF file in Illustrator without dialog box

Explorer ,
Mar 04, 2019 Mar 04, 2019

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
1.8K
Translate
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

Community Expert , Mar 05, 2019 Mar 05, 2019

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;

 

...
Translate
Adobe
People's Champ ,
Mar 04, 2019 Mar 04, 2019

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;

Translate
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

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

Translate
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
Community Expert ,
Mar 05, 2019 Mar 05, 2019
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;

Translate
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