Jump to content

Recommended Posts

Posted

I'm Looking for a Lisp to Uncheck max leader points for all Multileader styles. I've done quite a bit of searching and can't seem to find one. Thanks in advance for any help.

Posted

Need a little bit more info maybe a before and after sample drawing of what your looking to do.

@SLW210 prob will also be moved to AutoLISP, Visual LISP & DCL

  • Like 1
Posted (edited)

Maybe something like this, the item 1 is the second MLSTYLE, need a loop for all. I set style to 4 points then back to 2. use 0 for off.

 

(setq dicts (vla-get-Dictionaries (vla-get-ActiveDocument (vlax-get-acad-object))))
(setq dictObj (vla-Item dicts "acad_mleaderstyle"))
(setq dictObj (vla-Item dictobj 1)) ; second style in my test
(vla-put-MaxLeaderSegmentsPoints dictobj 2)

 

Edited by BIGAL
  • Like 1
Posted

I have moved your thread to the AutoLISP, Visual LISP & DCL Forum, please post in the correct forum.

 

Wouldn't unchecking that box be the same as setting it to 2? See below for correct answer.

Posted

After quickly looking into this...

 

Unchecking the box is equal to no limit.

 

Had a little time at work so... quickly tested.

 

 

;;; Uncheck the Max leader points in the Multileader Style dialog box. (or set a value).                                                |
;;;                                                                                                                                     |
;;; https://www.cadtutor.net/forum/topic/99083-looking-for-lisp-to-uncheck-max-leader-points-for-all-mleader-styles/#findComment-678964 |
;;;                                                                                                                                     |
;;; By SLW210 (a.k.a. Steve Wilson)                                                                                                     |
;;;                                                                                                                                     |
;;;*************************************************************************************************************************************|
;;;*************************************************************************************************************************************|

(defun c:UnchkMLdrPnts (/ acApp doc dict obj)
  (vl-load-com)

  (setq acApp (vlax-get-acad-object))
  (setq doc (vla-get-ActiveDocument acApp))

  (setq dict (vla-Item (vla-get-Dictionaries doc) "ACAD_MLEADERSTYLE"))

  (vlax-for obj dict
    (if (vlax-property-available-p obj 'MaxLeaderSegmentsPoints)
      (vla-put-MaxLeaderSegmentsPoints obj 0) ;; 0 = unlimited
    )
  )

  (princ "\nMax leader points box is unchecked.")
  (princ)
)

 

  • Like 2
Posted

OP seems to have disappeared.

 

I would presume it works as the OP wanted.

 

On doing some thinking on the OPs request, though the suggestion of setting up templates and/or using the create a Multileader Style LISP should handle almost everything, seems adding further options to totally update all or specific Multileader Style(s) might  be an option.

 

I might just play with this if some think it may have some use.

 

I often get old drawings to redo or update, but usually just use the create a Multileader LISP or import a style, maybe just changing the existing style would be as good or better?

 

Though, someone may know, is it possible to also update existing Multileaders  MaxLeaderSegmentsPoints?

Posted

Nice code SLW210. I did get the error that "acad" is a protected symbol, so its better to use a different name for that one.

The code worked fine regardless.

 

We can also do the same thing with entmod:

(defun c:unlimitedmleaders (/ e enx)
  (foreach e
    (vl-remove-if-not
      (function (lambda (a) (= (car a) 350)))
      (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE")
    )
    (setq enx (entget (cdr e)))
    (entmod (subst '(90 . 0) (assoc 90 enx) enx))
  )
  (princ)
)
  • Like 1
Posted

Somehow I didn't get that warning, but I changed it.

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