- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello guys how are you, today I want to ask some questions about dictionaries.
1.- Is there a function where I can list the names of all the dictionaries that are in the drawing?
2.- How can I eliminate one or all the dictionaries that are in the drawing?
3.- How can I prevent any error of a variable in the dictionary?
I explain what happened to me.
I use this function to create the dictionaries.
And everything works fine.
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(defun dicc (/)
(if (vl-catch-all-error-p (vl-catch-all-apply 'vla-item (list (vla-get-dictionaries doc) "CONO-ALTURA")))
(progn (vla-add (vla-get-dictionaries doc) "CONO-ALTURA")
(vlax-ldata-put "CONO-ALTURA" "cgp-height" 0.5)
(vlax-ldata-put "CONO-ALTURA" "cant-line" 10))))
(dicc)
But for some reason, the program gave an error and the variable "cant-line" was stored as nil.
And when I tried to use (itoa (vlax-ldata-get "CONO-ALTURA" "cant-line")) it gave me an error.
And I couldn't use the program on that file anymore, until I checked the code and realized it was because it was set to nil.
But I don't know how I can modify the function.
Because it checks if the dictionary exists, if it doesn't it creates it, but if it exists, it doesn't do anything and the "cant-line" variable is still nil.
But I don't want to lose the last value saved in the dictionary, only if it's an error, re-set the initial value of the variable that is wrong.
Beforehand thank you very much.
And I hope you can help me.
Greetings.
AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)
Solved! Go to Solution.