Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Apply elevation text to points/lines automatic from text

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
jocke.o92
3712 Views, 4 Replies

Apply elevation text to points/lines automatic from text

Hello, folks. I have a question regarding automatic extraction of text and apply to points/lines.

Sometimes I get a drawing with text of elevation, points and lines. The biggest problem is that the points and lines doesn't have any Z value. That makes it painfully slow to not be able to extract the points/lines right away with correct Z value, so then I need do fill in every point with the elevation text.

So I was wondering if there is a way to do it "automatic" with maybe some lisp or some 3d plug in.
What I am looking for is something that would all elevation text and apply it to the nearest point and lines(if there are any).

 

So first step would be something like, put in radius around the points to search for text ex: 50 mm, and after that the plugin/lisp would apply the elevation text to points/lines that closest. If there would be clutter with points, I would just select all, reduce and move the text close to the point.

I will attatch a dwg just for an example.

I saw a demonstration in Trimble Business Center doing something like this. This would be a time saver if possible.
I can't code yet (learning now) or else I would have tried myself to figure it out.

Labels (9)
4 REPLIES 4
Message 2 of 5
TerryDotson
in reply to: jocke.o92

Attached is your drawing converted to point blocks, I left your text and point objects in place so you can pan and compare.  This was done using DotSoft's MapWorks (an AutoCAD Add-In) that provides numerous methods of reassembling points.  In this case your node was a point object, it could have been crossing line objects and it could have still handled it.  Thousands of points could have been processed in only a few seconds. Here is an example of the dialog.

 

capture.png

Message 3 of 5
3wood
in reply to: jocke.o92

You can also try ALTEXT and  use attached lsp file as its formula.

Result dwg as in the attachment.

ALTEXT3.gif

;;; This is an example formula for ALTEXT.vlx
;;; Select POINT and LINE nearby TEXT objects and change their z value to the number value of the text object.
(defun ALTEXT_FORMULA (/ b0 Bint d0 d1 D-Min e0 e1 fc1 i1 MaxPoint MinPoint old-osnap P1 P2 s1 s2 sc1 vc1 vh2 vobj vw2 vx1 vy1)
  (setq D-Min 2.0) ;This value defines the range around text insert point 
  (if (equal (cdr (assoc 0 ALTEXT_BLK_ENT)) "TEXT")
    (progn
      (setq old-osnap (getvar "OSMODE"))
      (setvar "OSMODE" 0)
      (setq vobj (vlax-ename->vla-object (cdar ALTEXT_BLK_ENT))) 
      (vla-getboundingbox vobj 'MinPoint 'MaxPoint)
      (setq
	MinPoint (trans (vlax-safearray->list MinPoint) 0 1)
	MaxPoint (trans (vlax-safearray->list MaxPoint) 0 1)
	)
      (vl-cmdf "._zoom" MinPoint MaxPoint)
      (vl-cmdf "._zoom" "0.8x")
      (setq vc1 (getvar "viewctr")
	    vx1 (car vc1)
	    vy1 (cadr vc1)
	    sc1 (getvar "screensize")
	    fc1 (/ (car sc1)(cadr sc1))
	    vh2 (/ (getvar "viewsize") 2.0)
	    vw2 (* vh2 fc1)
	    )
      
      (setq s1 (ssget "C" (list (- vx1 vw2) (- vy1 vh2)) (list (+ vx1 vw2) (+ vy1 vh2)) '((0 . "POINT"))))
      (if s1
	(progn
	  (repeat (setq i1 (sslength s1))
	    (setq i1 (1- i1))
	    (setq b0 (ssname s1 i1)
		  e0 (entget b0)
		  Bint (cdr (assoc 10 e0))
		  d1 (distance Bint (cdr (assoc 11 ALTEXT_BLK_ENT)))
		  )
	    (if (or (not d0) (< d1 d0))
	      (setq d0 d1
		    e1 e0
		    )
	      ) ;Find out the nearest point object
	    )
	  (entmod (subst (cons 10 (list (car Bint) (cadr Bint) (atof (vl-string-subst "." "," (cdr (assoc 1 ALTEXT_BLK_ENT)))))) (assoc 10 e1) e1))
	  (entupd (cdr (assoc -1 e1)))
	  )
	);Change point elevation
      
      (setq s2 (ssget "C" (list (- vx1 vw2) (- vy1 vh2)) (list (+ vx1 vw2) (+ vy1 vh2)) '((0 . "LINE"))))
      (if s2
	(progn
	  (repeat (setq i1 (sslength s2))
	    (setq i1 (1- i1))
	    (setq b0 (ssname s2 i1)
		  e0 (entget b0)
		  P1 (cdr (assoc 10 e0))
		  P2 (cdr (assoc 11 e0))
		  )
	    (if (< (distance P1 (cdr (assoc 11 ALTEXT_BLK_ENT))) D-Min)
	      (entmod (subst (cons 10 (list (car P1) (cadr P1) (atof (vl-string-subst "." "," (cdr (assoc 1 ALTEXT_BLK_ENT)))))) (assoc 10 e0) e0))
	      (entupd (cdr (assoc -1 e0)))
	      )
	    (if (< (distance P2 (cdr (assoc 11 ALTEXT_BLK_ENT))) D-Min)
	      (entmod (subst (cons 11 (list (car P2) (cadr P2) (atof (vl-string-subst "." "," (cdr (assoc 1 ALTEXT_BLK_ENT)))))) (assoc 11 e0) e0))
	      (entupd (cdr (assoc -1 e0)))
	      )
	    )
	  )
	);Change line elevation
      
      (vl-cmdf "._zoom" "p")
      (vl-cmdf "._zoom" "p")
      (setvar "OSMODE" old-osnap)
      nil
      )
    )
  )

 

Message 4 of 5
jocke.o92
in reply to: TerryDotson

I tried out the demo and it worked good! This is a good solution. Thank you!

Message 5 of 5
jocke.o92
in reply to: 3wood

This also work really good for me. I tried some examples of elevation data and it got good results. Thank you!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report