Page 1 of 1

vlax-for issue

Posted: Sun Apr 07, 2024 5:43 pm
by pmeadow01
In AutoCAD the following lisp expression:
(vlax-for dict (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object))) (print dict))
returns:
#<VLA-OBJECT IAcadDictionary 000002a65a328cb8>
#<VLA-OBJECT IAcadXRecord 000002a65a329528>
#<VLA-OBJECT IAcadDictionary 000002a65a328958>
#<VLA-OBJECT IAcadDictionary 000002a65a329ac8>
#<VLA-OBJECT IAcadGroups 000002a65a329eb8>
#<VLA-OBJECT IAcadDictionary 000002a65a329e28>
#<VLA-OBJECT IAcadObject 000002a65a327f38>
#<VLA-OBJECT IAcadLayouts 000002a65a315f38>
#<VLA-OBJECT IAcadMaterials 000002a65a317d08>
#<VLA-OBJECT IAcadDictionary 000002a65a317f48>
#<VLA-OBJECT IAcadDictionary 000002a65a316448>
#<VLA-OBJECT IAcadPlotConfigurations 000002a65a3168c8>
#<VLA-OBJECT IAcadDictionary 000002a65a315fc8>
#<VLA-OBJECT IAcadDictionary 000002a65a316f88>
#<VLA-OBJECT IAcadDictionary 000002a65a317138>
#<VLA-OBJECT IAcadDictionary 000002a65a316a78>
#<VLA-OBJECT IAcadDictionary 000002a65a316c28>
#<VLA-OBJECT IAcadDictionary 000002a65a3172e8>
#<VLA-OBJECT IAcadDictionary 000002a65a329d98>
which is what I expect.

However in IntelliCAD same lisp expression returns nothing, so I can't iterate through the vla objects.

Does anyone have a possible workaround?

Side note:
(vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object)))
returns:
#<VLA-OBJECT IIcadDictionaries 9b73a1a0> in IntelliCAD
and:
#<VLA-OBJECT IAcadDictionaries 000002a65a329c78> in AutoCAD
So, basically the same until I try to use vlax-for

Re: vlax-for issue

Posted: Sun Apr 14, 2024 7:10 pm
by QuanNguyen
Hi,
Try using standard AutoLISP instead.

Code: Select all

(entget (namedobjdict))
((-1 . <Entity name: 400a16a0>) (0 . "DICTIONARY") (5 . "C") (330 . <Entity name: 0>) (100 . "AcDbDictionary") (281 . 1) (3 . "{24DE2741-47F6-4298-B91B-737E814BAE3E}") (350 . <Entity name: 3f6f8ea0>) (3 . "ACAD_CIP_PREVIOUS_PRODUCT_INFO") (350 . <Entity name: 400a52a0>) (3 . "ACAD_COLOR") (350 . <Entity name: 400a37a0>) (3 . "ACAD_DETAILVIEWSTYLE") (350 . <Entity name: 400a59e0>) (3 . "ACAD_GROUP") (350 . <Entity name: 400a2120>) (3 . "ACAD_LAST_SAVED_VERSION_INFO") (350 . <Entity name: 3f6fac60>) (3 . "ACAD_LAYOUT") (350 . <Entity name: 400a1160>) (3 . "ACAD_MATERIAL") (350 . <Entity name: 400a3760>) (3 . "ACAD_MLEADERSTYLE") (350 . <Entity name: 400a4b60>) (3 . "ACAD_MLINESTYLE") (350 . <Entity name: 400a14e0>) (3 . "ACAD_PLOTSETTINGS") (350 . <Entity name: 400a1520>) (3 . "ACAD_PLOTSTYLENAME") (350 . <Entity name: 400a1ea0>) (3 . "ACAD_RENDER_ACTIVE_RAPIDRT_SETTINGS") (350 . <Entity name: 3f6f9560>) (3 . "ACAD_RENDER_ACTIVE_SETTINGS") (350 . <Entity name: 3f6faea0>) (3 . "ACAD_SCALELIST") (350 . <Entity name: 400a4460>) (3 . "ACAD_SECTIONVIEWSTYLE") (350 . <Entity name: 400a5ae0>) (3 . "ACAD_TABLESTYLE") (350 . <Entity name: 400a3a60>) (3 . "ACAD_VISUALSTYLE") (350 . <Entity name: 400a34a0>) (3 . "AcDbVariableDictionary") (350 . <Entity name: 400a1ae0>) (3 . "AcStStandard") (350 . <Entity name: 3f6f8f60>) (3 . "AEC_DISP_REP_CONFIGURATIONS") (350 . <Entity name: 400aa220>) (3 . "AEC_DISP_REP_SETS") (350 . <Entity name: 400aafe0>) (3 . "AEC_DISP_REPS") (350 . <Entity name: 400a5f20>) (3 . "AEC_DISPLAY_PROPS_DEFAULTS") (350 . <Entity name: 400a51a0>) (3 . "AEC_PROPERTY_SET_DEFS") (350 . <Entity name: 3f6f9ce0>) (3 . "AEC_VARS") (350 . <Entity name: 400a5c60>) (3 . "ASE_INDEX_DICTIONARY") (350 . <Entity name: 3f6faa20>) (3 . "Autodesk_MAP") (350 . <Entity name: 4ae8af60>) (3 . "DX_CIVIL_DICT") (350 . <Entity name: 400a1860>) (3 . "Root") (350 . <Entity name: 400a52e0>))

Then get the ACAD_GROUP (for example):

Code: Select all

(setq dic (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object))))
(setq group (vla-item dic "ACAD_GROUP"))

Re: vlax-for issue

Posted: Thu May 09, 2024 3:16 pm
by pmeadow01
Back from vacation. Thanks for working that through, I can use it.
Pity the vlax-for doesn't work though.