Author Topic: Search for mleaderstyle  (Read 1808 times)

0 Members and 1 Guest are viewing this topic.

psuchewinner

  • Guest
Search for mleaderstyle
« on: January 25, 2010, 09:19:28 AM »
I need some help in searching for a mleaderstyle to test if it exists.  I hafve not had luck with "tblsearch".

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Search for mleaderstyle
« Reply #1 on: January 25, 2010, 10:30:26 AM »
Try something like this:

Code: [Select]
(vla-item (vla-get-dictionaries
       (vla-get-activedocument (vlax-get-acad-object))
     )
     "ACAD_MLEADERSTYLE"
   )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

psuchewinner

  • Guest
Re: Search for mleaderstyle
« Reply #2 on: January 25, 2010, 10:34:53 AM »
i need to test to see if it is in "ACAD_MLEADERSTYLE".  If I do a (VAL-GETOBJECT "MLDRDICT" "LEADERSTYLE"), i get an invalid key error.  Im looking for a T or F, arent I?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Search for mleaderstyle
« Reply #3 on: January 25, 2010, 10:50:07 AM »
Perhaps something more like this:

Code: [Select]
(defun mleaderstyle-p (name / dic)
  (and (not (vl-catch-all-error-p
      (setq
dic (vl-catch-all-apply
      'vla-item
      (list
(vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object)))
"ACAD_MLEADERSTYLE"
      )
    )
      )
    )
       )
       (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-item (list dic name))))
  )
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Joe Burke

  • Guest
Re: Search for mleaderstyle
« Reply #4 on: January 25, 2010, 10:53:25 AM »
Does this help?

Command: (dictsearch (namedobjdict) "acad_mleaderstyle")
((-1 . <Entity name: 7efdb648>) (0 . "DICTIONARY") (5 . "9DC9") (102 .
"{ACAD_REACTORS") (330 . <Entity name: 7efc6c40>) (102 . "}") (330 . <Entity
name: 7efc6c40>) (100 . "AcDbDictionary") (280 . 0) (281 . 1) (3 . "Copy of
Standard") (350 . <Entity name: 7eb97610>) (3 . "Standard") (350 . <Entity
name: 7efdb650>))

Check the DXF 3 codes

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Search for mleaderstyle
« Reply #5 on: January 25, 2010, 11:01:35 AM »
Good call Joe  :-)

Code: [Select]
(defun mleaderstyle-p (name)
  (vl-position
    name
    (mapcar 'cdr
    (vl-remove-if-not
      '(lambda (x) (= (car x) 3))
      (dictsearch (namedobjdict) "acad_mleaderstyle")
    )
    )
  )
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

psuchewinner

  • Guest
Re: Search for mleaderstyle
« Reply #6 on: January 25, 2010, 01:36:25 PM »
perfect! Thanks!

Joe Burke

  • Guest
Re: Search for mleaderstyle
« Reply #7 on: January 26, 2010, 07:59:29 AM »
You're welcome and thanks to ronjonp for adding the final touches.