Skip to main content
Participating Frequently
May 19, 2013
Question

Import Dxf/Dwg with units

  • May 19, 2013
  • 1 reply
  • 1059 views

Hi,

Is it posibble import Dxf/Dwg with desired units?

Actually I need to do it silent, not with this dialog:

I need setup scaling factor and show in document.

In this code I can hide dialog, but can't setup. And also Ruller Units do not can scale imported document, it always scaled to Fit...

result = sAIActionManager->AINewActionParamValue(&fActionParamValueRef);
result = sAIActionManager->AIActionSetStringUS(fActionParamValueRef, kAINewDocumentNameKey, ai::UnicodeString(dwgFilePath.c_str()));
result = sAIActionManager->AIActionSetInteger(fActionParamValueRef, kAINewDocumentColorModelKey, kDocCMYKColor);
result = sAIActionManager->AIActionSetInteger(fActionParamValueRef, kAINewDocumentRulerUnitsKey, kADMInchUnits);
result = sAIActionManager->PlayActionEvent(kAIOpenDocumentAction, kDialogOff, fActionParamValueRef);

Also I've found AIDxfDwgPrefs.h header file, but I can't apply values for this prefs:

kDxfDwgDefaultImportGlobalScaleOption, kDxfDwgDefaultImportUnitScaleRatio etc.

Thanks!

This topic has been closed for replies.

1 reply

Participating Frequently
May 19, 2013

DXF and DWG code ( at least in the past ) did not have any settings for units. Having said that, if you know your DXF/DWG files are metric, and you wanted to scale to imperial, you should be able to import the file 1:1 scale, and then do a transformation of 1/25.4.

FonarixAuthor
Participating Frequently
May 19, 2013

Thank you ru73 for your answer,

Maybe you know, how to setup this option during import dxf/dwg?

From API reference "AutoCAD file filter preference" mentioned, but I can't imagine what is it and what exactly AI Suite to use...

Thnaks!

Participating Frequently
May 20, 2013

I do not know very much about the SDK. The link below is for the API.

http://cssdk.host.adobe.com/sdk/1.5/docs/WebHelp/references/csawlib/com/adobe/illustrator/AutoCADFileOptions.html

It mentions a variable

globalScalePercent:Number

Maybe that is a place to start.