the fair gds editor DWG
Please Sign in

DWG

DWG ("drawing") is a binary file format used for storing design data and metadata. It is the native format for several CAD packages including AutoCAD. The file format specification is not public available and so it is not natively supported by the LayoutEditor.

DWG in the LayoutEditor

With version 20150718 the LayoutEditor automatic triggers the TeighaFileConverter, if it is installed on your system. So DWG files can be loaded and stored as any other file format.

External Converter between DWG and DXF

Optional other converters can be used. e.g. there is a online converter from Autodesk https://www.autocadws.com/. Other converter can be integrated into the LayoutEditor by using macros. Here is an example for the TeighaFileConverter:

Attached are two macros using the TeighaFileConverter. To use it, install the converter and start the dwg-read.layout macro. The second marco had to be install in the same folder than the first macro. It will be called as soon the convertion had finished. Please adjust the version number of the TeighaFileConverter you have installed on your system.

Download:

dwg-read.layout

dwg-read-step2.layout

   1 #!/usr/bin/layout
   2 #name=DWG import
   3 #help=importing DWG file with th ehelp of an external converter
   4 
   5 string temp;
   6 
   7 
   8 
   9 int main(){
  10   layout->closeDesign(); // close, if a design is still open
  11   file f;
  12   string inPath=f.homePath()+"/DWG";
  13   string outPath=f.homePath();
  14   int res=layout->getBool("DWG read","Is the DWG file copied to \""+inPath+"/in.dwg\"?");
  15   if (res==0){
  16     stringList sl;
  17     sl.append(inPath);
  18     sl.append(outPath);
  19     sl.append("ACAD10");
  20     sl.append("DXF");
  21     sl.append("0");
  22     sl.append("0");
  23     bool b=process::externalTool("ODA/Teigha File Converter 3.5.0","TeighaFileConverter",sl,"DWG-read-step2.layout");
  24     if (!b) b=process::externalTool("ODA/Teigha File Converter 3.5.1","TeighaFileConverter",sl,"DWG-read-step2.layout");
  25     if (!b) b=process::externalTool("ODA/Teigha File Converter 3.5.2","TeighaFileConverter",sl,"DWG-read-step2.layout");
  26     if (!b) b=process::externalTool("ODA/Teigha File Converter 3.6.0","TeighaFileConverter",sl,"DWG-read-step2.layout");
  27     if (!b) layout->showMessage("Error","Convert software not found! Please download and install it:\nhttp://www.opendesign.com/guestfiles/TeighaFileConverter");
  28     return 0;
  29     }
  30 }

See also


CategoryMacro CategoryFileFormat CategoryFileFormatLayout


DWG (last edited 2017-03-06 21:20:26 by JurgenThies)