Ryan Small
Ryan Small

Reputation: 11

How to Check if code running on Inventor Desktop or Inventor Server?

Within an iLogic rule, how can I check if the code is running on Inventor Desktop or Inventor Server? For example, we know that message boxes are not allowed in IDA/APS; therefore, within an iLogic rule I want to do the following;

If InventorDesktop Then MessageBox.Show("This is Inventor Desktop") else 'InventorServer is active and therefore, don't show the MessageBox and take an alternative approach End If

One possible approach would be to check for active process because Inventor Desktop is Inventor.exe and Inventor Server as I understand it is InventorCoreConsole.exe

Upvotes: 0

Views: 121

Answers (2)

Ryan Small
Ryan Small

Reputation: 11

I believe I figured out how to do this via iLogic by checking the value of ThisDoc.Document.Parent.SoftwareVersion.ProductName

On Inventor Desktop, the returns "Inventor"; whereas, in Inventor Design Automation it returns "Inventor Interoperability".

So, this can easily be incorporated into a rule such as the following;

If ThisDoc.Document.Parent.SoftwareVersion.ProductName = "Inventor" Then

'Code is running on Inventor Desktop MessageBox.Show("Inventor Desktop", "Product Name")

End If

Upvotes: 0

Rahul Bhobe
Rahul Bhobe

Reputation: 4451

Ideally you need not have to ask Inventor for this information. You should be able to package or code or configure your Desktop addin differently from DA addin.

Should you choose not to do that and still want the system to tell you what mode you are in, you can check to see if the environment variable DAS_WORKITEM_ID is defined:

Environment.GetEnvironmentVariable("DAS_WORKITEM_ID");

Also see answer.

Upvotes: 0

Related Questions