Hi all,
I tried to read an environment with iLogic and to combine it with an external rule name and to pass the whole path over to iLogicVB.RunExternalRule.
StrPath = Environment.GetEnvironmentVariable("ILOGIC_DIR") ilogic_rule = "IPT__01_New_Document_EXT.iLogicVb" rule = StrPath & ilogic_rule 'MessageBox.Show(rule, "iLogic Rule to execute") iLogicVb.RunExternalRule(rule)
The message box shows the correct path, but I allways receive a error massage:
'GetEnvironmentVariable' is not a member of 'Inventor.Environment'
How to resolve this problem?
Any help would be appreciated.
Thanks in advance,
Raphael
Solved! Go to Solution.
Hi all again,
does iLogicVb.RunExternalRule("rule name") not accept variables?
Can anyone help me?
Thanks!
Raphael
Hi Raphael,
you need two items solved:
1) Inventor.Environment covers the UI; you need to call the system.environment explicitly
2) The variable needs to set for the current process
Find the rule code that works:
Dim StrPath As String = Nothing
System.Environment.SetEnvironmentVariable("iLogic_DIR", "C:\Temp")
StrPath = System.Environment.GetEnvironmentVariable("iLogic_DIR")
ilogic_rule = "Test_Rule.iLogicVb"
rule = StrPath & "\" & ilogic_rule
MessageBox.Show(rule, "iLogic Rule to execute")
iLogicVb.RunExternalRule(rule)
BTW: iLogic.Automation 2013 allows to set the directory as Inventor iLogic.Automation option; you don't longer need to use environment variables 🙂
Hope this helps,
Markus
Hi Markus,
thanks for your fast reply, I really appreciate your help.
I added the variable target because I want to get a user variable (found that in an other forum):
StrPath = System.Environment.GetEnvironmentVariable("name variable", EnvironmentVariableTarget.User)
Great, now my rule works as expected.
I am not familiar with iLogic.Automation 2013, because we are still on Inventor 2011.
The reason for calling a system/user environment is that we have a simple batch tool in use which sets the correct settings for our CAD systems (Inventor and Solid Edge) and SAP, CADENAS PARTsolutions and so on. At the end of the routine Inventor is launched.
Thanks
Raphael
Can't find what you're looking for? Ask the community or share your knowledge.