Jump to content

inserting point elevation text


surfinglaverty

Recommended Posts

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!!!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. :)

Link to comment
Share on other sites

  • 5 years later...

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 7 months later...
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 by ryback
Link to comment
Share on other sites

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")

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

  • 6 months later...

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...