Jump to content

Leader Starting point


VisDak

Recommended Posts

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

Link to comment
Share on other sites

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,:oops:

 

many thanks

LEADER.JPG

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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.

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