Jump to content

Store a bunch of custom variables in drawing


Aftertouch

Recommended Posts

Hello eveybody,

I would like to store about 40 custom variables in a drawing.

They are all Yes/No (0/1) variables.

 

Now i know about the USERI and USERR variables, but they only go up to 5.

 

Also i need to be able to call these variables with a DIESEL function for my ribbon, so i can toggle buttons with it.

$(getvar, customvar1)

 

I've read about using custom dictionaries to store information. But i doubt that this information can be read out using a DIESEL function?

 

So my question...

Where should i start with this???

Link to comment
Share on other sites

Link to comment
Share on other sites

Hello eveybody,

I would like to store about 40 custom variables in a drawing.

They are all Yes/No (0/1) variables.

 

Now i know about the USERI and USERR variables, but they only go up to 5.

 

Also i need to be able to call these variables with a DIESEL function for my ribbon, so i can toggle buttons with it.

$(getvar, customvar1)

 

I've read about using custom dictionaries to store information. But i doubt that this information can be read out using a DIESEL function?

 

So my question...

Where should i start with this???

 

Since they are all Yes/No (0/1) variables you can store a lot of them in one USERI variable as bitcodes which you can access with DIESEL functions.

Good reference: http://www.crlf.de/Dokumente/Diesel/Diesel.html

Link to comment
Share on other sites

Hmm.... both suggestions dont seem to fit my needs.

 

Or i just dont understand how to use them. :-(

Link to comment
Share on other sites

Take the OSMODE (System Variable). The setting is stored as a bitcode using the sum of the values for each osnap that is turned on.

Using the logand lisp function

(if(logand (getvar "osmode") 1)(princ "\nEndpoint On")(princ "\nEndpoint Off"))(princ)

lets you know if Endpoint osnap is on or off. You could check 16 different osnap settings stored in that one integer system variable.

 

This can be done with lisp or DIESEL functions using USERI variables in the same way.

Link to comment
Share on other sites

Users1 which is is a string will handle 40 0&1 no need to worry about how bitcodes work. Use "substr".

 

users1

Enter new value for USERS1, or . for none : 1234567890123456789012345678901234567890

 

useri1 is limited to +-32767

 

So you have 5 users so could have 200 0&1 probably more dont know the string limit for usersx.

Link to comment
Share on other sites

Thanks for all the replies.

 

@BIGAL and Roy_043,

 

Your suggestions also crossed my mind.

Where the UserI is limited to about 12 characters or or, the UserS can store many many many more...

 

BUT....

 

UserS variables are not saved in the drawing... Now there is my next problem...

Link to comment
Share on other sites

I have used userI etc did not know USERS is not saved. You may have to create your own Dictionary its not hard, you can store anything you like. I have a global style example, but I did do a save individual variables as a test at one stage for some private software, will try to find code. You could do all 40 as variables rather than just 1 string a bit easier as you can change just 1. Without going into it you would save "Text" & "Textstring" variables.

 

If you google will find examples.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...