Author Topic: reuse saved variables  (Read 12847 times)

0 Members and 1 Guest are viewing this topic.

ribarm

  • Gator
  • Posts: 3266
  • Marko Ribar, architect
reuse saved variables
« on: December 16, 2015, 12:35:47 PM »
Hi, I have question/request... Lets say I have stored some variables during my ACAD session as global variables... The question is : is there some ready routine that will prompt me to choose variables from memory and save them into external txt file from which with another similar routine I can safely exit ACAD session, start new one, load lisp, browse for a stored txt file and restore them back into ACAD memory - but in different session... All variable names should be the same as their corresponding data values...

Maybe if it doesn't exist this may be some challenge for some experience programmer to tackle this task...

Opinion or advice, I am hoping I am not asking too much, but I think it may be useful for all *CAD users...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: reuse saved variables
« Reply #1 on: December 16, 2015, 01:32:50 PM »
I had written something like that when I was a CAD mgr for trouble-shooting and what-not but I'd have to see if I have any of that stuff still (doubtful but worth a look). However, your request sounds a bit vague (the stuff I had written back when was more for trouble-shooting not session restoration); you may want to narrow your options.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: reuse saved variables
« Reply #2 on: December 16, 2015, 01:52:15 PM »
You would need to store the contents of (atoms-family) on drawing startup and then have your variable saving program compare the current content of (atoms-family) with the stored data, removing symbols present in the stored data in order to leave only global variables and variables defined within the scope of the program itself.

ribarm

  • Gator
  • Posts: 3266
  • Marko Ribar, architect
Re: reuse saved variables
« Reply #3 on: December 16, 2015, 02:02:28 PM »
You would need to store the contents of (atoms-family) on drawing startup and then have your variable saving program compare the current content of (atoms-family) with the stored data, removing symbols present in the stored data in order to leave only global variables and variables defined within the scope of the program itself.

How difficult would it be if I wanted to save all variables (atoms) with (type) 'SYM, 'INT, 'LIST, 'REAL, 'STR? Would it take to much memory - I suppose I don't have to compare (atoms-family) at start of session with finish session when all needed variables are stored in memory - or I am wrong?
« Last Edit: December 16, 2015, 02:18:45 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: reuse saved variables
« Reply #4 on: December 16, 2015, 02:25:28 PM »
You are essentially describing the Express Tools 'LSP' command (lspdata.lsp).

You have two options:

1. Store the content of (atoms-family) at the start of the session (i.e. before any additional symbols are defined) and subsequently compare this with the list returned by (atoms-family).

2. Hard-code the known content of (atoms-family) and then compare the current list with this hard coded data - this is how lspdata.lsp operates.

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: reuse saved variables
« Reply #5 on: December 16, 2015, 02:26:59 PM »
How difficult would it be if I wanted to save all variables (atoms) with (type) 'SYM, 'INT, 'LIST, 'REAL, 'STR? Would it take to much memory - I suppose I don't have to compare (atoms-family) at start of session with finish session when all needed variables are stored in memory - or I am wrong?

Memory isn't really the issue (you're storing them in a text file) however, you will be doing a bit of processing so you better make spend some time on making that code lean.  ...don't focus on the "how" yet. Focus on the "why". Why are wanting this (did something go wrong or are you looking to index your current lisps)?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: reuse saved variables
« Reply #6 on: December 16, 2015, 02:28:31 PM »
You are essentially describing the Express Tools 'LSP' command (lspdata.lsp).

You have two options:

1. Store the content of (atoms-family) at the start of the session (i.e. before any additional symbols are defined) and subsequently compare this with the list returned by (atoms-family).

2. Hard-code the known content of (atoms-family) and then compare the current list with this hard coded data - this is how lspdata.lsp operates

There was a built in tool for this?! Oops, I guess I shouldn't have made my own back then (dummy).
Pointy hat --> 7
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

ribarm

  • Gator
  • Posts: 3266
  • Marko Ribar, architect
Re: reuse saved variables
« Reply #7 on: December 16, 2015, 05:36:06 PM »
I did something... I hope it's fine - it worked for me in my limited tests... Please read comments in header of lisp "variables.lsp"
(I was using Lee's 1st method, but I've stored preliminary atoms-family into *atoms* variable which is later just used, but not accounted into variables list...)

