Author Topic: Finding Variables  (Read 3278 times)

0 Members and 1 Guest are viewing this topic.

whdjr

  • Guest
Finding Variables
« on: January 05, 2005, 09:11:38 AM »
I know atoms-family returns a list of used variables, but is there way to tell which ones were added by AutoCad and which ones were added by the user?

whdjr

  • Guest
Finding Variables
« Reply #1 on: January 06, 2005, 10:00:11 AM »
No one has any thoughts at all?

JohnK

  • Administrator
  • Seagull
  • Posts: 10640
Finding Variables
« Reply #2 on: January 06, 2005, 10:15:30 AM »
Sure, i just didnt see this thread. (I only get to view a select few a day.) But...

How i think i would lookinto going about this would be to take a snapshot of the variables with out any lisps loaded. (Custom of course) and take a snapshot later. Compair the two with a small lil list parser progy.

Kinda hookey, but i those are my initial thoughts.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Finding Variables
« Reply #3 on: January 06, 2005, 10:24:29 AM »
What do you mean by "were added by AutoCad" ?
TheSwamp.org  (serving the CAD community since 2003)

whdjr

  • Guest
Finding Variables
« Reply #4 on: January 06, 2005, 10:43:25 AM »
Quote from: Se7en
How i think i would lookinto going about this would be to take a snapshot of the variables with out any lisps loaded. (Custom of course) and take a snapshot later. Compair the two with a small lil list parser progy.


There is one at AfraLisp that does it this way.

Quote from: Mark Thomas
What do you mean by "were added by AutoCad" ?


What I mean is the vars that would be used by autocad with no customization what-so-ever.  

I was trying to get a list of used vars minus the ones used for autocad commands, which would leave me with the vars that my customization has put in.  I wanted to check to make sure that some rogue vars were not getting set by my bad programming and causing other proggys to mess up because of vars with too much data or trying to merge wrong data types.  

A good example would be Keiths' code for SET and READ.
Code: [Select]
(setq count 0)
(repeat 10
  (setq temp (getstring "\nEnter string: "))
  (set (read (strcat "string[" (rtos count 2 0) "]")) temp)
  (setq count (1+ count))
)


This sets 10 vars that are very easy to forget if we are not careful.  I know the vars get reset when we close AutoCad, but how many of us use a custom mnl file that loads code at startup (I know I do).  I wanted to write a little tool that would show me all the vars that my customization added with their value.  I don't care about the ones without a value, just the ones with a value.

Does that make any sense or am I totally out in left field?

JohnK

  • Administrator
  • Seagull
  • Posts: 10640
Finding Variables
« Reply #5 on: January 06, 2005, 11:06:01 AM »
There is? ...Well whats wrong with Kenny's code?

Left field.
Quote

Command: (setq a 1)
1

Command: !a
1

Command: (defun c:testvars ( / a)
(_> (setq a 6)
(_> (setq a (1+ a))
(_> (princ a)
(_> (princ))
C:TESTVARS

Command: !a
1

Command: testvars
7

Command:
Command: !a
1
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

whdjr

  • Guest
Finding Variables
« Reply #6 on: January 06, 2005, 11:08:30 AM »
I think your in left field.  :)

What was all that? :?

SMadsen

  • Guest
Finding Variables
« Reply #7 on: January 06, 2005, 11:46:11 AM »
Will, I think you would need some serious memory digging, which can not be done from within AutoLISP (as far as I know).

JohnK

  • Administrator
  • Seagull
  • Posts: 10640
Finding Variables
« Reply #8 on: January 06, 2005, 11:46:30 AM »
Okay, I guess im lost as to why the variables are important.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

whdjr

  • Guest
Finding Variables
« Reply #9 on: January 06, 2005, 12:19:26 PM »
Thanks Stig.