How to convert a CAD file to KML/KMZ with AutoCAD Map 3D

Want to use your CAD file in RatedPower? Here, you will learn how to convert it to the right format!

In case you are more familiar with CAD files when it comes to site definition, you will need to convert it to KML or KMZ format. This guide aims to explain how to successfully convert the CAD file (.DWG) by using AutoCAD MAP 3D.

If you don't have AutoCAD MAP 3D, you can follow this article on How to convert a CAD file to KML/KMZ using QGIS.

Step 1 - Conversion of polylines to polygons

  1. On the command line of AutoCAD Map 3D, set the PROXYGRAPHICS system variable to 0. Type the command PROXYGRAPHICS; press <ENTER>; set it to 0; press <ENTER> again.
  2. Next, on the command line, enter mappolylinetopolygon. Press <ENTER>.
  3. Select the polylines that you would like to convert and press <ENTER>.

If a polyline belongs to a group, only the first (outermost) polyline is converted.

 

image (4)-4

In addition, if you have Open polylines, you can use the command PEDIT and select 'Close' in order to close the polylines and then convert them to polygons using the mappolylinetopolygon command. 

In the case where there are Hatch boundaries, you will need to transform them first to polylines and then, to polygons. To do this conversion, follow these steps:

  1. Enter HATCHEDIT on the command line.
  2. Select the hatch.
  3. In the Hatch Edit dialog box, click Recreate Boundary.
  4. When you see the prompt "Enter type boundary object", enter P which stands for a polyline.
  5. When prompted, choose whether or not to associate the hatch with the new boundary.

Moreover, in the case of having Circle elements in your CAD file, you can convert them to polylines first using the BOUNDARY command:

  • In the boundary dialog box, make sure that the Object Type is set to Polyline.
  • Click the 'Pick Points' button and click inside the circle.
  • Press enter to get the circle polyline.

Finally, use the mappolylinetopolygon command to convert the circle polyline to a polygon.

Step 2 - Exportation of the drawing as KML/KMZ

To export the KML/KMZ file, please follow the steps below:

  1. At the command line, enter MAPEXPORT and press <ENTER>.
  2. In the Export Location dialog box, select the Google KML file format and a location for the exported files.
  3. In the Export dialog box, and on the Options tab you have the possibility to convert the coordinate system to another system from the library of AutoCAD Map 3D.

image-png-Apr-06-2021-03-35-34-26-PM

In case the DWG file does not have a coordinate system, you will have to assign one from the library. You can do the assignment directly from the ‘Map Setup’ tab of Map 3D by clicking on Assign as illustrated in the image below:

image-png-Apr-06-2021-03-31-39-16-PM

Finally, click OK to begin the export process of the KML file. Once exported, you need to assure that all the polygons and placemarks are named according to RatedPower's nomenclature (AC, ST, MV, ACb, RA). Finally, you upload the KML/KMZ file to RatedPower. More information on this can be found in the How to create a site article.

Summary

You can convert your CAD file into KML using AutoCAD MAP 3D by converting the polylines to polygons, then exporting the drawing as KML/KMZ. After that, you'll need to follow RatedPower's nomenclature and finally upload the file.


For any other questions or more information regarding this topic, you can contact us at: support@ratedpower.com