Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Mentor
mid-awe
Posts: 1,218
Registered: ‎12-08-2004
Message 1 of 18 (179 Views)
Accepted Solution

Store variable information in dwg?

179 Views, 17 Replies
04-25-2006 11:13 AM
Hi all,

Is it possible to store variable information in a dwg? I already use useri1 for vb dialogues, but I have a need to store a number value, somehow, for use in multiple LISPs and sessions, maybe days or weeks between.

Thanks
I attached the code.
It is far superior than user variables or anything else I have found.

By the way, the author can post all the code he wants with whatever warnings, it does not really mean anything.
What if he just added his warning to other's code?

The fact is, if we abuse the kindness of others, that kindness will stop.
None of us have the time or money to litigate each other in court, and even if we did, by the time we realized we were
being sued, the code would be reformatted and rewritten, looking nothing like the original.

So when I post code, I assume everyone will do with it as they please, including selling it. Anyone who thinks their
code is somehow truley original is fooling themselves. I'm sure people like Tony T and others get a kick out of our
claims on original ideas, since we all know we can't survive without eachother's input.

James Maeding
|>I have done this for a long time.
|>I got ahold of a slick routine to save and retrieve lists to the dictionary.
|>Saving a list is way more powerful than saving one value at a time.
|>I even use it to store my own layer states in a drawing, since its so easy.
|>
|>the routine is Dict-Put-Get.lsp
|>I forget the author so I hesitate to post the code.
|>Do a search for this topic in this group to find it, or email me...
|>
|>MiD-AwE <>
|>|>Hi all,
|>|>
|>|> Is it possible to store variable information in a dwg? I already use useri1 for vb dialogues, but I have a need to store a number value, somehow, for use in multiple LISPs and sessions, maybe days or weeks between.
|>|>
|>|>Thanks
|>James Maeding
|>Civil Engineer and Programmer
|>jmaeding - athunsaker - com
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
*Jason Piercey
Message 2 of 18 (179 Views)

Re: Store variable information in dwg?

04-25-2006 11:16 AM in reply to: mid-awe
Have you considered using a dictionary / xrecord.
They are perfect for that sort of thing.

--
Autodesk Discussion Group Facilitator



wrote in message news:5154007@discussion.autodesk.com...
Hi all,

Is it possible to store variable information in a dwg? I already use
useri1 for vb dialogues, but I have a need to store a number value, somehow,
for use in multiple LISPs and sessions, maybe days or weeks between.

Thanks
Mentor
mid-awe
Posts: 1,218
Registered: ‎12-08-2004
Message 3 of 18 (179 Views)

Re: Store variable information in dwg?

04-25-2006 11:20 AM in reply to: mid-awe
I've been quite curious about "dictionary / xrecord" and though I've heard of and understand what it is I do not know where to begin since I've never used such. Can you point me in the right direction? Any topics available in the '07 help?

Thanks
*Allen Johnson
Message 4 of 18 (179 Views)

Re: Store variable information in dwg?

04-25-2006 11:20 AM in reply to: mid-awe
Check out the dwgvar.lsp on Tony Tanzillo's website.
*Jason Piercey
Message 5 of 18 (179 Views)

Re: Store variable information in dwg?

04-25-2006 11:39 AM in reply to: mid-awe
Fair amount of stuff in the activeX and VBA reference
Also might hit google, should be tons of stuff there.

--
Autodesk Discussion Group Facilitator



wrote in message news:5154042@discussion.autodesk.com...
I've been quite curious about "dictionary / xrecord" and though I've heard
of and understand what it is I do not know where to begin since I've never
used such. Can you point me in the right direction? Any topics available in
the '07 help?

Thanks
*Jason Piercey
Message 6 of 18 (179 Views)

Re: Store variable information in dwg?

04-25-2006 11:40 AM in reply to: mid-awe
http://tinyurl.com/edzne should help a little

--
Autodesk Discussion Group Facilitator



wrote in message news:5154042@discussion.autodesk.com...
I've been quite curious about "dictionary / xrecord" and though I've heard
of and understand what it is I do not know where to begin since I've never
used such. Can you point me in the right direction? Any topics available in
the '07 help?

Thanks
Mentor
mid-awe
Posts: 1,218
Registered: ‎12-08-2004
Message 7 of 18 (179 Views)

