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);
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;
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.
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;
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.
Copy link to clipboard
Copied
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;
Find more inspiration, events, and resources on the new Adobe Community
Explore Now