Author Topic: Accessing Dictionaries  (Read 7001 times)

0 Members and 1 Guest are viewing this topic.

psuchewinner

  • Guest
Accessing Dictionaries
« on: January 23, 2010, 09:13:09 AM »
I have a question concerning Dictionaries and ActiveX (I guess it is ActiveX).  I know I can access the MLEADERSTYLE dictionary as shown below:

(setq AcadDoc (vla-get-activedocument (vlax-get-acad-object)))
     #<VLA-OBJECT IAcadDocument 02bafac8>[/size][/size][/size]
(setq mldrdict (vla-item (vla-get-dictionaries AcadDoc)  "ACAD_MLEADERSTYLE"))
     #<VLA-OBJECT IAcadDictionary 197d47d4>

My question is, Can I access the Dictionary “standard” in the same way?

I know it is there because I can access it like this:

(setq maindict (entget maindict))

 ((-1 . <Entity name: 7eec1c60>) (0 . "DICTIONARY") (330 . <Entity name: 0>) (5 . "C") (100 . "AcDbDictionary") (280 . 0) (281 . 1)  
 (3 . "ACAD_COLOR") (350 . <Entity name: 7eec1e18>) (3 . "ACAD_GROUP") (350 . <Entity name: 7eec1c68>) (3 . "ACAD_LAYOUT")
(350 . <Entity name: 7eec1cd0>) (3 . "ACAD_MATERIAL") (350 . <Entity name: 7eec1e10>) (3 . "ACAD_MLEADERSTYLE").........etc.

(setq mldrdict (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE"))

 ((-1 . <Entity name: 7eec3078>) (0 . "DICTIONARY") (5 . "D7") (102 . "{ACAD_REACTORS") (330 . <Entity name: 7eec1c60>) 102 . "}")
 (330 . <Entity name: 7eec1c60>) (100 . "AcDbDictionary") (280 . 0) (281 . 1) (3 . "Annotative") (350 . <Entity name: 7eec30e8>)
  (3 . "Standard") (350 . <Entity name: 7eec3080>))

(setq Standard (dictsearch (cdr (assoc -1 mldrdict)) "standard"))

 ((-1 . <Entity name: 7eec3080>) (0 . "MLEADERSTYLE") (5 . "D8") (102 . "{ACAD_REACTORS") (330 . <Entity name: 7eec3078>)
 (102 . "}")
 (330 . <Entity name: 7eec3078>) (100 . "AcDbMLeaderStyle") (179 . 2) (170 . 2) (171 . 1) (172 . 0) (90 . 2) (40 . 0.0) (41 . 0.0)
 (173 . 1)  (91 . -1056964608) (340 . <Entity name: 7eec1ca0>) (92 . -2) (290 . 1) (42 . 0.09) (291 . 1) (43 . 0.36) (3 . "Standard")
 (341 . <Entity  name: 0>) (44 . 0.18) (300 . "") (342 . <Entity name: 7eec1c88>) (174 . 1) (178 . 1) (175 . 1) (176 . 0)
 (93 . -1056964608) (45 . 0.18) (292 . 0) (297 . 0) (46 . 0.18) (343 . <Entity name: 0>) (94 . -1056964608) (47 . 1.0) (49 . 1.0)
 (140 . 1.0) (293 . 1) (141 . 0.0) (294 . 1) (177 . 0) (142 . 1.0) (295 . 0) (296 . 0) (143 . 0.125) (271 . 0) (272 . 9) (273 . 9))

I am trying to learn something new.  Can anyone help?
« Last Edit: January 23, 2010, 09:17:57 AM by psuchewinner »

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Accessing Dictionaries
« Reply #1 on: January 23, 2010, 10:01:16 AM »
Hi,

Code: [Select]
(vla-GetObject mldrdict "Standard")
But IMO, it's much more easy to deal with dictionaries using standard AutoLISP than using ActiveX.
Visual LISP (ActiveX) isn't always a better way.
Sometimes they're no other LISP way than using ActiveX, sometimes it's the inverse...
Sometimes ActiveX runs faster, sometimes it's AutoLISP...
Speaking English as a French Frog

psuchewinner

  • Guest
Re: Accessing Dictionaries
« Reply #2 on: January 23, 2010, 10:25:58 AM »
Thanks.  That is exactly what I was looking for.  I like the way it is listed in the "inspect" window.  It is clearer than the DFX codes.  Now I've got a visual.  Thanks for the help.  Guess I wasnt thinking simply enough.

Joe Burke

  • Guest
Re: Accessing Dictionaries
« Reply #3 on: January 23, 2010, 10:30:43 AM »
In addition to what gile said...

Command: (setq doc (vla-get-activedocument (vlax-get-acad-object)))
#<VLA-OBJECT IAcadDocument 01f08158>

Command: (setq dict (vla-item (vla-get-dictionaries doc) "ACAD_MLEADERSTYLE"))
#<VLA-OBJECT IAcadDictionary 0b58ba34>

Command: (vlax-for x dict (vla-getname dict x))
"Standard"