Re: Store variable information in dwg?

04-25-2006 11:43 AM in reply to: mid-awe
Thanks, just what I needed :smileyhappy:

Everything I find in the '07 developer help seems incomplete.
*Kent Cooper
Message 8 of 18 (179 Views)

Re: Store variable information in dwg?

04-25-2006 12:05 PM in reply to: mid-awe
You can store up to five integers in the USERI1 through USERI5 System
Variables, and five real numbers in USERR1 through USERR5. They are saved
in the drawing file, and remain there. [Oddly, the five User String
variables do not survive past the current drawing session.] But you might
check whether you have any third-party applications or other routines that
are using them, before you decide which one(s) to use.
--
Kent Cooper


wrote...
Hi all,

Is it possible to store variable information in a dwg? I already use
useri1 for vb dialogues, but I have a need to store a number value, somehow,
for use in multiple LISPs and sessions, maybe days or weeks between.

Thanks
*James Maeding
Message 9 of 18 (180 Views)

Re: Store variable information in dwg?

04-25-2006 01:11 PM in reply to: mid-awe
I have done this for a long time.
I got ahold of a slick routine to save and retrieve lists to the dictionary.
Saving a list is way more powerful than saving one value at a time.
I even use it to store my own layer states in a drawing, since its so easy.

the routine is Dict-Put-Get.lsp
I forget the author so I hesitate to post the code.
Do a search for this topic in this group to find it, or email me...

MiD-AwE <>
|>Hi all,
|>
|> Is it possible to store variable information in a dwg? I already use useri1 for vb dialogues, but I have a need to store a number value, somehow, for use in multiple LISPs and sessions, maybe days or weeks between.
|>
|>Thanks
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
*James Maeding
Message 10 of 18 (180 Views)

Re: Store variable information in dwg?

04-25-2006 01:21 PM in reply to: mid-awe
I just did a search and could not find it,
the code starts with this, please claim it if you wrote it so I can give credit.

;; Dict-Put-Get.lsp
;; Save *any* variable with the DWG
;; Written Nov 30, 1997.
;; Updated for r15 and xdict-* functions added Dec 7, 1999.
;;
;; This file contains functions that will let you save any
;; list of data without dotted pairs inside dictionary with
;; (dict-put "mydict" "mykey" "myval")
;; and retrieve it later with
;; (dict-get "mydict" "mykey")
;; OR store it in xdictionary under some entity with
;; (xdict-put ename "mykey" "myval")
;; and retrieve it similarly with
;; (xdict-get ename "mykey")
;; xdictionary only allows for one key to hold the data,
;; regular dictionaries don't have this restriction, so you
;; may use any number of keys inside your dictionary
;;*************************************************************
;;
;; BEWARE that these functions use recursion in encoding / decoding
;; so for very long and complex lists they can use up all available
;; AutoLISP stack space and cause "AutoLISP stack overflow" error.
;;

;;;;;;;~~~~~~~~~~~~~~~~~~~~~~~~~~~~;;;;;;;
;;;;;;; The two working functions: ;;;;;;;
;;;;;;;____________________________;;;;;;;
;;
;;Sample use:
;; (dict-put "mydict" "mykey" '(1 (2 ("3" (44.4) (5.5 6.6 7.7) 8)) 999999))
;; (dict-get "mydict" "mykey")
;;POSSIBLE IMPROVEMENTS:
;; implement dict-append ( APPEND PREPEND )

James Maeding
|>I have done this for a long time.
|>I got ahold of a slick routine to save and retrieve lists to the dictionary.
|>Saving a list is way more powerful than saving one value at a time.
|>I even use it to store my own layer states in a drawing, since its so easy.
|>
|>the routine is Dict-Put-Get.lsp
|>I forget the author so I hesitate to post the code.
|>Do a search for this topic in this group to find it, or email me...
|>
|>MiD-AwE <>
|>|>Hi all,
|>|>
|>|> Is it possible to store variable information in a dwg? I already use useri1 for vb dialogues, but I have a need to store a number value, somehow, for use in multiple LISPs and sessions, maybe days or weeks between.
|>|>
|>|>Thanks
|>James Maeding
|>Civil Engineer and Programmer
|>jmaeding - athunsaker - com
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.