System.Environment.SetEnvironmentVariable

System.Environment.SetEnvironmentVariable

Anonymous
Not applicable
1,000 Views
2 Replies
Message 1 of 3

System.Environment.SetEnvironmentVariable

Anonymous
Not applicable

Hello,

 

I am quite new in programming with iLogic. I have found a lot usefull help on the internet already which brought me quite far in building some nice rules. I want to set a variable which i can use even if Inventor is restarted. I found something like this:

 

Dim StorePath As String = Nothing
System.Environment.SetEnvironmentVariable("Test","ABCD")
StorePath = System.Environment.GetEnvironmentVariable("Test")

MsgBox(StorePath)

 

Is the System.Environment.SetEnvironmentVariable the same as the variable i can find at: Computer -> Properties -> Advanced System Settings -> Advanced -> Environment Variables -> System Variables.

 

When I run the code above I can see the "ABCD" in the messagebox but can't find the variable in the Windows System Variables. Can someone explain how it works?

0 Likes
Accepted solutions (1)
1,001 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Can somebody help me out, please?

0 Likes
Message 3 of 3

philippe.leefsma
Alumni
Alumni
Accepted solution

Hi Afredrik,

 

That question is not directly related to an Autodesk API, so from an ADN point of view you would need to research it by yourself, unless another forum contributor is willing to look into it and provide you help on that.

 

We usually deal on that forum with Autodesk API specific questions.

 

There is no direct way to store a variable in Inventor outside of a specific document context. In a document you can use iProperties or attributes to store as much data as you want.

 

I would recommend you use either the registry or a cleaner option, like some kind of config file if you want to store custom variables independently of a document. You should be able to find plenty of resources on the web in general programming forums to achieve that.

 

Sorry for not being more helpful at the moment.

 

Regards,

Philippe.

 

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes