Publishing DWG models

Correctly geolocated iModels can provide additional benefits to a model coordination workflow. Not only can the background map provide more context to the model, measuring coordinates and sharing this information can be valuable for model review tasks.
To take advantage of an iModel’s capability to work in a multidisciplinary environment and with various other source files and formats, it is important to correctly align DWG models.

A DWG file may be connected to an iModel using one of the following iTwin Connectors: AutoCAD, AutoPlant, and Civil 3D. 

Please see the following sections for advice which best describes your geolocation issues. If in doubt, please also consider communicating with the author of the model files. It is also advised to adhere to Autodesk’s recommended best practices.

Ballot box Share your feedback and vote on which data types or formats we should document next here.

Types of Coordinate Systems in DWG

There are two different geolocation types in AutoCAD-based products;

  • Use of local coordinate system
  • Use of a defined Geographical Coordinate System (GCS)

To properly position DWG files, they need to have the GCS defined. Currently, a GCS created using local coordinate system is not supported, and there could be cases where the results might be spatially misaligned after successfully connecting such a DWG file to an iModel. 

Differences in design applications:

  • In AutoCAD, a GCS can only be created using a local coordinate system. In this workflow, a GCS is placed at a given point in the model coordinate system. This process may be compared to attaching a raster file as a background image.
  • In AutoCAD MAP 3D or AutoCAD Civil 3D, a GCS can be created using a geographical coordinate system. In this workflow, a GCS is assigned to a model, effectively making the model in the same geographical coordinate system.

Thus, Civil 3D and MAP 3D, but not AutoCAD, are recommended for GCS creation in a DWG file, which will be used to geolocate an iModel.

Working with GCS in DWG models

Assign a GCS in AutoCAD Civil 3D or AutoCAD MAP 3D

Civil 3D or MAP 3D could be used to create a GCS in a DWG file. They both have a command MAPCSASSIGN used to assign required GCS to the DWG file. Keep in mind that the library's appearance or content may change from one product version to another, but the command shall hopefully remain the same.

Image 1 - Example of GCS library invoked by MAPCSASSIGN

 

There is a different way of setting a GCS in Civil 3D. If you are a C3D user and prefer using its TOOLSPACE, you have this alternative:

  1. Select the "Settings" tab in TOOLSPACE
  2. Right mouse click on the file name
  3. Select "Edit Drawing Settings"
  4. Set options as appropriate in Drawing Settings

Image 2 - Example of Drawing Settings dialog in Civil 3D

Replace existing Geographical Coordinate System

A GCS created in plain AutoCAD does not work for iTwin as the model may not be in the geographical coordinate system.  In this, the GCS may be replaced in Civil 3D:

  1. Open the source DWG file in Civil 3D
  2. Invoke command GEOREMOVE
  3. Accept the prompt to delete existing GCS
  4. Create a new GCS by following the steps outlined in the above section Assign a GCS.
  5. Invoke command GEOMAP to check if the new GCS is against the model.
  6. If the model is not aligned with the new GCS, re-align it.
  7. Save the file.

Set correct model units

DWG is a unitless file format. A product can handle and manage units differently from another.  The same applies to DWG based connectors.

Civil3d Connector

The product Civil 3D manages units through Drawing Settings (Image 3), which can be brought from “Settings” tab in TOOLSPACE.  At the top left of the dialog box is “Drawing units”, where the correct units must be set.
 


Image 3 - Drawing units in Drawing Settings dialog in Civil 3D
 

Drawing units shown above are used in iTwin through Civil3d connector.

AutoCAD and AutoPLANT Connectors

If a DWG file has a GCS that is supported by a DWG connector (refer to above “Types of Coordinate Systems in DWG”),  and the GCS has a linear units defined, its units are used by AutoCAD connector.

If a file does not have a GCS, or it has a GCS but the GCS does not have linear units defined, the connector determines file units in the following order:

  • When system variable INSUNITS is set to real-world units, the units will be used for iTwin.

  • When INSUNITS is set to Unitless, but system variable is set to Architectural or Engineering, International Inches will be used.

  • When none of above information is available, Meters will be assumed.

Setting correct units in a source DWG file will ensure you get the correct units in iTwin. This includes externally attached reference files (xReference).  Particularly, if an xReference is a Civil3d model connected by a Civil3d connector, iTwin Civil tools, and other apps depend on the correct units to work correctly.

Geolocation methods

The following sections describe how to best configure DWG models to achieve perfect geospatial alignment.

Using a MicroStation geolocation file to synchronize DWG

MicroStation can work with several built-in geographical coordinate systems (GCS). Using a DGN as a geolocation file for DWG models can be useful when:

  • DWG is using local coordinate system
  • DWG can not be modified in any way
  • Precise latitude and longitude values are unknown

Connecting model files

Regardless of the synchronization method chosen for connecting model files, always ensure that:

  • The DGN file is connected first and is selected as the file defining the geocoordinate system – ideally within its own connection.
  • The geolocation file is not modified, and is used for each new iModel.
  • The geolocation file only needs to be synchronized once.
  • The GCS cannot be changed once connected. Updating the GCS will require a new iModel to be created.

In this setup, it may be a good idea to check if a DWG file matches the DGN file before adding the DWG file to the iModel connection. 

A recommended check may be done in MicroStation:

  1. Open the first DGN file as a master file in MicroStation.
  2. Attach the to-be-added DWG file as a reference file.
    • In Reference Manager, ensure that the Coincident view, i.e., "Align With the Master File," is selected for this attachment.
  3. If the DWG file looks correct against the DGN file, the DWG file may be added to the iModel connection as an independent model connected by a DWG connector.
  4. If the DWG file is not aligned correctly in MicroStation, there are two options:
    • Keep the DWG file as a reference attachment in the DGN file, and align the attachment to the master file, then let a DGN based connector publish the DGN file along with the DWG reference file to the iModel, or
    • Open the DWG file in the product in which the file was created, move the model to the correct location, repeat the above steps to check the DWG file again, then publish the file with a DWG connector.

Using a DWG as a geolocation file

When a DWG file has a valid GCS that uses a geographical coordinate system, as opposed to a local coordinate system, it may be used for the geolocation of an iModel. Other files added to the iModel connection will use the first DWG file's GCS. If an added file is a DGN or another DWG file, checking the model alignment before starting a new connection is a good idea.

Validating model alignment

If a to-be-added file is DWG, it can be checked in either Civil 3D or MAP 3D:

  1. Open the first DWG file in Civil 3D or MAP 3D
  2. Attach the to-be-added DWG file as an xReference file at the world origin 0,0,0.
  3. If the two files are aligned correctly, they can be independently connected to the iModel, where the two models shall also be aligned correctly.
  4. If they are not aligned correctly in Civil 3D or MAP 3D, there are two options:
    • Keep the to-be-added DWG file as an xReference file in the master DWG file, align the xReference attachment to the master file, then let the DWG connector publish the master file along with the attached xReference file, or
    • Open the to-be-added DWG file in the product in which the file was created, move the model to the correct location, repeat the above steps until the two models are aligned, and then add the modified DWG file to the iModel connection such that the file may be published independently.

   

If a to-be-added file is DGN, the file can be checked in MicroStation:

  1. Open the first DWG file as a master file in MicroStation.
  2. Attach the DGN file using Reference Manager.
    • If the Reference Manager has a Geographic view available, select that view to project the DGN model to the DWG's GCS,
    • Otherwise, select view Coincident, i.e., "Align With the Master File."
  3. If the DGN file looks correct against the first DWG file, a DGN-based connector may be used to connect the DGN file to the iModel
  4. If the two files are not aligned correctly, open the DGN in MicroStation, move the model to the correct location, and repeat the above steps until they are aligned.

Recommended
Related