Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Store variable information in dwg?

17 REPLIES 17
SOLVED
Reply
Message 1 of 18
mid-awe
1087 Views, 17 Replies

Store variable information in dwg?

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
17 REPLIES 17
Message 2 of 18
Anonymous
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
Message 3 of 18
mid-awe
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
Message 4 of 18
Anonymous
in reply to: mid-awe

Check out the dwgvar.lsp on Tony Tanzillo's website.
Message 5 of 18
Anonymous
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
Message 6 of 18
Anonymous
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
Message 7 of 18
mid-awe
in reply to: mid-awe

Thanks, just what I needed 🙂

Everything I find in the '07 developer help seems incomplete.
Message 8 of 18
Anonymous
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
Message 9 of 18
Anonymous
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
Message 10 of 18
Anonymous
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
Message 11 of 18
mid-awe
in reply to: mid-awe

What is your email?

I tried converting "jmaeding - athunsaker - com" but no good 😞

or email me cmiddaugh ta paddockpools tod net Message was edited by: MiD-AwE
Message 12 of 18
mid-awe
in reply to: mid-awe

I don't quite understand his terms of use. I'm not self employed does this mean that I cannot use the LISP?
Message 13 of 18
Anonymous
in reply to: mid-awe

This is the full header:

;; SaveData.lsp
;; Save *any* variable with the DWG
;; Written Nov 30, 1997.
;; Updated for r15 and xdict-* functions added Dec 7, 1999.
;;
;;*************************************************************
;; Copyright Vladimir Nesterovsky 1997, All Rights Reserved
;;
;; You may use, copy and distribute this program *unmodified*
;; for any non-commercial, non-profit purpose and without
;; charging any fee, if you keep this notice in its entirety
;; in all copies and in all your derived works.
;;
;; This program is provided "AS IS" and has absolutely
;; no warranty of any kind. Use it at your own risk.
;;
;; You're welcome to contact me about the possibility to use
;; this program commercially, and also with any comments and
;; requests at vnestr@netvision.net.il,
;; http://vnestr.tripod.com/
;;*************************************************************
;;
;; 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.
;;
;; look into http://vnestr.tripod.com/SaveData.txt !



--

Marc'Antonio Alessi
http://xoomer.virgilio.it/alessi
(strcat "I like " (substr (ver) 8 4) "!")

--
Message 14 of 18
Anonymous
in reply to: mid-awe

You actually READ that stuff????
He put it under "Free Stuff"!
Message 15 of 18
Anonymous
in reply to: mid-awe

Who uses AutoCAD for "non-commercial" purposes anyway?
And why put it out for freely available downloading and expect that everyone will to not *modify* your code???


;; You may use, copy and distribute this program *unmodified*
;; for any non-commercial, non-profit purpose and without
;; charging any fee, if you keep this notice in its entirety
;; in all copies and in all your derived works.
;;
;; This program is provided "AS IS" and has absolutely
;; no warranty of any kind. Use it at your own risk.
;;
;; You're welcome to contact me about the possibility to use
;; this program commercially, and also with any comments ....
Message 16 of 18
mid-awe
in reply to: mid-awe

Yeah 🙂

Boring as it may be, I try to respect the wishes of the author. I noticed that the header of Tony's LISP has changed, but he still has the same restrictions as before only placed in an external "Terms of Use" file. What I'm unsure of is this, may I use his LISP to derive free works like GPL or may I only use his LISP if it will NOT result in gain of any kind whatsoever.
If your listening Tony T., would you be willing to clarify? Message was edited by: MiD-AwE
Message 17 of 18
Anonymous
in reply to: mid-awe

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
Message 18 of 18
mid-awe
in reply to: mid-awe

Thank you 🙂

And, I completely agree. As many ways that there are to do code it has likely already been done. Many patents are now and may forever be argued about the true inventor (so far as who invented it first.) I'm obviously a strong supporter of open source and freely share source code whenever free to do so.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost