CAD macros to incorporate new surveys into the Compiled map of Auroville » History » Version 38
« Previous -
Next » -
Giulio Di Anastasio, 08/05/2021 16:53
CAD macros to incorporate new surveys into the Compiled map of Auroville¶
A series of macros to automatically incorporate new survey data into the compiled map of whole Auroville after the conversion from QGis¶
- First, list out the updated layers with status. For example:
The use of this list is to help identify the CAD layers to be updated without need to operate on all CAD layers.
If the QGis layer (shapefile/geopackage) is a POLYGON layer, then in the corresponding dxf file all features will be stored in the CAD layer called “Boundary” (it is assigned by default by the QGis algorithm).
If instead the QGis layer (shapefile/geopackage) is a LINE layer, then in the corresponding dxf file all features will be stored in the CAD layer called “Line” (it is assigned by default by the QGis algorithm).
In this example, the dxf file ‘’V_BLDG_SHED----E” will be used, to be replaced into the Compiled map file. This layer is a POLYGON layer. In the example, directions are given for both POLYGON and LINE layers.
- Open the file “E-V-BLDG-SHED.dxf”, it will open as blank window.
The next steps are executed by macros, which have been defined differently for POLYGON and for LINE layers.
If it is a POLYGON layer, the first macro will zoom-extent to all the objects in the layer, and then change the current layer from ‘0’ to “Boundary” layer.
If it is a LINE layer, the current layer will be changed to “Line” layer.
The macro also turns off the visibility of all other layers in the drawing.
To run the macro:
- Go to “Manage” menu. In the “Action Recorder” tab, click on the drop-down to see the list of all recorded macros:
- Click on “GrassMacro01” for POLYGON layer, or on “LineGrassMacro01” for LINE layer.
- After selecting, click on “Play” to perform the commands.
As a result, the Macro performs the zoom-extent of all features in the layer, makes the Boundary/Line layer current, and turns off all other layers.
- Open the compiled map file, double click on the layer having contents to be replaced (in this case it is “V-BLDG-SHED------E”) to make it current, and turn off all the other layers.
- Copy the current layer name from the compiled map file and paste it in the file “E-V-BLDG-SHED.dxf” to replace the current layer name “Boundary”.
- Once the layer name is replaced, run the second Macro “GrassMacro02”: this macro will select all the objects in the layer and copy them in the clipboard/memory.
- Go to the compiled map file and, before running the next macro, note down the count of features. In this example, the features in the “V-BLDG-SHED------E” layer were 436.
- Run the third and last Macro “GrassMacro03”, which selects all the objects on current layer, deletes them, and then pastes all previously copied features in the same coordinates.
- Cross check the count of features: after the macro has been executed, the count of features is 454: it means that the layer has been updated. This is just a confirmation.
- Click on “Close” and save the file.