CAD Tutorial

From OpenJUMP Wiki
Jump to navigation Jump to search

back to Index page

Autocad format DWG and DXF represent an important standard in many technical public and private office. Autocad software still remains the best CAD drawing available, despite the cost and the limitation for public DWG format. QCAD comunity edition represent a valid opensource alternative to Autocad for GIS needs. The aim of this tutorial is to help users who have to work with Autocad files in a GIS project using OpenJUMP.

There are basically two situation which requires the usage of CAD drawings: 1) import in a project aereophotogrammetric drawing (already georeferenced) or 2) import in a project tecnical drawing produced by engeneers and architect or derived from vectorialized raster images. Most of these cad drawings are not georeferenced.

Import aereophotogrammetric topographic drawings

Aerophotogrammetric DWG drawings are still diffused by many public offices (for instance, in Italy) despite many Public Recomandation to use open public file format(see for EU [ Symposium on use of Open Source Software in EU public administrations]. You must use different procedure whether you want to import DWG or DXF in OpenJUMP.

  • DWG OpenJUMP cannot import DWG files. Standard jython libraries for opening DWG are not used by OpenJUMP while available in other Java GIS software (Kosmo and GvSIG). Nevertheless even importing a DWG drawing or more in a Java software could become a stressfull action since those libraries are still slow and need more developing strategy. The best way to import a DWG file in OpenJUMP is to export it in DXF format using external software.
    • Lx-Viewer is an open source dxf/dwg viewer (Linux/Windows) which saves file to up to 2002 dwg/dxf version. You can use it to convert a DWG file to DXF.
    • EveryDWG file converter is a free Windows application that converts files back and forth between DWG and DXF formats (R9/2007) available as public download from Open Design Alliance. This software is based on the OpenDWG specification
  • DXF OpenJUMP can import DXF using DXF plugin which reads/writes dxf files from AutoCAD ver 8 to 14/2002. This DXF plugin has some limitations:
    • Supported entities are LINE, POINT, POLYLINE, POLYGON, TEXT and VERTEX
    • Enties which are imported as attributes: LAYER, LAYER TYPE, TEXT, TEXT_HEIGHT, TEXT_STYLE, COLOR
    • COLOR is just imported as an attribute (which cannot be used for styling)
    • TEXT object are imported as point geometries (with a TEXT and a TEXT_HEIGHT attribute).
    • Patterns and fill are not supported
    • hatch lines are imported as continuous lines

Some of the above limitations are usefull, especially if you may need to clean the original dxf in order to connect it to an external dababase or table

Other times you want to display the dxf in OpenJUMP "as it should be" in Autocad. Change Style and Label support can solve the problems connected to hatch and text, simply correcting (while changing style) the parametres of color and hatch.

There is a "quick strategy" which is usefull if users want to import a DXF file as a simple base (generally as a topographic base) for a project. This method requires the usage of a CAD software, like QCAD or AUTOCAD.

Note, another DXF reader plugin exists from Dante Fuster, see the Plugins for OpenJUMP wiki page and scroll down below

    1. Open the CAD file in DXF (already transformed using everyDWG converter).
    2. Freeze the layers you do not want to change (e.g. layers with lines or with closed polygons). Unfreeze the layers with HATCHES, PATTERNS and TEXT objects
    3. Explode the unfreeze elements. The EXPLODE command allows you to change a grouped item into its individual elements that can be edited.
    4. To EXPLODE elements in AUTOCAD you must: 1) click on the Explode button on the Draw toolbar or 2) type x or explode at a Command: prompt or 3) select Explode under the Modify Menu. Select the items you want to EXPLODE, and run.
    5. In QCAD, select the items anc click on the left toolbar EDIT and than EXPLODE commands
    6. HATCHES and PATTERNS objects will be exploded in the base lines.
    7. Save the file in DXF format
  • In OpenJUMP
    1. Open the DXF file in OpenJUMP.
    2. The DXF file is opened with the right objects (included HATCHES and PATTERNS) but with a neutral color
    3. if you select the file on Layer List and click on click on View Edit Attributes you will see different columns of attributes. Layer column represent the original layers of the DXF transformed in an attribute
    4. Click on Change Style and navigate to Colour Theming. Enable Colour Theming and check the attribute Layer. Select layer by layer yo set the corresponding colours to the original one from DXF (eventually use a comparative table, already set in OpenCALC).
    5. Click OK to see the result. It will look like it was the original CAD file opened in Autocad.

Save the file in JML format. Then save the project. JML format provides a smaller file which opens more quickly than DXF. Saving the project is also usefull to save the style which can be copied to other imported DXF files.

Import technical drawings

To import technical drawings from Architectural or engineering project basically follow the same rules as explained before. Since technical drawings are often non georeferenced, once imported in OpenJUMP, you can Warp the drawing in your project to the corresponding coordinates.

Sometimes it is usefull to vectorialized original raster images (ex. scanned images) and import them in an OpenJUMP Project. In this case the only step you want to do is to warp the image.

Export a layer to Autocad and Dante Fuster's DXF Plugin

DXF Plugin can also export a layer to a DXF Autocad file. This is usefull if you want to export a GIS project in a Professional CAD project. DXF driver plugin can only export objects on a unique layer. Dante Fuster developed a plugin which can export a SHP or other spatial file format to DXF with advanced possibility (export layers, text, etc)

This plugin is formed by two files:

  1. The DXF plugin by Dante Fuster
  2. The CAFF DXF viewer by Rammi

This plugin can:

  • read closed polyline like polygon.
  • read blocks as drawing or as point
  • read blocks with text in 2 features (point for text and point feature)
  • Read blocks (with polylines and text)
  • Read and insert blocks with Z Elevation
  • Write DXF (all features in one layer)
  • Write DXF (all features in defferents layer according to a "Layer" attribute)

Dante's plugin allows to export to DXF saving the features in different layers. Also TEXT, TEXT HEIGHT and TEXT ANGLE can be exported to DXF. This is possible if the original file contains defined attributes which can be read by the plugin and exported to CAD object/elemets. This is the Schema:

Layer           String           layer
Text            String           text
RotationText    Double           rotation text angle
HeightText      Double           text Height

back to Index page