Jump to content
sanju2323

I want lisp to get label at the polyline starting edge and ending edge

Recommended Posts

sanju2323

I want lisp to get at the beginning and end of each polyline of the Elevation Label

Samp.jpg

Label Sample.dwg

Share this post


Link to post
Share on other sites
BIGAL

A start for you maybe have a go at writing a lisp using vl you can get co-ords of plines and their elevation

 

(vl-load-com)

(setq obj1 (vlax-ename->vla-object (car (entsel "\npick pline"))))

(setq coords (vlax-safearray->list (vlax-variant-value(vla-get-coordinates obj1)))) ; 1st 2 variables are start last 2 are end pt

(setq ht (vla-get-elevation obj1)) ; height of pline

[code]

Share this post


Link to post
Share on other sites
sanju2323

i have got it already lisp file but in this lisp file little be mistake. this file was generate only start edge. i need generated with Polyline both of side edge.

 

(defun C:MCL ()

(setq ss (ssget'((0 . "LWPOLYLINE"))))

(setq sslngth (sslength ss))

(Setq idx 0)

(repeat sslngth

(setq ename (ssname ss (setq sslngth (1- sslngth))))

(setq edata (entget ename))

(setq xy (cdr (Assoc 38 edata)))

(setq xy1(cdr (Assoc 10 edata)))

(setq xx(rtos xy 2 3))

(command "text" xy1 2 30 xx "")

)

)

Share this post


Link to post
Share on other sites
hanhphuc
i have got it already lisp file but in this lisp file little be mistake. this file was generate only start edge. i need generated with Polyline both of side edge.

 

 

Try..

(defun c:test (/ ss i ed p [color="red"]sz[/color])
[color="red"](initget 6)
(if (not(setq sz (getdist "\nText size : ")))
(setq sz (getvar "textsize")))[/color]
 (prompt "\nSelect Contour.. ")
 (if (setq ss (ssget ":L" '((0 . "LWPOLYLINE"))))
   (repeat (setq i (sslength ss))
     (setq ed (entget (ssname ss (setq i (1- i)))))
     (foreach x (list (car (setq p (vl-remove-if ''((x) (/= (car x) 10)) ed))) (last p))
(entmakex (list	'(0 . "TEXT")'(8 . "CONTOUR LABEL")
		(cons 1 (rtos (cdr (assoc 38 ed)) 2 3))
		(cons 40[color="red"] sz[/color])
		x
		) ;_ end of list
	  ) ;_ end of entmakex
) ;_ end of foreach
     ) ;_ end of repeat
   ) ;_ end of if
 (princ)
 ) ;_ end of defun

i hope BIGAL can understand im online now to help OP

Edited by hanhphuc
textsize

Share this post


Link to post
Share on other sites
sanju2323

Thank You Sir Its Work

Share this post


Link to post
Share on other sites
sanju2323

can you make changes in LISP. For example set text height, "2" and select polyline or spline

Share this post


Link to post
Share on other sites
hanhphuc

#5 updated (in red)

 

you can set default,

command: textsize

Share this post


Link to post
Share on other sites
sanju2323

sir can you give me last time changes in the lisp file? i want to label generate the single time at closest Polyline.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×