surfinglaverty Posted February 17, 2010 Share Posted February 17, 2010 Please help someone ... I've been trawling for days trying to figure this out.... here goes... I have a CAD map that I have been working on (AutoCAD 07) of which I have changed all the z values for each point by a few meters in order to adjust for Ordnance Datum. I am now trying to figure out how to automatically generate the new text for each point (of which there are ~900 points) which will show the elevation (z value) for each point. I could manually insert text showing the new levels for each point but that would take [eternity] ages. Please help!!! Quote Link to comment Share on other sites More sharing options...
KevUK Posted February 17, 2010 Share Posted February 17, 2010 Hi surfinglaverty, welcome to the forum. Quote Link to comment Share on other sites More sharing options...
alanjt Posted February 17, 2010 Share Posted February 17, 2010 Are they just regular points with a elevation? Could you post an example drawing? Quote Link to comment Share on other sites More sharing options...
surfinglaverty Posted February 17, 2010 Author Share Posted February 17, 2010 Thanks KevUK! Hope you have a miracle solution up your sleeve. I have Carlson 09 installed on my other computer if that helps - just can't find out how to add text showing the elevations for each point. Quote Link to comment Share on other sites More sharing options...
surfinglaverty Posted February 17, 2010 Author Share Posted February 17, 2010 How do I post an example drawing? Quote Link to comment Share on other sites More sharing options...
surfinglaverty Posted February 17, 2010 Author Share Posted February 17, 2010 Ah, I have attached a copy of the dwg. I have deleted much of the drawing to shrink the file size down, but you'll get an idea of the points. I think they are just regular points, XYZ. Hope this helps. example1.dwg Quote Link to comment Share on other sites More sharing options...
alanjt Posted February 17, 2010 Share Posted February 17, 2010 Try something like this... (defun c:PointLabel (/ #SS #Ent) (and (setq #SS (ssget '((0 . "POINT")))) (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex #SS))) (setq #Ent (entget x)) (entmakex (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") '(71 . 4) ;;(cons 50 (/ pi 4.)) (assoc 10 #Ent) (cons 1 (rtos (caddr (cdr (assoc 10 #Ent))) (getvar "lunits") 2)) ) ;_ list ) ;_ entmakex ) ;_ foreach ) ;_ and (princ) ) ;_ defun Quote Link to comment Share on other sites More sharing options...
surfinglaverty Posted February 17, 2010 Author Share Posted February 17, 2010 Thanks, this is where i show that i belong in the basics forum. What do i do with this code - do i copy and paste it into the command line? I really appreciate this help too guys Quote Link to comment Share on other sites More sharing options...
surfinglaverty Posted February 17, 2010 Author Share Posted February 17, 2010 So I copied it into the command line and then used the pointlabel command, selected the points and tadaa!! text with the point elevations. This has made me a real happy camper - I can now sleep, ah sweet sleep. Thanks guys. Quote Link to comment Share on other sites More sharing options...
alanjt Posted February 17, 2010 Share Posted February 17, 2010 So I copied it into the command line and then used the pointlabel command, selected the points and tadaa!! text with the point elevations. This has made me a real happy camper - I can now sleep, ah sweet sleep. Thanks guys. Glad it helped. Learn to code, it will save you hours upon hours. Quote Link to comment Share on other sites More sharing options...
Rroger_D Posted April 27, 2015 Share Posted April 27, 2015 Hi, I realise that this is an old thread but my requirements are prestty much exactly the same as the OP was asking. However, I cannot seem to get it to work. I am using AutoCAD 2013. I have pasted the code into the command line. It recognizes the command 'pointlabel' but cannot find any points. I have tried selecting a single string, dragging a box across the points from left and right and also selecting a single point with snaps on but still 0 found 0 total. Any ideas? Many thanks in advance. Rroger_D Quote Link to comment Share on other sites More sharing options...
mikekmx Posted April 27, 2015 Share Posted April 27, 2015 Hi, I realise that this is an old thread but my requirements are prestty much exactly the same as the OP was asking. However, I cannot seem to get it to work. I am using AutoCAD 2013. I have pasted the code into the command line. It recognizes the command 'pointlabel' but cannot find any points. I have tried selecting a single string, dragging a box across the points from left and right and also selecting a single point with snaps on but still 0 found 0 total. Any ideas? Many thanks in advance. Rroger_D while waiting for a more useful answer, try downloading matey's drawing & see if the LISP works with that one. If it does, see what the difference is between yours and it. Quote Link to comment Share on other sites More sharing options...
Rroger_D Posted April 27, 2015 Share Posted April 27, 2015 Hmm.... Yes it does work with his but not mine. I notice that his points are nodes, whereas mine aren't. If I insert a few point nodes into my drawing it does in fact find them. I guess that I need to be able to use object snaps. Quote Link to comment Share on other sites More sharing options...
ryback Posted December 27, 2015 Share Posted December 27, 2015 (edited) Try something like this... (defun c:PointLabel (/ #SS #Ent) (and (setq #SS (ssget '((0 . "POINT")))) (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex #SS))) (setq #Ent (entget x)) (entmakex (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") '(71 . 4) ;;(cons 50 (/ pi 4.)) (assoc 10 #Ent) (cons 1 (rtos (caddr (cdr (assoc 10 #Ent))) (getvar "lunits") 2)) ) ;_ list ) ;_ entmakex ) ;_ foreach ) ;_ and (princ) ) ;_ defun Hello! I used your lisp, it's good lisp, but can you help me to edit something? I want create a layer for the text, the default Justify is Middle Center, default text height is 2, text width is 0.8 (when i need change, i can change in lisp to update). And the text is only dtext. I know it's old topic, but i don't want to create a new topic, so please help me! Thank you very much ! ^^ ^^ ^^ ^^ Edited December 27, 2015 by ryback Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 27, 2015 Share Posted December 27, 2015 A simple way to find out the required DXF codes to be used in the entmakex create a MTEXT with all the settings you want then copy this to command line (entget (car (entsel))) pick the mtext look at all the codes, just add the required ones eg '(8 . "mylayer") Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 27, 2015 Share Posted December 27, 2015 RRoger_D in autocad you can have two types of "POINTS" the original old "Point" but if you have CIV3d you can have also "Points" but these are proxy objects. If you look at the properties of the point it will identify which you have. If Civ3d you can use a style to label or a lisp ; label a civ3d point height ; by Alan H (defun CIV3DPTHT ( / obj oldtext oldlay xyz pt1 ht pt) (alert "Pick CIV3D points press ESC or pick nothing to exit") (while (setq obj (vlax-ename->vla-object (car (entsel)))) ; vl 3d point convert to plain lisp (setq pt1 (vlax-safearray->list (vlax-variant-value (vlax-get-property obj "Location")))) (setq ht (rtos (nth 2 pt1) 2 3)) ; Z val (setq pt (list (nth 0 pt1)(nth 1 pt1))) ; XY (setq oldtext (getvar "textstyle")) (setq oldlay (getvar "clayer")) (command "Layer" "n" "Pointhts" "c" 1 "Pointhts" "s" "pointhts" "") ; put text on new layer ; 2.5 annotative text (if (setvar "textstyle" "ISO2.5") (command "TEXT" pt 0 ht) (alert (strcat "The style ISO2.5 annotative does not exists" "\nplease create and run again")) ) (setvar "textstyle" oldtext) (setvar "clayer" oldlay) ) ; end while (princ) ) ; end defun (CIV3DPTHT) Quote Link to comment Share on other sites More sharing options...
MihaiAnghius Posted July 22, 2016 Share Posted July 22, 2016 I had the same problem, i'm curently learnig bsic lisp, your code worked very well Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.