Jump to content

Check for a certain MLEADERSTYLE in Autolisp


Recommended Posts

Posted

Okay so I have to purge our drawings a lot and we have some multileader styles that are rarely used. So I am trying to create a lisp with an "if" statement that checks to see if the mleaderstyle exists. If it exists it will proceed with drawing the lisp but if it does not exist it will insert a block with the style then proceed with the rest of the actions.

 

Can anyone help me with an example of an if statement that would work for this?

 

I have been searching for quite a while with little success.

 

Thanks you,

 

J

Posted

Something like this perhaps:

 

(defun LM:MLeaderStylep ( style )  
 (and
   (setq dict (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE"))
   (dictsearch (cdr (assoc -1 dict)) style)
 )
)

 

Returns T if style argument is an MLeaderStyle, else nil.

 

(LM:MLeaderStylep "Standard")

  • 12 years later...
Posted (edited)
On 12/28/2010 at 1:06 PM, Lee Mac said:

Something like this perhaps:

 

 

(defun LM:MLeaderStylep ( style )  
 (and
   (setq dict (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE"))
   (dictsearch (cdr (assoc -1 dict)) style)
 )
)
 

 

 

Returns T if style argument is an MLeaderStyle, else nil.

 

 

(LM:MLeaderStylep "Standard")
 

 

 

I realize this is an old thread, but thanks Lee for yet another one. Your subfunctions really make life easy. 

 

Edited by chulse
  • 2 weeks later...
Posted
On 7/25/2023 at 8:57 PM, chulse said:

I realize this is an old thread, but thanks Lee for yet another one. Your subfunctions really make life easy.

 

You're welcome! I'm glad it helped!

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