klpocska Posted February 23, 2010 Posted February 23, 2010 I have a lot of texts and polyline-s in one layer. How to I convert only the polylines to Leaders? Quote
alanjt Posted February 23, 2010 Posted February 23, 2010 Extract the XYZ of each PLine vertex and draw a leader accordingly. Quote
klpocska Posted February 24, 2010 Author Posted February 24, 2010 And how to attach the text for the leader? Quote
Lee Mac Posted February 24, 2010 Posted February 24, 2010 The user would have to select which text was to be used. Look into the vla-addLeader function. Quote
Lee Mac Posted February 24, 2010 Posted February 24, 2010 Something like this perhaps: (defun c:toLeader (/ lst2pt ENT PTS TXT TYP) (vl-load-com) ;; Lee Mac ~ 24.02.10 (defun lst2pt (lst flag) (if lst (cons (list (car lst) (cadr lst) (if flag (caddr lst) 0.0)) (lst2pt (if flag (cdddr lst) (cddr lst)) flag)))) (setq *doc (cond (*doc) ((vla-get-ActiveDocument (vlax-get-acad-object))))) (while (progn (setq ent (car (entsel "\nSelect Polyline for Leader: "))) (cond ( (eq 'ENAME (type ent)) (if (wcmatch (setq typ (cdr (assoc 0 (entget ent)))) "*POLYLINE") (progn (setq pts (lst2pt (vlax-get (vlax-ename->vla-object ent) 'Coordinates) (if (eq "POLYLINE" typ) t nil))) (while (progn (setq txt (car (entsel "\nSelect Text for Leader: "))) (cond ( (eq 'ENAME (type txt)) (if (eq "MTEXT" (cdr (assoc 0 (entget txt)))) (progn (vla-AddLeader (if (zerop (vla-get-ActiveSpace *doc)) (if (eq :vlax-true (vla-get-mspace *doc)) (vla-get-ModelSpace *doc) (vla-get-PaperSpace *doc)) (vla-get-ModelSpace *doc)) (variant (vlax-safearray-fill (safearray vlax-vbDouble (cons 0 (1- (* 3 (length pts))))) (apply (function append) pts))) (vlax-ename->vla-object txt) acLineWithArrow) (entdel ent)) (princ "\n** Object Must be MText **"))))))) (princ "\n** Object Must be a *Polyline **")))))) (princ)) Quote
mexmr10 Posted June 24, 2010 Posted June 24, 2010 Nice lisp Lee. Can you modify this so that it doesnt ask for text? Just want to change the polylines into leaders. Can you have the lisp leave the new leader on its original layer instead of layer '0'? Quote
Recommended Posts
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.