Hi all,
I have been working with this and now I get ; error: bad DXF group:
(PROGN (IF (SETQ IDX (dict-get "REVISION" "TOTAL")) (PROGN (REPEAT IDX (SETQ REVS (LIST (STRCAT "REVISION" (ITOA IDX)) (CONS "WHO" (dict-get (STRCAT "REVISION" (ITOA IDX)) "WHO")) (CONS "WHEN" (dict-get (STRCAT "REVISION" (ITOA IDX)) "WHEN")) (CONS "WHAT" (dict-get (STRCAT "REVISION" (ITOA IDX)) "WHAT")) ) REVLST (CONS REVS REVLST) IDX (1- IDX) ) ) ) ) (DICT-PUT "REVISIONS" "LIST" REVLST) )
I'm not actually attempting any DXF so far as I know. I just need to assemble the list to store in the dictionary for later.
This version gives me good results, but, it does not provide the extra distinction of who, when, & what.
(PROGN (IF (SETQ IDX (dict-get "REVISION" "TOTAL")) (PROGN (REPEAT IDX (SETQ REVS (LIST (STRCAT "REVISION" (ITOA IDX)) (dict-get (STRCAT "REVISION" (ITOA IDX)) "WHO") (dict-get (STRCAT "REVISION" (ITOA IDX)) "WHEN") (dict-get (STRCAT "REVISION" (ITOA IDX)) "WHAT") ) REVLST (CONS REVS REVLST) IDX (1- IDX) ) ) ) ) (DICT-PUT "REVISIONS" "LIST" REVLST) )
The expected output is a string formatted as: ("REVISION1" ("WHO" . "NAME") ("WHEN" . "DATE") ("WHAT" . "A SENTENCE ABOUT CHANGES."))
ps- I tried mapcar and lambda but finally gave up and tried this approach. This is as close as I've gotten to my goal.
Please help. Thank you in advance.
Hi,
Can you please describe "dict-get"?
Does it something like:
(vlax-ldata-get dict key [default-data [private]])
?
Thanks,
@ aqdam1978
Ok, so everything works as I need with "vlax-ldata-put" & fails with "dict-put". So, there must be more differences than I am aware of.
I suppose that it is time to switch. Thanks for the help. It was your question that caused me to give it a look.
Hi mid-awe,
your first atempt should returns (I don't have AutoCAD to test) a list as you expect, like this
("REVISION1" ("WHO" . "NAME") ("WHEN" . "DATE") ("WHAT" . "A SENTENCE ABOUT CHANGES."))
your first atempt should returns a list like this ("REVISION1" "NAME" "DATE" "A SENTENCE ABOUT CHANGES")
and you say that tou can you put that information in the dictionary, without problem...
For testing purposes, try
(PROGN (IF (SETQ IDX (dict-get "REVISION" "TOTAL")) (PROGN (REPEAT IDX (SETQ REVS (LIST (cons "REVISION" (ITOA IDX)) (CONS "WHO" (dict-get (STRCAT "REVISION" (ITOA IDX)) "WHO")) (CONS "WHEN" (dict-get (STRCAT "REVISION" (ITOA IDX)) "WHEN")) (CONS "WHAT" (dict-get (STRCAT "REVISION" (ITOA IDX)) "WHAT")) ) REVLST (CONS REVS REVLST) IDX (1- IDX) ) ) ) ) (DICT-PUT "REVISIONS" "LIST" REVLST) )
Do you get any error?
EDIT: too slow
Henrique
Everything works with "vlax-ldata-put". I compare the output from both functions and I suspect, if I did: (dict-put "revisions" "list" 'revlist), then it would work. I'm not at my desk right now, but I'll give it a test in the morning.
Thanks again.