Jump to content

Lisp to select all Leaders by Type


MudawarCad

Recommended Posts

Dear all,

 

I'm looking for a simple lisp (probably vlisp) routine that can select all leaders of the same type (e.g dot). In other words, i only want to select the dot leaders of all my leaders in the drawing file.

 

Should look something like this:

 

(ssget "x" ("leader")) and ('leadertype 3)

 

Thanks

Link to comment
Share on other sites

13 hours ago, BIGAL said:

Do you mean leader style dot?

 

(setq ss (ssget "x" (list (cons 0 "leader")(cons 3 "Dot"))))

 

I tried this, it gave me nil. If you can make what you have written work, I would definitely use it. Thanks for trying. I tried another method and it worked:

(vl-load-com)
(defun c:ABC ()
    (setq myss (ssget "x" '((0 . "LEADER"))))
    (setq myssArrow (ssadd))
    (setq myssDot (ssadd))
    (vlax-for object 
        (setq ActiveSelSet (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-Acad-Object))))
        (setq myArrowType (vlax-get-property object 'arrowheadtype))
        (if
            (eq myArrowType 0) 
            (progn
                (princ "ARROW")
                (vlax-put-property object 'ArrowHeadSize 1.25)
                (setq myssArrow (ssadd (vlax-vla-object->ename object) myssArrow))
            )
        )
        (if
            (eq myArrowType 3)
            (progn
                (princ "DOT")
                (vlax-put-property object 'ArrowHeadSize 0.6)
                (setq myssDot (ssadd (vlax-vla-object->ename object) myssDot))
            )
        )
    );vlax-for
     (princ)
)

 

Link to comment
Share on other sites

Maybe a bit simpler.

 


; arrow closed fill is 0 Dot is 3 look at properties and count or run dumpit.lsp pick leader

 

(defun test ( / myss obj ahead)
(setq myss (ssget "x" '((0 . "LEADER"))))
(repeat (setq x (sslength myss))
(setq obj (vlax-ename->vla-object (ssname myss (setq x (1- x)))))
(setq ahead (vla-get-arrowheadtype obj))
(cond
((= ahead 3)(vla-put-arrowheadsize obj  1.25))
((= ahead 0)(vla-put-arrowheadsize obj 0.6))
)
)
)
(test)

 

Edited by BIGAL
  • Thanks 1
Link to comment
Share on other sites

7 hours ago, BIGAL said:

Maybe a bit simpler.

 


; arrow closed fill is 0 Dot is 3 look at properties and count or run dumpit.lsp pick leader

 

(defun test ( / myss obj ahead)
(setq myss (ssget "x" '((0 . "LEADER"))))
(repeat (setq x (sslength myss))
(setq obj (vlax-ename->vla-object (ssname myss (setq x (1- x)))))
(setq ahead (vla-get-arrowheadtype obj))
(cond
((= ahead 3)(vla-put-arrowheadsize obj  1.25))
((= ahead 0)(vla-put-arrowheadsize obj 0.6))
)
)
)
(test)

 

 

 

 

Works well.

 

Thanks, I appreciate the help.

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