VisDak Posted March 4, 2010 Share Posted March 4, 2010 Hi, Good day to all, Is there any have a route that a leader will start the point on text and in the end is the arrow head, because i need it on congested text arrangement, easily arange the leaders if the last point is the arrow, many thanks Quote Link to comment Share on other sites More sharing options...
VisDak Posted March 5, 2010 Author Share Posted March 5, 2010 Hi all, i attached an image that will be done by lsp, i need is leader will be inverted the starting point command, is this possible to set, many thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 5, 2010 Share Posted March 5, 2010 Something like this? (defun c:Backwards_Leader (/ *error* GetPoints ENT OBJ PTLST UFLAG) (vl-load-com) ;; Lee Mac ~ 05.03.10 (setq *doc (cond (*doc) ((vla-get-ActiveDocument (vlax-get-acad-object))))) (defun *error* (msg) (and uFlag (vla-EndUndoMark *doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (redraw) (princ)) (defun GetPoints (/ lst pt) (if (car (setq lst (list (getpoint "\nPick First Point: ")))) (while (setq pt (getpoint "\nPick Next Point: " (car lst))) (mapcar (function (lambda (from to) (grdraw from to 40 1))) (cdr (reverse (setq lst (cons pt lst)))) (reverse (cdr lst))))) lst) (while (progn (setq ent (car (entsel "\nSelect Text for Leader: "))) (cond ( (eq 'ENAME (type ent)) (if (eq (vla-get-ObjectName (setq obj (vlax-ename->vla-object ent))) "AcDbMText") (if (setq ptLst (GetPoints)) (progn (setq uFlag (not (vla-StartUndoMark *doc))) (vla-AddLeader (if (eq AcPaperSpace (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 ptLst))))) (apply (function append) ptLst))) obj acLineWithArrow) (setq uFlag (vla-EndUndoMark *doc)))) (princ "\n** Object Must be MText **")))))) (redraw) (princ)) Quote Link to comment Share on other sites More sharing options...
devitg Posted March 6, 2010 Share Posted March 6, 2010 Hi Lee Mac Please could you enlighten it , please Why do you use it? (setq *doc (cond (*doc) ((vla-get-ActiveDocument (vlax-get-acad-object))))) and not a simple (setq *doc (vla-get-ActiveDocument(vlax-get-acad-object))) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 6, 2010 Share Posted March 6, 2010 So that *doc may remain global, and I don't have to call vlax-get-acad-object loads of times. Quote Link to comment Share on other sites More sharing options...
VisDak Posted March 7, 2010 Author Share Posted March 7, 2010 Many Thanks Lee, Works fine:) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 7, 2010 Share Posted March 7, 2010 You're welcome VisDak, was a fun one to write Quote Link to comment Share on other sites More sharing options...
Tue_NV Posted March 17, 2010 Share Posted March 17, 2010 Hi Lee I wrote this code but no successful (defun c:drleader() (setq MS (vla-get-ModelSpace (vla-get-activeDocument (vlax-get-acad-object)) )) (setq p1 (getpoint "\n Getpoint p1 :")) (setq p2 (getpoint p1 "\n Getpoint p2 :")) (setq lst (append p1 p2)) (setq vri (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray vlax-VBDouble (cons 1 (length lst)) ) lst) ) ) (vla-addleader MS vri nil acLineNoArrow) (princ) ) Command: drleader Getpoint p1 : Getpoint p2 :; error: ActiveX Server returned an error: Parameter not optional Please tell me to repair this code Thank you very much. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 17, 2010 Share Posted March 17, 2010 There is a slight problem with the documentation of the vla-addleader method in that one is unable to specify a null MText argument. You would need to specify an MText object and delete it afterwards. Quote Link to comment Share on other sites More sharing options...
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.