Jump to content

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


sanju2323

Recommended Posts

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]

Link to comment
Share on other sites

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

)

)

Link to comment
Share on other sites

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