Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Selection set of mleaders with more than 1 leader line

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
diegolopezsilanes
501 Views, 9 Replies

Selection set of mleaders with more than 1 leader line

Hello, I'd like to know if there's a way to get a Selection set of mleaders with more than 1 leader line.

Thanks

9 REPLIES 9
Message 2 of 10

You could get the selection set of all Multileaders, and step through it to keep only those with more than one

(304 . "LEADER_LINE{")

entry in their entity data:

 

(defun C:MLML (/ n ml mldata mlleaders); = MultiLeader(s) with Multiple Leaders
  (setq ss (ssget "_X" '((0 . "MULTILEADER"))))
  (repeat (setq n (sslength ss))
    (setq
      ml (ssname ss (setq n (1- n)))
      mldata (entget ml)
      mlleaders (vl-remove-if-not '(lambda (x) (equal x '(304 . "LEADER_LINE{"))) mldata)
    ); setq
    (if (<= (length mlleaders) 1) (ssdel ml ss))
  ); repeat
  (sssetfirst nil ss)
); defun

 

That leaves such MLeaders selected/gripped/highlighted, and also in the ss variable to do whatever you want to them.

Kent Cooper, AIA
Message 3 of 10

Or using the "LeaderLineCount" property...

 

(defun c:test ()
  (if (setq s (ssget '((0 . "MULTILEADER"))))
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i))))
      (if (< (getpropertyvalue e "LeaderLineCount") 2)
	(ssdel e s))))
  (if (and s (> (sslength s) 0)) (sssetfirst nil s))
  (princ)
  )

 

 

Message 4 of 10

Thanks a lot, I always learn much from you guys

Message 5 of 10
Kent1Cooper
in reply to: ВeekeeCZ


@ВeekeeCZ wrote:

Or using the "LeaderLineCount" property...


Interesting....  I wasn't aware of that property, but in looking into it, I mistakenly tried the "LeaderCount" property.  That has an unexpected way of looking at things:

Kent1Cooper_0-1629317303727.png

If all Leaders hook in at the same place, it only considers it to have 1 -- maybe it should be called "LeaderTieInLocationCount" or something.  So be sure to use the one with "Line" in the middle of the property name.

 

[There is also the interesting difference that "LeaderCount" is available as a VLA property in addition to via the (getpropertyvalue) approach, but "LeaderLineCount" is only in the latter family of properties.]

Kent Cooper, AIA
Message 6 of 10

@diegolopezsilanes 

To be more correct...

I always learn much from you guys and gals.  😏

John F. Uhden

Message 7 of 10
john.uhden
in reply to: john.uhden

I think "The image doesn't exist" because I wasn't signed in.

I've been shutting down my machine each day before I leave work.

John F. Uhden

Message 8 of 10
Kent1Cooper
in reply to: john.uhden


@john.uhden wrote:

To be more correct...

I always learn much from you guys and gals.  😏


[Not necessarily a needed correction, in these days when all standards are falling by the wayside.  Even between women, though I cringe when I hear it, "you guys" is a common usage.  I've been at wedding receptions at which the bride, addressing her all-female bridesmaids, in public, referred to them as "you guys."]

Kent Cooper, AIA
Message 9 of 10
john.uhden
in reply to: john.uhden

Hmm.  I think maybe it's that the image file "Au0tBpk.png" is no longer at imgur.com.

Wonder where it went. ?

John F. Uhden

Message 10 of 10
john.uhden
in reply to: Kent1Cooper

@Kent1Cooper 

@ВeekeeCZ 

Maybe I'm out of line, but I still think of BeekeeCZ as a gal, even if her new ID is somewhat hexadecimal looking.

John F. Uhden

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Autodesk Design & Make Report