Jump to content

Recommended Posts

Posted

I find a code to labeling a pick point that have a little modify :

 

I want modify it to show all pick point of object (ex. 3dpoly) selected.

labeling.lsp

Posted

Sorry, this is the code

 

 
(defun c:labeling (/  p1 p2 x y z ptcoord textloc)
 (while
   (setq p1 (getpoint "\nPick Point: "))
   (setq p2 (getpoint p1 "\nPick Point Direction: "))
   (setq textloc (getpoint p2 "\nPick Label Location: "))
   (setq x (rtos (car p1)))
   (setq y (rtos (cadr p1)))
   (setq z (rtos (caddr p1)))
   (setq x (strcat "E " x))
   (setq y (strcat "N " y))
   (setq z (strcat "EL. " z))
   (command "qleader" p1 p2 textloc "" x y z "")
 )
)

 

I want modify it to show all points of object (ex. 3dpoly) selected.

Can someone help me....

Posted

There is lots of stuff here about finding polyline vertices then you would just add your code for the "qleader" only difference would be to set an angle for the label answer and probably a predefined offset.

 

Now I think about it I am sure Lee Mac has done this search for label pline ?

Posted

Thank Bigal, but your reference only pick point likey my code and not use arrowhead.

 

I need the code for select object which have more than 1 point (line, polyline, 3dpolyline, etc..) then show all coordinats (xyz) of points.

Posted
I find a code to labeling a pick point that have a little modify :

 

I want modify it to show all pick point of object (ex. 3dpoly) selected.

 

Change all settings to your needs:

(defun C:demo(/ en  obj points ss tp xyz)

(defun get3dverices (obj / coords  param pt)
(cond ((eq (vla-get-objectname obj) "AcDbLine")
 (setq coords (list (vlax-curve-getstartpoint obj)(vlax-curve-getendpoint obj))))
((wcmatch (vla-get-objectname obj)
       "AcDb2dPolyline,AcDb3dPolyline") 
(setq param
(cond((eq (vlax-curve-isclosed obj) :vlax-true)
    (fix (vlax-curve-getendparam obj)))
     ((fix (1+ (vlax-curve-getendparam obj))))
   )
 )
(while (setq pt (vlax-curve-getpointatparam obj (setq param (1- param ))))
   (setq coords (cons pt coords))
 ))
((eq (vla-get-objectname obj)
       "AcDbPolyline") 
(setq param
(cond((eq (vlax-curve-isclosed obj) :vlax-true)
    (fix (vlax-curve-getendparam obj)))
     ((fix (1+ (vlax-curve-getendparam obj))))
   )
 )
(while (setq pt (vlax-curve-getpointatparam obj (setq param (1- param ))))
   (setq coords (cons pt coords))
 )
 (setq coords (mapcar (function (lambda(x)(list (car x)(cadr x)(vla-get-elevation obj)))) coords)))
)
)

(if
 (setq ss (ssget ":L" (list (cons 0 "LINE,*POLYLINE"))))
  (while (setq en (ssname ss 0))
    (setq points (GET3DVERICES (vlax-ename->vla-object en)))
    (foreach p  points
      (setq xyz (strcat "E "
   (rtos (car p) 2 3)
   "[url="file://\\PN"]\\PN[/url] "
   (rtos (cadr p) 2 3)
   "[url="file://\\PEL"]\\PEL[/url]. "
   (rtos (caddr p) 2 3)))
      (command "._leader"
 "_non"
 p
 "_non"
 (setq tp (polar p (/ pi 4) (* 10 (getvar "textsize"))))
 "_non"
 (polar tp 0 (getvar "textsize"))
 ""
 xyz
 ""))
    (ssdel en ss)))
(princ)
 )

 

Sorry, almost not tested

Posted

Thanks Fixo,

don't worry, your code doing well.

How to set the size of leader lines to suit as current dimsclale, because in your code only arrowhead and text that changed.

 

 
(command "._leader"  "_non"  p  "_non"  (setq tp (polar p (/ pi 4) (* 10 (getvar "textsize"))))  "_non"  (polar tp 0 (getvar "textsize"))  ""  xyz  ""))

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