CAD macros to incorporate new surveys into the Compiled map of Auroville » History » Version 38
Giulio Di Anastasio, 08/05/2021 16:53
1 | 1 | Giulio Di Anastasio | h1. CAD macros to incorporate new surveys into the Compiled map of Auroville |
---|---|---|---|
2 | 1 | Giulio Di Anastasio | |
3 | 1 | Giulio Di Anastasio | h2. A series of macros to automatically incorporate new survey data into the compiled map of whole Auroville after the conversion from QGis |
4 | 19 | Giulio Di Anastasio | |
5 | 1 | Giulio Di Anastasio | |
6 | 2 | Giulio Di Anastasio | > * First, list out the updated layers with status. For example: |
7 | 2 | Giulio Di Anastasio | |
8 | 1 | Giulio Di Anastasio | p=. !https://redmine.auroville.org.in/attachments/download/10664/List%20of%20updated%20layers.png! |
9 | 3 | Giulio Di Anastasio | |
10 | 37 | Giulio Di Anastasio | p. The use of this list is to help identify the CAD layers to be updated without need to operate on all CAD layers. |
11 | 38 | Giulio Di Anastasio | |
12 | 37 | Giulio Di Anastasio | p. 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). |
13 | 4 | Giulio Di Anastasio | 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). |
14 | 4 | Giulio Di Anastasio | 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. |
15 | 5 | Giulio Di Anastasio | |
16 | 5 | Giulio Di Anastasio | p=. !https://redmine.auroville.org.in/attachments/download/10665/Window%20with%20available%20dxf%20files.png! |
17 | 6 | Giulio Di Anastasio | |
18 | 29 | Giulio Di Anastasio | %{margin:60px} % |
19 | 27 | Giulio Di Anastasio | |
20 | 26 | Giulio Di Anastasio | > * Open the file “E-V-BLDG-SHED.dxf”, it will open as blank window. |
21 | 6 | Giulio Di Anastasio | |
22 | 6 | Giulio Di Anastasio | p=. !https://redmine.auroville.org.in/attachments/download/10667/Dxf%20file%20open%20in%20CAD.png! |
23 | 7 | Giulio Di Anastasio | |
24 | 7 | Giulio Di Anastasio | The next steps are executed by macros, which have been defined differently for POLYGON and for LINE layers. |
25 | 7 | Giulio Di Anastasio | 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. |
26 | 7 | Giulio Di Anastasio | If it is a *LINE* layer, the current layer will be changed to “Line” layer. |
27 | 7 | Giulio Di Anastasio | The macro also turns off the visibility of all other layers in the drawing. |
28 | 7 | Giulio Di Anastasio | To run the macro: |
29 | 7 | Giulio Di Anastasio | > * Go to “Manage” menu. In the “Action Recorder” tab, click on the drop-down to see the list of all recorded macros: |
30 | 7 | Giulio Di Anastasio | |
31 | 7 | Giulio Di Anastasio | p=. !https://redmine.auroville.org.in/attachments/download/10668/List%20of%20recorded%20macros.png! |
32 | 8 | Giulio Di Anastasio | |
33 | 8 | Giulio Di Anastasio | > * Click on “GrassMacro01” for *POLYGON* layer, or on “LineGrassMacro01” for *LINE* layer. |
34 | 8 | Giulio Di Anastasio | > * After selecting, click on “Play” to perform the commands. |
35 | 8 | Giulio Di Anastasio | 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. |
36 | 9 | Giulio Di Anastasio | |
37 | 9 | Giulio Di Anastasio | p=. !https://redmine.auroville.org.in/attachments/download/10669/Output%20of%20Macro%201.png! |
38 | 10 | Giulio Di Anastasio | |
39 | 10 | Giulio Di Anastasio | > * 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. |
40 | 10 | Giulio Di Anastasio | |
41 | 11 | Giulio Di Anastasio | p=. !https://redmine.auroville.org.in/attachments/download/10670/Layer%20to%20be%20replaced.png! |
42 | 12 | Giulio Di Anastasio | |
43 | 12 | Giulio Di Anastasio | > * 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”. |
44 | 12 | Giulio Di Anastasio | |
45 | 12 | Giulio Di Anastasio | p=. !https://redmine.auroville.org.in/attachments/download/10671/DXF%20Layer%20rename.png! |
46 | 13 | Giulio Di Anastasio | |
47 | 13 | Giulio Di Anastasio | > * 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. |
48 | 13 | Giulio Di Anastasio | |
49 | 13 | Giulio Di Anastasio | p=. !https://redmine.auroville.org.in/attachments/download/10672/Output%20of%20Macro%202.png! |
50 | 14 | Giulio Di Anastasio | |
51 | 14 | Giulio Di Anastasio | > * 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. |
52 | 14 | Giulio Di Anastasio | > * 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. |
53 | 14 | Giulio Di Anastasio | > * 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. |
54 | 14 | Giulio Di Anastasio | |
55 | 14 | Giulio Di Anastasio | |
56 | 14 | Giulio Di Anastasio | p=. !https://redmine.auroville.org.in/attachments/download/10673/Output%20of%20Macro%203.png! |
57 | 14 | Giulio Di Anastasio | |
58 | 14 | Giulio Di Anastasio | > * Click on “Close” and save the file. |