Generating Revit Toposurface from Text based CAD file

At times I am faced with a scenario where we need to create Revit Topography but surveying CAD drawings simply contains spot elevation as texts rather than points with actual elevation. For example the  file below has MTexts containing the elevation for various location but no contour or point-elevation, all we have are the texts.

t1

t2

We have to create the topography in Revit, either we choose to manually create those hundreds of points (That will definitely take a long-long time) or we can find a better automated way to do this. So, if you want to automate this cumbersome job then follow along and you will learn how to use LISP, DATAEXTRACTION, Excel and Revit to generate topography from such text based files.

Let’s Begin,

1. Clean up the CAD file from all the unwanted data. Keep only the spot-elevation texts somewhere near the origin, check the scale and units to make sure it matches your Revit units. (Or you can place these points w.r.t your Shared Coordinate)

2. If you have +/- signs in your spot level texts you can simply find and replace those in CAD. This will clean it up further and avoid few unnecessary steps. Keep your drawing as clean as possible.

t3

3. Your file might look something like this after clean up.

t4

4. This whole process will work only if your texts are Texts but not MTexts. So if you have MTexts, select everything and explode once. That will convert all MTexts into single line Texts.

5. Now that we have all the Elevation as Texts, the next step would be to convert these texts into Points with Z value using LISP action. For that you need to download the attached lsp file from here. Download, extract and save the TextToPoint.lsp file somewhere accessible.(The code doesn’t belong to me, I found it on internet and altered it to align with my purpose. Thanks the mighty Internet )

6. In CAD run the appload command and browse to the saved location,  load the TextToPoint.lsp file and click load again when prompted. This will load a new command called “Spot_elevation” in your CAD environment.

t6

t5

t7

7. Go to the command line and run the newly loaded command Spot_elevation

t8

8. Then you have to select all the texts that you want to convert into elevated points depending on the values. Select all or the only texts you want to convert.

t9

9. Press enter to finalise the selection and select Value in command line. (This will take the values from texts as Z-coordinate)

t10

10. You are done, all the texts are converted into points with their individual Z-Position.  You can check this by selecting any point and checking its Z position.
t11

From here on you can Save the CAD file and take these points directly in Revit to generate topography. But I prefer taking spot elevations in excel and do some local-level subtraction and then import it in the Revit.

11. We need to extract the data of these points in excel based format so that we can edit, change or update it whenever needed. Also, excel can easily integrate with Dynamo and it’s one more reason to have excel sheet for Topography points.

For that, we will use a very strong feature of CAD….DATAEXTRACTION.

12. Go to the command-line and run the command DATAEXTRACTION. Select “Create A new data extraction(dxe)” and Save the dxe file somewhere.

t12

t13

Click next.

13. In next screen check “Select objects in the current drawing”

Click on selection icon next to it and select all the points. Press enter to finalise the selection.

Click next

t14

14. Make sure Point is checked and click next.

t15

15. In next window unckeck everything on right except geometry. And make sure X, Y, Z positions are checked in left(This is an important feature of CAD, it lists all the available data for your selection and lets you choose what you want to extract)

Click Next.

t16

16. Now you can see the x,y,z values of the points here. Click Next.t17

17. Check Output file as a CSV and save the file somewhere.t18

18. Open the file in excel and delete Row 1, Name & Count columns.(Revit reads the csv point files starting from A1, with first three columns representing x,y,z values of a point)

t19

19. Save the file as CSV again.

t20

20.  We are done with excel, Next Fire up the Revit. Go into topography.

t21

21. Specify the point file and open it.

t22

t23

22. When prompted Specify the units of the excel(CAD) file.

t24

23. And you are done. You have your toposurface ready(I added few more extra points to make it look like square plot).

Click finish.

t25

24. You can draw a section(or take spot elevations) to check it worked correctly or not.

t26t27

Using this process you can convert any text based spot-elevations into Revit Toposurface.

Thanks for following along. In case you have any doubt please do let me know in comments. Sample CAD and excel files can be downloaded from Sample CAD files.