Jump to content

Lisp routine for extracting point data?


docvern

Recommended Posts

Hello there. Am new to this forum although have used it many times to help me at work.

 

I just wondered if anyone knew of a lisp routine for the following. I have never dealt with lisp routines and don't know the first thing about writing one which is something I need to change pretty soon!!!

 

Anyway I do a lot of land surveying and when I put the points into cad I need to elevation to show next to my points. At the moment I manually click on the point, see the Z value and then type it out. I know there must be a hell of a lot quicker way to do this but I am yet to find one. I run 2009 and do have civil 3d aswell but cant find a way to do it on there either.

 

Any help would be appreciated.

 

Cheers

Link to comment
Share on other sites

I am very surprised that you have not got all the levels written in already into the survey drawing. But I have come across a situation like this before, and wrote this small lisp that annotates the level of a 3D point. The text is written to two decimal places, and it is written at z = zero elevation. There is no error handling, because I am not clever enough, but it should start you off.

 

;3DL is a programme to annotate levels of 3D lines drawn in a ground model; eldon 2009
(defun C:3DL (/ pt0 pt1 pt2 pt3 pt4 pt5 lev x y z)
          (setq pt0 (getpoint "\nPick level point. . . . . ")
                x (car pt0)
                y (cadr pt0)
                z (caddr pt0)
                lev (rtos z 2 2)
                pt1 (list (- x 0.18) y 0)
                pt2 (list (+ x 0.18) y 0)
                pt3 (list x (- y 0.18) 0)
                pt4 (list x (+ y 0.18) 0)
                pt5 (list (+ x 0.21) (+ y 0.09) 0)
           )
          ;(command "LINE" pt1 pt2 ""); draws a cross
          ;(command "LINE" pt3 pt4 ""); draws a cross
           (command "TEXT" "s" "LEVELS" pt5 "" "0" lev); writes a level
)
                    

Link to comment
Share on other sites

Thanks for that. Not sure what you mean exactly but I assume you are are thinking I use the survey feature in civil 3d. We only just got it so am trying to figure out how to use it. Before all i have been doing is opening my surveys as a dxf and then writing the data out in cad.

Link to comment
Share on other sites

If you have Civil 3D, it's a matter of setting up a Point Label Style. Try Help > Tutorials > AutoCAD Civil 3D Tutorials > Points Tutorials

Link to comment
Share on other sites

ok 3dl i guess. I tried it and it went through the motions with no end product. Ill try and go through civil and see what happens. Sorry I am bit new to lisps and stuff

Link to comment
Share on other sites

Sorry guys I am really struggling here. Does anyone have experience with Survey data in Cad. I export from my Topcon as a dxf so my data does not come from a spreadsheet or a text file. My points come into cad as a block ref with the cross and the point number. All I want is it to come in with this info plus the level info.

Link to comment
Share on other sites

I tried it and it went through the motions with no end product.

 

You need to set an ObjectSnap, to pick the entity. If the object is a point, then you need to set Node snap.

 

When I started drawing up survey drawings, the end user (architects mostly) could not understand blocks and attributes, so in my desire to keep things simple, I only use entities, and am most suspicious of the blocks with attributes, which used to be sooo inflexible.

 

So to begin every drawing, I plot the point number with a point, a cross at the point, and the elevation alongside as per the picture. Then you join up the points using the field sketches. Makes a nice drawing with only entities in it, and useable by all. :D

 

Using the Topcon, you can download a text file of coordinates, unless you want to string in 3D which is where the DXF download is useful.

surveypoints.jpg

Link to comment
Share on other sites

Right well that is pretty much how I want it to look but when I open my dxf I dont get the point elevation. I did have snap on but all it did was get to text orientation and then allowed me to type some text and whatever i typed was what went onto the screen. I just copied your whole list and pasted it. Is that right?

Link to comment
Share on other sites

If your data comes in as block, then your snap should be set to Insertion.

 

To run this Lisp, you need to copy the text into NotePad/ WordPad, then to save it as a text file called 3DL.LSP, and put that file where it can be found by AutoCAD's search path, (you have to make sure the file extension is LSP, or change it afterwards). Then either type at the command line (load"3dl"), or go through Tools menu - Autolisp - load, and browse till you find it. When it is loaded successfully, the command line will say C:3DL. Then you can set your snap, and click away. The routine is a single hit, but if your right click is set to repeat command, then you can carry on clicking (left and right).

 

If you can find out how to download the coordinates in a text file, then in the fullness of time, you will be able to your own Lisps. I have provided the picture to see what you want to aim for, and the rest is down to a bit of graft! Being self-employed gave me an added incentive to write something if I wanted to start earning any money.

Link to comment
Share on other sites

Thanks for trying to help me with this. I use appload and got it loaded in ok and then would type the command 3dl and it asks me to pick level point. As soon as i do it just comes up with a piece of text saying 0 and in the command line it says.

Command: 98.66 Unknown command "98.66". Press F1 for help

 

This is a level with the elevation 98.66.

 

I will try to play around with it a bit.

Link to comment
Share on other sites

actually working now. I just changed the text style to standard as didnt have one called levels and its coming in. thanks a million. Sorry to be a pain but i am gonan really try and learn lisps now.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...