Code - Auto/Visual Lisp: [Select]
  1. ;;;
  2. ;;; put this lisp at line before last in acaddoc.lsp : (if (findfile "variables.lsp") (load "variables.lsp") (load (getfiled "Select variables.lsp file" "\\" "lsp" 16)))
  3. ;;;
  4. ;;; put this line as last one in acaddoc.lsp : (setq *atoms* (atoms-family 1))
  5. ;;;
  6.  
  7. (defun c:var-save ( / varlst f1 f2 n )
  8.   (setq varlst (vl-remove-if '(lambda ( x ) (vl-position x *atoms*)) (atoms-family 1)))
  9.   (setq varlst (vl-remove "*ATOMS*" varlst))
  10.   (foreach var varlst
  11.     (if (not (or (eq (type (eval (read var))) 'SYM) (eq (type (eval (read var))) 'INT) (eq (type (eval (read var))) 'STR) (eq (type (eval (read var))) 'LIST) (eq (type (eval (read var))) 'REAL)))
  12.       (setq varlst (vl-remove var varlst))
  13.     )
  14.   )
  15.   (setq f1 (open (getfiled "Save variable names file" "\\varnames" "txt" 1) "w"))
  16.   (setq n -1)
  17.   (foreach var varlst
  18.     (write-line (nth (setq n (1+ n)) varlst) f1)
  19.   )
  20.   (close f1)
  21.   (setq f2 (open (getfiled "Save variable values file" "\\varvalues" "txt" 1) "w"))
  22.   (foreach var varlst
  23.     (write-line (vl-prin1-to-string (eval (read var))) f2)
  24.     (princ "\n" f2)
  25.   )
  26.   (close f2)
  27.   (princ)
  28. )
  29.  
  30. (defun c:var-load ( / f1 f2 varlst varvallst l ll )
  31.   (setq f1 (open (getfiled "Load variable names file" "\\varnames" "txt" 16) "r"))
  32.   (while (setq l (read-line f1))
  33.     (setq varlst (cons (read l) varlst))
  34.   )
  35.   (close f1)
  36.   (setq ll "")
  37.   (setq f2 (open (getfiled "Load variable values file" "\\varvalues" "txt" 16) "r"))
  38.   (while (setq l (read-line f2))
  39.     (if (not (eq l ""))
  40.       (setq ll (strcat ll l))
  41.       (progn
  42.         (setq varvallst (cons (read ll) varvallst))
  43.         (setq ll "")
  44.       )
  45.     )
  46.   )
  47.   (close f2)
  48.   (mapcar 'set varlst varvallst)
  49.   (princ)
  50. )
  51.  

It helps me, so I thought it should be useful someone sometime...
M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: reuse saved variables
« Reply #8 on: December 17, 2015, 04:37:22 AM »
Some issues that are worth considering:
1.
Accuracy of stored reals.
2.
A list may need to be analysed before being stored. Example: storing a list of enames is not useful.
3.
The 'load' function will overwrite existing values. This may not always be wise.
4.
Why not use a single file to store both the names and the values of the variables?

ribarm

  • Gator
  • Posts: 3266
  • Marko Ribar, architect
Re: reuse saved variables
« Reply #9 on: December 17, 2015, 07:14:42 AM »
Some issues that are worth considering:
1.
Accuracy of stored reals.
2.
A list may need to be analysed before being stored. Example: storing a list of enames is not useful.
3.
The 'load' function will overwrite existing values. This may not always be wise.
4.
Why not use a single file to store both the names and the values of the variables?

I can only confirm loosing of data with REAL numbers, and as far as I know there is no possibility to force *CAD to display long real values stored into 'REAL or 'LIST atoms... I don't know where to look to make (force) *CAD operates this way... So for ex. PI variable is actually truncated and when typed !PI in command prompt only 5 decimal digits are displayed - that's how much (read somenumberstring) can actually display even if (setq somenumberstring "99.9999999999999999999999999")... Only this problem occurs to me from those that you've stated, with other issues I can live... Maybe Autodesk should consider including some sysvar for this functionality, till then I think my lisp variables.lsp is actually correct - if and when Autodesk introduces this new functionality if I don't revise my above posted code, user should consider this lack and prevent loosing data when saving variable values comes into question... As for 2 separate *.txt files, I don't really mind - it was the way I wrote those (c:var-save) and (c:var-load) functions - when I was writing them firstly I had in mind 1 txt file, but then I realized that with (while (read-line f) ... ) where f is 'FILE I was in programming problem of how to obtain and reassign values to their corresponding symbol specifications...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: reuse saved variables
« Reply #10 on: December 17, 2015, 08:16:07 AM »
Well, I got a chance to look through some of my old USB sticks and I did find something (very early in the development it appears) but if anyone can glean or use anything from it, I'll be happy.

Code - Auto/Visual Lisp: [Select]
  1. ;;;===================================================================;
  2. ;;;===================================================================;
  3. ;;; Demmand loading of settings done from acad.lsp file for company   ;
  4. ;;; standards.                                                        ;
  5. ;;;===================================================================;
  6. ;;;===================================================================;
  7.  
  8. (
  9.  ;; first test run for a proced that will run a list of commands.
  10.  ;; TODO: add error trapping on the hookanddo portion of this app.
  11.    ( /        m-list
  12.               push->lst
  13.               list-pop
  14.               plug-in
  15.               plug-in
  16.               pop-out
  17.               hook
  18.               popout-hook-and-do
  19.               fill-list-from-file
  20.               )
  21.    ;; //-- Begin Support Procedures --//
  22.    (defun push->lst (sym lst)
  23.      ;; push-lst
  24.      ;; put an item first into existing list.
  25.      ;;
  26.      ;; Ex: (push->lst 'one 'masterlist)
  27.      ;;    > (ONE)
  28.      ;;    > !masterlist
  29.      ;;    > (ONE)
  30.      ;;
  31.      ;; Notes: One benifit for using this method is that
  32.      ;;    the list is created for you. better then;
  33.      ;;    (setq masterlist (cons ... masterlist))
  34.      ;;    This results in less confusion in final code.
  35.      ;;
  36.      ;; By: John (Se7en) K
  37.      ;;    (inspired by Vladimir Nesterovsky)
  38.      (set lst (cons sym (eval lst))) )
  39.  
  40.    (defun list-pop (lst / ~tval )
  41.      ;; list-pop
  42.      ;; remove the first item from a list and redefne the var
  43.      ;; containing that list For example:
  44.      ;; Given a list called "masterlist" with the
  45.      ;; value of: (TWO ONE)
  46.      ;;
  47.      ;; !masterlist
  48.      ;; (TWO ONE)
  49.      ;;
  50.      ;; (list-pop 'masterlist)
  51.      ;; TWO
  52.      ;;
  53.      ;; (list-pop 'masterlist)
  54.      ;; ONE
  55.      ;;
  56.      ;; !masterlist
  57.      ;; nil
  58.      ;;
  59.      ;; By: John (Se7en) K
  60.      ;;    (inspired by Vladimir Nesterovsky)
  61.      (setq ~tval (eval lst))
  62.      (set lst (cdr ~tval))
  63.      (car ~tval) )
  64.  
  65.    ;; NOTE: Removed the next two procedures because first
  66.    ;;       testing phase is over and they are not needed.
  67.    ;;
  68.    ;;   (defun plug-in ( proced )
  69.    ;;     ;; add an item to a global list
  70.    ;;     (push->lst proced 'proced-list) )
  71.    ;;
  72.    ;;   (defun pop-out ( )
  73.    ;;     ;; remove an item from a global list
  74.    ;;     (list-pop 'proced-list) )
  75.  
  76.    (defun hook (func)
  77.      ;; hook
  78.      ;; this function will take an argument and turn it into a
  79.      ;; lambda expression to evaluate. (You can assign an variable
  80.      ;; and assign it at a later time if you wish.)
  81.      ;;
  82.      ;; By: John (Se7en) K
  83.      ;;    (inspired by Vladimir Nesterovsky)
  84.      ;;
  85.      ;; Ex: (hook '(+ 1 2))
  86.      ;;     > ((LAMBDA nil (+ 1 2)))
  87.      ;;    
  88.      (list (cons 'lambda (cons nil (list func)))) )
  89.  
  90.    (defun popout-hook-and-do ( / x )
  91.      (setq x (list-pop 'proced-list))
  92.      (if x (eval (hook x))) )
  93.  
  94.    (defun fill-list-from-file ( filename-str / fp )
  95.      ;; fill-list-from-file
  96.      ;;
  97.      ;; (fill-list-from-file "c:\\test.dat")
  98.      ;; > ((ALERT "test2") (ALERT "test1"))
  99.      ;;
  100.      ;; TODO add a filter for the path variables
  101.      ;;      -ie ACAD => (setenv "ACAD" (strcat <pathstr> (getenv "ACAD")))
  102.      ;;
  103.      (setq fp (open filename-str "R"))
  104.      (while (setq line (read-line fp))
  105.             (push->lst (read line) 'proced-list))
  106.      (close fp)
  107.      my-lst
  108.      )
  109.    ;; //--End Support Procedures--//
  110.  
  111.  
  112.    ;; NOTE: I have removed the next four lines because the first test
  113.    ;;       was sucessfull, I am now moving on to the next phase of
  114.    ;;       of the procedure; reading from a file and filling the list
  115.    ;;       from there.
  116.    ;;
  117.    ;; (setq m-list '((alert "test1") (alert "test2") (alert "test3")))
  118.    ;; build the list of things to do
  119.    ;; build the list by using the ``fill-list-from-file'' proced
  120.    ;; (mapcar 'plug-in m-list)
  121.  
  122.  
  123.    (setq proced-list '((alert "test3") (alert "test2") (alert "test1")))
  124.  
  125.    ;; plug each of those items in the list into a master list
  126.    ;; c:\test.dat contains:
  127.    ;; (alert "test4")
  128.    ;; (alert "test5")
  129.    ;; (alert "test6")
  130.    ;; (alert "test7")
  131.    (fill-list-from-file "c:\\test.dat")
  132.  
  133.    (while proced-list
  134.           (popout-hook-and-do))
  135.    ;; evaluate each item in the list
  136.  
  137.    )
  138.  )

You may want to replace the file reader portion of the code above with something a little quicker which I think I gleaned from something ElpanovEvgeniy penned once.
Code - Auto/Visual Lisp: [Select]
  1. (defun file-get-list-from ( name / fp lst read-file-into-list )
  2.   ;; file-get-list-from
  3.   ;;
  4.   ;; GENERAL FILE READER
  5.   ;; given a file name this procedure will read the contents
  6.   ;; into a list
  7.   ;;
  8.   ;; EX:
  9.   ;;    (mapcar
  10.   ;;       'read (get-list-from-file
  11.   ;;         (findfile layers-to-load-from-file)))
  12.   ;;
  13. (defun read-file-into-list ( str file )         ;;/*{{{*/
  14.   (if str
  15.     (cons
  16.       (if str str)
  17.       (read-file-into-list (read-line file) file))))    ;;/*}}}*/
  18.   (setq fp (open name "R"))
  19.   (setq lst (read-file-into-list (read-line fp) fp))
  20.   (close fp)
  21.  lst )


I also found the function below which is in the same spirit of the above. This one looks like it was saving a few of the users environment variables in the same format as the above code expects (I must have had a whole setup at one time).
Code - Auto/Visual Lisp: [Select]
  1. (
  2.  ;; make a backup of users settings.
  3.  (lambda ()
  4.    (setq sys-var-list
  5.          '(
  6.            "ACAD" "ANSIHatch" "ANSILinetype" "ISOHatch" "ISOLinetype"
  7.            "StartUpType" "Measureinit" "InsertUnitsDefSource"
  8.            "InsertUnitsDefTarget" "LastTemplate" "Pickstyle" "Coords"
  9.            "ShowProxyDialog" "Osmode" "EdgeMode" "PAPERUPDATE" "ACADPLCMD"
  10.            "ImageHighlight" "Attdia" "Attreq" "Delobj" "Dragmode" "UseMRUConfig"
  11.            "PLSPOOLALERT" "PLOTLEGACY" "PSTYLEPOLICY" "OLEQUALITY" "Anyport"
  12.            "Validation Policy" "Validation Strategy" "CommandDialogs"
  13.            "TempDirectory" "PlotSpoolerDirectory" "DefaultLoginName" "MenuFile"
  14.            "NetLocation" "ACADDRV" "ACADHELP" "PrinterConfigDir"
  15.            "PrinterStyleSheetDir" "PrinterDescDir" "NewStyleSheet"
  16.            "DefaultFormatForSave" "DefaultConfig" "LastModifiedConfig"
  17.            "MRUConfig" "ACADLOGFILE" "MaxDwg" "AVEMAPS" "TemplatePath"
  18.            "DatabaseWorkSpacePath" "DefaultPlotStyle" "DefaultLayerZeroPlotStyle"
  19.            "LineWeightUnits" "LWDEFAULT" "CustomColors" "Blipmode" "ToolTips"
  20.            "acet-Enable" "acet-MenuLoad" "AcetRText:type" "CmdVisLines"
  21.            "MaxHatch" "AutoSnapColor" "AutomaticSaveMinutes"
  22.            "SDF_AttributeExtractTemplateFile" "AutoSnapPolarAng"
  23.            "AutoSnapPolarDistance" "AutoSnapPolarAddAng" "AutoSnapControl"
  24.            "AutoSnapTrackPath" "PickBox" "AutoSnapSize" "PickFirst" "PickAuto"
  25.            "MenuOptionFlags" "FontMappingFile" "LogFilePath"
  26.            "PSOUT_PrologFileName" "MainDictionary" "CustomDictionary"
  27.            "MTextEditor" "XrefLoadPath" "SaveFilePath" "AcadLspAsDoc"
  28.            "Background" "Layout background" "XhairPickboxEtc"
  29.            "LayoutXhairPickboxEtc" "Autotracking vector" "MonoVectors" "FontFace"
  30.            "FontHeight" "FontWeight" "FontItalic" "FontPitchAndFamily"
  31.            "CursorSize" "HideWarningDialogs" "SDIMode" "CmdLine.ForeColor"
  32.            "CmdLine.BackColor" "TextWindow.ForeColor" "TextWindow.BackColor"
  33.            "CmdLine.FontFace" "CmdLine.FontHeight" "CmdLine.FontWeight"
  34.            "CmdLine.FontItalic" "CmdLine.FontPitchAndFamily"
  35.            "TextWindow.FontFace" "TextWindow.FontHeight" "TextWindow.FontWeight"
  36.            "TextWindow.FontItalic" "TextWindow.FontPitchAndFamily"
  37.            )
  38.          )
  39.      ;; NOTE: Removed the next four lines because first
  40.      ;;       testing phase is over and they are not needed.
  41.      ;;
  42.         ;;(mapcar
  43.         ;; ;; create backup of orig sys-vars
  44.         ;; ;; ("pickfirst" "1") ("autosnapsize" "5") ("pickbox" "6") ...
  45.         ;;  '(lambda (x)
  46.         ;;     (setq sys-var-backup
  47.         ;;           (cons (list x (eval (list 'getenv x))) sys-var-backup))) sys-var-list)
  48.  
  49.    (setq fp (open "c:\\sys-var-bakup.dat" "A"))
  50.    (mapcar
  51.      '(lambda (x)
  52.         (setq y (eval (list 'getenv x)))
  53.         (write-line
  54.           (strcat "(setenv \"" x "\" \"" (if (not y) "nil" y) "\")") fp))
  55.      sys-var-list
  56.      )
  57.    (close fp)
  58.    )
  59.  )
  60.  

At any rate, I hope at least some of this code is helpful to someone.
« Last Edit: December 17, 2015, 08:19:27 AM by John Kaul (Se7en) »
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: reuse saved variables
« Reply #11 on: December 17, 2015, 09:00:08 AM »
as far as I know there is no possibility to force *CAD to display long real values stored into 'REAL or 'LIST atoms... I don't know where to look to make (force) *CAD operates this way... So for ex. PI variable is actually truncated and when typed !PI in command prompt only 5 decimal digits are displayed - that's how much (read somenumberstring) can actually display even if (setq somenumberstring "99.9999999999999999999999999")

Use rtos in place of vl-prin1-to-string, e.g.:
Code - Auto/Visual Lisp: [Select]
  1. "3.14159"
  2. _$ (rtos pi 2 15)
  3. "3.141592653589793"

ribarm

  • Gator
  • Posts: 3266
  • Marko Ribar, architect
Re: reuse saved variables
« Reply #12 on: December 17, 2015, 10:06:05 AM »
as far as I know there is no possibility to force *CAD to display long real values stored into 'REAL or 'LIST atoms... I don't know where to look to make (force) *CAD operates this way... So for ex. PI variable is actually truncated and when typed !PI in command prompt only 5 decimal digits are displayed - that's how much (read somenumberstring) can actually display even if (setq somenumberstring "99.9999999999999999999999999")

Use rtos in place of vl-prin1-to-string, e.g.:
Code - Auto/Visual Lisp: [Select]
  1. "3.14159"
  2. _$ (rtos pi 2 15)
  3. "3.141592653589793"

Yes it's true, but actually it's not that simple: what shell we do with point lists?... Shouldn't (vl-prin1-to-string) be just enough good to do this task as built-in?... If not revision of this function then I suppose implementing new sysvar for more adequate representation of 'REAL numbers is necessity... Otherwise loosing data is unavoidable outcome...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: reuse saved variables
« Reply #13 on: December 17, 2015, 10:24:33 AM »
as far as I know there is no possibility to force *CAD to display long real values stored into 'REAL or 'LIST atoms... I don't know where to look to make (force) *CAD operates this way... So for ex. PI variable is actually truncated and when typed !PI in command prompt only 5 decimal digits are displayed - that's how much (read somenumberstring) can actually display even if (setq somenumberstring "99.9999999999999999999999999")

Use rtos in place of vl-prin1-to-string, e.g.:
Code - Auto/Visual Lisp: [Select]
  1. "3.14159"
  2. _$ (rtos pi 2 15)
  3. "3.141592653589793"

Yes it's true, but actually it's not that simple: what shell we do with point lists?... Shouldn't (vl-prin1-to-string) be just enough good to do this task as built-in?... If not revision of this function then I suppose implementing new sysvar for more adequate representation of 'REAL numbers is necessity... Otherwise loosing data is unavoidable outcome...
o.0 ... I think you should look at the method I used in storing and retrieving variables.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

ribarm

  • Gator
  • Posts: 3266
  • Marko Ribar, architect
Re: reuse saved variables
« Reply #14 on: December 17, 2015, 11:15:21 AM »
o.0... I don't see the method in above posted examples (link or similar), but beside this if 'LIST is entity DXF data, if I may also say (read) function returns error : extra cdr in dotted pair list... And for me this is odd too... So IMHO I think that at least 2 functions should be revised - or added : something similar to (vl-prin1-to-string) and something similar to (read)... So there it is - if someone wants to tackle it, it would be nice to see result of this challenge...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: reuse saved variables
« Reply #15 on: December 17, 2015, 12:35:02 PM »
as far as I know there is no possibility to force *CAD to display long real values stored into 'REAL or 'LIST atoms... I don't know where to look to make (force) *CAD operates this way... So for ex. PI variable is actually truncated and when typed !PI in command prompt only 5 decimal digits are displayed - that's how much (read somenumberstring) can actually display even if (setq somenumberstring "99.9999999999999999999999999")

Use rtos in place of vl-prin1-to-string, e.g.:
Code - Auto/Visual Lisp: [Select]
  1. "3.14159"
  2. _$ (rtos pi 2 15)
  3. "3.141592653589793"

Yes it's true, but actually it's not that simple: what shell we do with point lists?...

Lists may be processed recursively, converting the relevant data types to strings as required.

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: reuse saved variables
« Reply #16 on: December 17, 2015, 02:39:08 PM »
o.0... I don't see the method in above posted examples (link or similar), but beside this if 'LIST is entity DXF data, if I may also say (read) function returns error : extra cdr in dotted pair list... And for me this is odd too... So IMHO I think that at least 2 functions should be revised - or added : something similar to (vl-prin1-to-string) and something similar to (read)... So there it is - if someone wants to tackle it, it would be nice to see result of this challenge...

From what little AutoLisp code I can read now-a-days I can tell that you are saving two files "var names" "var values". That is not a good idea! The very crude code I posted is using a different method; I save one file with the variable and its value wrapped in a statements like "(setenv "blah" "blah")". This will allow you to use a combination of methods--which ever suites your needs for the given variable and/or type-. there isn't a need to re-write the two functions (rtos and vl-prin1-to-string) functions, just revise your method of using them. Look at the code I provided to give you inspiration.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

ribarm

  • Gator
  • Posts: 3266
  • Marko Ribar, architect
Re: reuse saved variables
« Reply #17 on: December 17, 2015, 03:13:07 PM »
Quote
I wrote something like this as Lee's suggested as an inspiration, and it's not working... :(

Code - Auto/Visual Lisp: [Select]
  1. ;;;
  2. ;;; put this lisp at line before last in acaddoc.lsp : (if (findfile "variables.lsp") (load "variables.lsp") (load (getfiled "Select variables.lsp file" "\\" "lsp" 16)))
  3. ;;;
  4. ;;; put this line as last one in acaddoc.lsp : (setq *atoms* (atoms-family 1))
  5. ;;;
  6.  
  7. (defun processlist ( l / x )
  8.   (cond
  9.     ( (eq (type l) 'ENAME)
  10.       (setq l 'ENAME)
  11.     )
  12.     ( (eq (type l) 'EXRXSUBR)
  13.       (setq l 'EXRXSUBR)
  14.     )
  15.     ( (eq (type l) 'FILE)
  16.       (setq l 'FILE)
  17.     )
  18.     ( (eq (type l) 'INT)
  19.       nil
  20.     )
  21.     ( (eq (type l) 'LIST)
  22.       (setq x (car l))
  23.       (cond
  24.         ( (eq (type x) 'ENAME)
  25.           (setq l (vl-remove x l))
  26.         )
  27.         ( (eq (type x) 'EXRXSUBR)
  28.           (setq l (vl-remove x l))
  29.         )
  30.         ( (eq (type x) 'FILE)
  31.           (setq l (vl-remove x l))
  32.         )
  33.         ( (eq (type x) 'INT)
  34.           nil
  35.         )
  36.         ( (eq (type x) 'LIST)
  37.           (processlist x)
  38.         )
  39.         ( (eq (type x) 'PAGETB)
  40.           (setq l (vl-remove x l))
  41.         )
  42.         ( (eq (type x) 'PICKSET)
  43.           (setq l (vl-remove x l))
  44.         )
  45.         ( (eq (type x) 'REAL)
  46.           (setq l (subst (princ (rtos x 2 50)) x l))
  47.         )
  48.         ( (eq (type x) 'SAFEARRAY)
  49.           (setq l (vl-remove x l))
  50.         )
  51.         ( (eq (type x) 'STR)
  52.           nil
  53.         )
  54.         ( (eq (type x) 'SUBR)
  55.           (setq l (vl-remove x l))
  56.         )
  57.         ( (eq (type x) 'SYM)
  58.           nil
  59.         )
  60.         ( (eq (type x) 'VARIANT)
  61.           (setq l (vl-remove x l))
  62.         )
  63.         ( (eq (type x) 'USUBR)
  64.           (setq l (vl-remove x l))
  65.         )
  66.         ( (eq (type x) 'VLA-OBJECT)
  67.           (setq l (vl-remove x l))
  68.         )
  69.         ( t
  70.           nil
  71.         )
  72.       )
  73.       (processlist (cdr l))
  74.     )
  75.     ( (eq (type l) 'PAGETB)
  76.       (setq l 'PAGETB)
  77.     )
  78.     ( (eq (type l) 'PICKSET)
  79.       (setq l 'PICKSET)
  80.     )
  81.     ( (eq (type l) 'REAL)
  82.       (setq l (princ (rtos l 2 50)))
  83.     )
  84.     ( (eq (type l) 'SAFEARRAY)
  85.       (setq l 'SAFEARRAY)
  86.     )
  87.     ( (eq (type l) 'STR)
  88.       nil
  89.     )
  90.     ( (eq (type l) 'SUBR)
  91.       (setq l 'SUBR)
  92.     )
  93.     ( (eq (type l) 'SYM)
  94.       nil
  95.     )
  96.     ( (eq (type l) 'VARIANT)
  97.       (setq l 'VARIANT)
  98.     )
  99.     ( (eq (type l) 'USUBR)
  100.       (setq l 'USUBR)
  101.     )
  102.     ( (eq (type l) 'VLA-OBJECT)
  103.       (setq l 'VAL-OBJECT)
  104.     )
  105.     ( t
  106.       nil
  107.     )
  108.   )
  109.   l
  110. )
  111.  
  112. (defun c:var-save ( / varlst f1 f2 n )
  113.   (setq varlst (vl-remove-if '(lambda ( x ) (vl-position x *atoms*)) (atoms-family 1)))
  114.   (setq varlst (vl-remove "*ATOMS*" varlst))
  115.   (foreach var varlst
  116.     (if (not (or (eq (type (eval (read var))) 'SYM) (eq (type (eval (read var))) 'INT) (eq (type (eval (read var))) 'STR) (eq (type (eval (read var))) 'LIST) (eq (type (eval (read var))) 'REAL)))
  117.       (setq varlst (vl-remove var varlst))
  118.     )
  119.   )
  120.   (setq f1 (open (getfiled "Save variable names file" "\\varnames" "txt" 1) "w"))
  121.   (setq n -1)
  122.   (foreach var varlst
  123.     (write-line (nth (setq n (1+ n)) varlst) f1)
  124.   )
  125.   (close f1)
  126.   (setq f2 (open (getfiled "Save variable values file" "\\varvalues" "txt" 1) "w"))
  127.   (foreach var varlst
  128.     (cond
  129.       ( (eq (type (eval (read var))) 'REAL)
  130.         (write-line (rtos (eval (read var)) 2 50) f2)
  131.         (princ "\n" f2)
  132.       )
  133.       ( (eq (type (eval (read var))) 'LIST)
  134.         (write-line (vl-prin1-to-string (processlist (eval (read var)))) f2)
  135.         (princ "\n" f2)
  136.       )
  137.       ( t
  138.         (write-line (vl-prin1-to-string (eval (read var))) f2)
  139.         (princ "\n" f2)
  140.       )
  141.     )
  142.   )
  143.   (close f2)
  144.   (princ)
  145. )
  146.  
  147. (defun c:var-load ( / f1 f2 varlst varvallst l ll )
  148.   (setq f1 (open (getfiled "Load variable names file" "\\varnames" "txt" 16) "r"))
  149.   (while (setq l (read-line f1))
  150.     (setq varlst (cons (read l) varlst))
  151.   )
  152.   (close f1)
  153.   (setq ll "")
  154.   (setq f2 (open (getfiled "Load variable values file" "\\varvalues" "txt" 16) "r"))
  155.   (while (setq l (read-line f2))
  156.     (if (not (eq l ""))
  157.       (setq ll (strcat ll l))
  158.       (progn
  159.         (setq varvallst (cons (read ll) varvallst))
  160.         (setq ll "")
  161.       )
  162.     )
  163.   )
  164.   (close f2)
  165.   (mapcar 'set varlst varvallst)
  166.   (princ)
  167. )
  168.  

As I said I don't mind if it creates 2 txt files as long as it works correctly, but as you can see there is a problem with processing lists... I think (c:var-load) is fine as long as saved txt files are correct... (read) function should correctly perform reading long reals as strings like Lee thought, but how to read long point lists with reals as strings or entity lists that are unchanged when my recursive (processlist) function isn't working like I thought it should...

[EDIT : New subfunction revised... Now it truncates entity data list and leaves only needful data... Long real number strings haven't been added into entity data list and also this applies to point lists, so these values are buggy and are subjects of possible data loss...]

Code - Auto/Visual Lisp: [Select]
  1. ;;;
  2. ;;; put this lisp at line before last in acaddoc.lsp : (if (findfile "variables.lsp") (load "variables.lsp") (load (getfiled "Select variables.lsp file" "\\" "lsp" 16)))
  3. ;;;
  4. ;;; put this line as last one in acaddoc.lsp : (setq *atoms* (atoms-family 1))
  5. ;;;
  6.  
  7. (defun processlist ( l / LM:Flatten lf lstr la )
  8.  
  9.   (defun LM:Flatten ( l )
  10.     (if (atom l) (list l)
  11.       (append (LM:Flatten (car l)) (if (cdr l) (LM:Flatten (cdr l))))
  12.     )
  13.   )
  14.  
  15.   (setq lf (LM:Flatten l))
  16.   (setq lstr (vl-prin1-to-string l))
  17.   (foreach x lf
  18.     (if (not (or (eq (type x) 'INT) (eq (type x) 'REAL) (eq (type x) 'STR) (eq (type x) 'SYM)))
  19.       (setq la (cons (cons (vl-prin1-to-string x) (type x)) la))
  20.     )
  21.   )
  22.   (setq la (reverse la))
  23.   (foreach x la
  24.     (if (vl-string-search (car x) lstr)
  25.       (setq lstr (vl-string-subst (vl-prin1-to-string (cdr x)) (car x) lstr))
  26.     )
  27.   )
  28.   (read lstr)
  29. )
  30.  
  31. (defun c:var-save ( / varlst f1 f2 n )
  32.   (setq varlst (vl-remove-if '(lambda ( x ) (vl-position x *atoms*)) (atoms-family 1)))
  33.   (setq varlst (vl-remove "*ATOMS*" varlst))
  34.   (foreach var varlst
  35.     (if (not (or (eq (type (eval (read var))) 'SYM) (eq (type (eval (read var))) 'INT) (eq (type (eval (read var))) 'STR) (eq (type (eval (read var))) 'LIST) (eq (type (eval (read var))) 'REAL)))
  36.       (setq varlst (vl-remove var varlst))
  37.     )
  38.   )
  39.   (setq f1 (open (getfiled "Save variable names file" "\\varnames" "txt" 1) "w"))
  40.   (setq n -1)
  41.   (foreach var varlst
  42.     (write-line (nth (setq n (1+ n)) varlst) f1)
  43.   )
  44.   (close f1)
  45.   (setq f2 (open (getfiled "Save variable values file" "\\varvalues" "txt" 1) "w"))
  46.   (foreach var varlst
  47.     (cond
  48.       ( (eq (type (eval (read var))) 'REAL)
  49.         (write-line (rtos (eval (read var)) 2 50) f2)
  50.         (princ "\n" f2)
  51.       )
  52.       ( (eq (type (eval (read var))) 'LIST)
  53.         (write-line (vl-prin1-to-string (processlist (eval (read var)))) f2)
  54.         (princ "\n" f2)
  55.       )
  56.       ( t
  57.         (write-line (vl-prin1-to-string (eval (read var))) f2)
  58.         (princ "\n" f2)
  59.       )
  60.     )
  61.   )
  62.   (close f2)
  63.   (princ)
  64. )
  65.  
  66. (defun c:var-load ( / f1 f2 varlst varvallst l ll )
  67.   (setq f1 (open (getfiled "Load variable names file" "\\varnames" "txt" 16) "r"))
  68.   (while (setq l (read-line f1))
  69.     (setq varlst (cons (read l) varlst))
  70.   )
  71.   (close f1)
  72.   (setq ll "")
  73.   (setq f2 (open (getfiled "Load variable values file" "\\varvalues" "txt" 16) "r"))
  74.   (while (setq l (read-line f2))
  75.     (if (not (eq l ""))
  76.       (setq ll (strcat ll l))
  77.       (progn
  78.         (setq varvallst (cons (read ll) varvallst))
  79.         (setq ll "")
  80.       )
  81.     )
  82.   )
  83.   (close f2)
  84.   (mapcar 'set varlst varvallst)
  85.   (princ)
  86. )
  87.  

Still, this is better than my firstly posted code...
« Last Edit: December 18, 2015, 07:40:07 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: reuse saved variables
« Reply #18 on: December 17, 2015, 03:49:05 PM »
What inspiration did Lee suggest (aside from the rtos suggestion)? I didn't see any inspiration (I saw his post on how to begin assembling a list but that's not inspiration, that's how you'd go about the task) and I don't think he would have told you to use two files (that's just not a good way to do this). Or are you only talking about his rtos suggestion?

I havent touched AutoCAD or AutoLisp in years so I guess you're going to have to do what you want. I tried to give you what little code I had (obviously it was just code I was using testing ideas/reasons at the time but I must have been structuring the code/files like that for a reason(s)). Good luck.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: reuse saved variables
« Reply #19 on: December 17, 2015, 06:02:06 PM »
Of all the absurd posts I've ever read that was the most recent.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: reuse saved variables
« Reply #20 on: December 17, 2015, 07:29:42 PM »
We've got something in common.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

ribarm

  • Gator
  • Posts: 3266
  • Marko Ribar, architect
Re: reuse saved variables
« Reply #21 on: December 18, 2015, 08:40:26 AM »
So what - it took me one day to figure this out correctly... So no need for different functions - I was wrong and Lee as always with good suggestion... Also thanks to Lee for his LM:Flatten subfunction which is all what it was supposed to be needed (besides vl-string-* functions)...

Code - Auto/Visual Lisp: [Select]
  1. ;;;
  2. ;;; put this lisp at line before last in acaddoc.lsp : (if (findfile "variables.lsp") (load "variables.lsp") (load (getfiled "Select variables.lsp file" "\\" "lsp" 16)))
  3. ;;;
  4. ;;; put this line as last one in acaddoc.lsp : (setq *atoms* (atoms-family 1))
  5. ;;;
  6.  
  7. (defun processlist ( **l** / LM:Flatten **lf** **lstr** **la** **lr** **nn** )
  8.  
  9.   (defun LM:Flatten ( **l** )
  10.     (if (atom **l**) (list **l**)
  11.       (append (LM:Flatten (car **l**)) (if (cdr **l**) (LM:Flatten (cdr **l**))))
  12.     )
  13.   )
  14.  
  15.   (setq **lf** (LM:Flatten **l**))
  16.   (setq **lstr** (vl-prin1-to-string **l**))
  17.   (foreach **x** **lf**
  18.     (if (not (or (eq (type **x**) 'INT) (eq (type **x**) 'REAL) (eq (type **x**) 'STR) (eq (type **x**) 'SYM)))
  19.       (setq **la** (cons (cons (vl-prin1-to-string **x**) (type **x**)) **la**))
  20.     )
  21.   )
  22.   (setq **la** (reverse **la**))
  23.   (foreach **x** **lf**
  24.     (if (eq (type **x**) 'REAL)
  25.       (setq **lr** (cons (cons (vl-prin1-to-string **x**) (rtos **x** 2 50)) **lr**))
  26.     )
  27.   )
  28.   (setq **lr** (reverse **lr**))
  29.   (setq **nn** 0)
  30.   (foreach **x** **la**
  31.     (if (setq **nn** (vl-string-search (car **x**) **lstr** **nn**))
  32.       (setq **lstr** (vl-string-subst (vl-prin1-to-string (cdr **x**)) (car **x**) **lstr** **nn**))
  33.     )
  34.     (setq **nn** (+ **nn** (strlen (vl-prin1-to-string (cdr **x**)))))
  35.   )
  36.   (setq **nn** 0)
  37.   (foreach **x** **lr**
  38.     (if (setq **nn** (vl-string-search (car **x**) **lstr** **nn**))
  39.       (setq **lstr** (vl-string-subst (cdr **x**) (car **x**) **lstr** **nn**))
  40.     )
  41.     (setq **nn** (+ **nn** (strlen (cdr **x**))))
  42.   )
  43.   **lstr**
  44. )
  45.  
  46. (defun c:var-save ( / **varlst** **f1** **f2** **nn** )
  47.   (setq **varlst** (vl-remove-if '(lambda ( x ) (vl-position x *atoms*)) (atoms-family 1)))
  48.   (setq **varlst** (vl-remove "*ATOMS*" **varlst**))
  49.   (foreach **var** **varlst**
  50.     (if (not (or (eq (type (eval (read **var**))) 'SYM) (eq (type (eval (read **var**))) 'INT) (eq (type (eval (read **var**))) 'STR) (eq (type (eval (read **var**))) 'LIST) (eq (type (eval (read **var**))) 'REAL)))
  51.       (setq **varlst** (vl-remove **var** **varlst**))
  52.     )
  53.   )
  54.   (setq **f1** (open (getfiled "Save variable names file" "\\varnames" "txt" 1) "w"))
  55.   (setq **nn** -1)
  56.   (foreach **var** **varlst**
  57.     (write-line (nth (setq **nn** (1+ **nn**)) **varlst**) **f1**)
  58.   )
  59.   (close **f1**)
  60.   (setq **f2** (open (getfiled "Save variable values file" "\\varvalues" "txt" 1) "w"))
  61.   (foreach **var** **varlst**
  62.     (cond
  63.       ( (eq (type (eval (read **var**))) 'REAL)
  64.         (write-line (rtos (eval (read **var**)) 2 50) **f2**)
  65.         (princ "\n" **f2**)
  66.       )
  67.       ( (eq (type (eval (read **var**))) 'LIST)
  68.         (write-line (processlist (eval (read **var**))) **f2**)
  69.         (princ "\n" **f2**)
  70.       )
  71.       ( t
  72.         (write-line (vl-prin1-to-string (eval (read **var**))) **f2**)
  73.         (princ "\n" **f2**)
  74.       )
  75.     )
  76.   )
  77.   (close **f2**)
  78.   (princ)
  79. )
  80.  
  81. (defun c:var-load nil
  82.   (setq **f1** (open (getfiled "Load variable names file" "\\varnames" "txt" 16) "r"))
  83.   (while (setq **l** (read-line **f1**))
  84.     (setq **varlst** (cons (read **l**) **varlst**))
  85.   )
  86.   (close **f1**)
  87.   (setq **ll** "")
  88.   (setq **f2** (open (getfiled "Load variable values file" "\\varvalues" "txt" 16) "r"))
  89.   (while (setq **l** (read-line **f2**))
  90.     (if (not (eq **l** ""))
  91.       (setq **ll** (strcat **ll** **l**))
  92.       (progn
  93.         (setq **varvallst** (cons (read **ll**) **varvallst**))
  94.         (setq **ll** "")
  95.       )
  96.     )
  97.   )
  98.   (close **f2**)
  99.   (setq **l** nil **ll** nil **f1** nil **f2** nil)
  100.   (mapcar 'set **varlst** **varvallst**)
  101.   (setq **varlst** nil **varvallst** nil)
  102.   (princ)
  103. )
  104.  

So no loosing data values - just tested it should also work good and for entity data lists... Thanks to all for support and Happy Holidays, Marko R.
« Last Edit: December 23, 2015, 02:29:24 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3266
  • Marko Ribar, architect
Re: reuse saved variables
« Reply #22 on: December 18, 2015, 09:22:45 AM »
Of all the absurd posts I've ever read that was the most recent.

And just one more thing to add :
"It is NOT absurd..."

Look here :
http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extract-a-text-from-a-long-text/m-p/5955380/highlight/true#M337556
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: reuse saved variables
« Reply #23 on: December 18, 2015, 10:56:18 AM »
And just one more thing to add :
"It is NOT absurd..."

Ummm, you misunderstand. I was commenting on John's absurd, pathetic comment:

What inspiration did Lee suggest (aside from the rtos suggestion)? I didn't see any inspiration .. bla bla bla ...
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: reuse saved variables
« Reply #24 on: December 18, 2015, 02:54:15 PM »
*sigh* Here we go again. Just so we don't run the risk of painting this bike-shed again...

My `absurd, pathetic comment' was:
1. Me trying to state that I don't think Lee would have inspired/suggested that you do it that way. The keeping of two files is a flawed approach and I honestly don't think he would approach the problem that way (Not fair to pin those inherited problems on him).

2. I have no way of taking what little code I posted any further. I don't have a way to help with the code anymore then I already did (resources or knowledge).

And as far as my last comment goes, it was directed at MP (not you ribarm). I returned his quip with one in kind--which I shouldn't have (it obviously struck a nerve so I apologize, MP). My reply was a snarky way of pointing out that no one is/would be interested in comments/thoughts he has about the quality of another person's post. Again, sorry for making that last comment (I should have paused before replying).
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

ribarm

  • Gator
  • Posts: 3266
  • Marko Ribar, architect
Re: reuse saved variables
« Reply #25 on: December 19, 2015, 01:06:10 AM »
I've tested it once again and I've found some lacks with previously posted code... Please, revised code here :
http://www.theswamp.org/index.php?topic=50628.msg557923#msg557923

Regards, M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: reuse saved variables
« Reply #26 on: December 19, 2015, 02:12:29 PM »
1. Me trying to state that I don't think Lee would have inspired/suggested that you do it that way.

The arrogance that gives you the illusion you have the authority to determine what inspires others is petty and immature. I'm embarrassed for you.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: reuse saved variables
« Reply #27 on: December 19, 2015, 05:36:43 PM »
1. Me trying to state that I don't think Lee would have inspired/suggested that you do it that way.

The arrogance that gives you the illusion you have the authority to determine what inspires others is petty and immature. I'm embarrassed for you.

Enough. At the risk of exposing more 'arrogance', I don't think the OP started this thread to hear your opinions about how much you pity me. Please, start a new poll/thread if you can spare enough of your time and good nature to save my soul.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

ribarm

  • Gator
  • Posts: 3266
  • Marko Ribar, architect
Re: reuse saved variables
« Reply #28 on: December 21, 2015, 05:08:28 PM »
Sorry if all this caused conflicts, I apologize if I was insulting anyone... Like I said I thank to all that have replied and wish to all very good and happy upcoming New Year and pleasant Holiday time... Now I've noticed that with my code there may come to conflicts with variable names and variables used in defined functions for saving, loading and processlist function... So I revised once more, but I couldn't come to anything more reliable than to mix their names with **name** syntax - it's not original idea, but as I use "l" variable, "n" variable and similar I overcome this problem in this manner... So be careful - it's not 100% proof on every cases, but that's how it is unfortunately with ALISP and *CAD...
Revision :
http://www.theswamp.org/index.php?topic=50628.msg557923#msg557923

Regards, and forget all bad moments that were in the past and turn on to good and happy future I hope to all...
« Last Edit: December 23, 2015, 02:29:47 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube