Josh from Dakine Drafting Services back again with some helpful info for you Draftsight users. If you are a Draftsight user who has an AutoCAD background, then you know the power of using lisp programs. There are many free lisps available that help simplify repetitive tasks. I myself found a couple of them very useful in my everyday work. I have become a user of Draftsight but I'm unable to use those lisps. Fortunately I found that using scripting works as a good remedy for this. It may take longer but the advantage is one can customise the task they need completed.
My dilemma at hand was the ability to take raw xyz data from a file and create a basic drawing. The native program being used to export the survey data from a Nikon Total Station to a dxf file was insufficient. I needed coded data to be created onto its own layer. For example, I shoot a whole set of measurements under a layer called curb. Upon export I want all that data including points and point id#s created on a layer called curb. You lucky Leica Total station users don't have this problem if you export it as dxf1 type. This is effective in my work so that I can turn off different measurement points by layer, creating less clutter in my workspace and eliminating the possibility of selecting incorrect points.
Now that you know what I'm trying to accomplish, I'll explain briefly what scripting is. Scripting is basically creating a text file that has all your CAD commands typed ahead of time. If you click on <tools> on your menu bar then <run script>, you will then be prompted to select a script file (*.scr) and "boom" your task is completed. Manually you may draw a line by typing "line" in the command window and then type the co-ordinates for your start and end points. If you were to script the same thing you will have a blank notepad page open and type the following
line
0,0,0
1,0,0
Notice how the commands are written one line at a time. You will want to experiment with various other commands and see what commands are needed to fully execute it correctly, then simply copy and paste the text. The best way to do this is to use a dash (-) in front of the command so that none of the options are suppressed or automatically entered. For example to create a circle you will type -circle in the command line. Also if you you want to emulate hitting the enter key, you need to hit enter twice to create a blank line.
As I mentioned I needed this to automate drawing hundreds of lines of raw xyz data from a survey. For me this data is available as a csv or ascii, but may differ for you. Ultimately you want the ability to open that file in excel so that all the data is imported into separate cells. Once I have my excel sheet I run an excel macro that I programmed to create that line by line code on a new sheet called nodes. I have a brief background with C++ programming so I I'm not a computer wiz, but what ever I couldn't figure out was easily obtained through various forums if you google it. Anyways, my VBS macro code consists of reading each row and creating a new layer with that same code name. It then makes that layer the current working layer. Next I call up the node command and enter the xyz data needed. When all the rows of xyz data are done, everything in the first column is copied to a notepad file and saved as "nodes.scr". I can then run the scr file in Draftsight. There is an example below of what this should look like for one row of survey data.
excel data:
1 -53.92454 -123.4447 -3.849304 curb
script data:
-layer
n
curb
-layer
m
curb
point
m
-53.92454,-123.4447,-3.849304
I will also run a second macro that is essentially the same, but instead it will create a piece of text with the point ID# at that same co-ordinate. I run two different scripts for two reasons. If I don't depend on point IDs for the job then I can save time. Also Draftsight and computing power may be limited on how many lines of scripted commands can be executed before it crashes. This helps cut down the lines per script file. The amount of time it takes to run a script file is naturally dependent on the number of lines. I had 170 lines of survey data turn into a 2100 line script file, which took about 1 minute to execute. Manually the same task would take several hours.
Hope this helps out anybody out there who faced the same dilemma. Creating the excel macro was the most time consuming part of the task, but it was well worth my time. Feel free to comment with any input or questions you may have. You can also email me if you are more comfortable with that.
Have fun and good luck.