How to find mleader styles

How to find mleader styles

Anonymous
Not applicable
1,941 Views
10 Replies
Message 1 of 11

How to find mleader styles

Anonymous
Not applicable

In a drawing, how can i get a list of available mleader styles or see if a particular style is available?  

0 Likes
Accepted solutions (1)
1,942 Views
10 Replies
Replies (10)
Message 2 of 11

dbroad
Mentor
Mentor

This is code from the autodesk knowledge network that should give you all the start you need.  All you need to revise is from the foreach to an assoc.  You could find it here

https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-AutoLISP/file...

 

or just google autocad list dictionary entries

 

(defun c:ListDictionaries ( / ed ed1)
  (prompt "\nDictionaries in current drawing: ")
  (foreach ed (entget (namedobjdict))
    (progn
      (cond ((= (car ed) 3)
        (prompt (strcat "\n" (cdr ed))))
            ((= (car ed) 350)
        (progn
          (foreach ed1 (entget (cdr ed))
            (if (= (car ed1) 3)
              (prompt (strcat "\n  " (cdr ed1)))
            )
          )
        ))
      )
    )
  )
 (princ)
)
Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 3 of 11

Anonymous
Not applicable
Accepted solution
(setq Acad_Obj (vla-get-activedocument (vlax-get-acad-object)))
(setq MLeader_Dict (vla-item (vla-get-dictionaries Acad_Obj) "ACAD_MLEADERSTYLE"))
(vlax-for Item MLeader_Dict
(princ "\nMleaderStyle = ")
(princ (vlax-get-property Item 'Name))
)
Message 4 of 11

Anonymous
Not applicable

Great this is what i was looking for! 😃

0 Likes
Message 5 of 11

cschnarr
Enthusiast
Enthusiast

@Anonymous 

I found this discussion today. I am trying to make a list of all the non-annotative Multileader styles in the current drawing, to feed the list to a list box for a user selection. Your code makes a list, and prints the list. I want to store the list in a variable, but exclude any annotative Multileader Styles. Do you have any suggestion how to generate this list for use in my code?

0 Likes
Message 6 of 11

Sea-Haven
Mentor
Mentor

Have a look at this test code and in particular the Annotative property. Should give you the answer you seek.

 

 

(setq MLeader_Dict (vla-item (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object))) "ACAD_MLEADERSTYLE"))
(vlax-for Item MLeader_Dict
(VLAX-DUMP-OBJECT ITEM)
)

 

 

0 Likes
Message 7 of 11

ronjonp
Mentor
Mentor

Try this:

(vlax-for i (vla-item (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object)))
		      "ACAD_MLEADERSTYLE"
	    )
  (if (= 0 (vlax-get i 'annotative))
    (setq r (cons (vla-get-name i) r))
  )
)
0 Likes
Message 8 of 11

cschnarr
Enthusiast
Enthusiast

@ronjonp 

What is the name of the list created? "i" ?

0 Likes
Message 9 of 11

ronjonp
Mentor
Mentor

@cschnarr wrote:

@ronjonp 

What is the name of the list created? "i" ?


'r' is the list created.

0 Likes
Message 10 of 11

cschnarr
Enthusiast
Enthusiast

@ronjonp 

Got it working as desired now. Thank you for your insights!

0 Likes
Message 11 of 11

ronjonp
Mentor
Mentor

@cschnarr wrote:

@ronjonp 

Got it working as desired now. Thank you for your insights!


Glad to help 🍻

0 Likes