When using Design Automation API for Inventor, you might have to change some of the code in the iLogic Rules of your documents.
On the desktop inside Inventor Application, a user can open and activate documents without your add-in's permission, and so when one of its commands is executing, it might need to know which document is currently active - that's what the ActiveDocument property of the Application class will tell us.
On the cloud, using Inventor Server, your application (i.e. the code inside your AppBundle) has full control of things. So, there is not much point in keeping track of which document is active - your application should know what document it opened and needs to work with. And that's why there is no InventorServer.ActiveDocument
Most of the time you could simply replace ThisApplication.ActiveDocument in your iLogic Rules with ThisDoc.Document (the document whose Rule is running) - it depends on the Rule's intent.
However, in certain cases ThisApplication.ActiveDocument might have been a shortcut to the top assembly containing the part whose Rule (in our case "UpdatePart") is running:
In that case you would need a function to get to the top assembly. Something like this:
Function GetTopAssembly(doc As Document) As Document If doc.ReferencingDocuments.Count = 0 Then Set GetTopAssembly = doc Else Set GetTopAssembly = GetTopAssembly(doc.ReferencingDocuments(1)) End If End Function
The above is VBA - in case of iLogic you'd just have to delete the "Set" keywords.
ThisApplication itself is not supported either. You could use ThisServer instead which is also supported on the desktop. This will only contain properties and functions that Inventor Server supports, so you won't find e.g. ActiveDocument property on it.
2) iLogic Forms
I already wrote about how you could recreate the same forms for your users on your webpage:
Get iLogic Form information from Inventor documents
3) Other User Interface components
Since there is no user to interact with, you'll have to remove all the message boxes and other components that the user would have to react to - i.e. calls to MessageBox.Show(), MsgBox(), iLogicForm.Show(), InputBox(), etc
There is a very useful tool called "iLogic Rule Exporter" to help you with this and finding where e.g. ActiveDocument is used. It enables you to extract all the Rules from any Inventor document and its referenced documents into iLogicVb files
This makes it much easier to search their source code for certain things: e.g. where a particular parameter is modified, where specific Inventor API's are used, etc
That should help you find where UI components are used and work around them.
In case of running things on a server without a user to keep an eye on things, logging what's happening inside your code becomes even more important.
I already wrote about how to use Trace inside your Rules: Debug iLogic code
Since then, iLogic introduced an object called Logger, which lets you log messages to the "iLogic Log" tab in the Inventor User Interface:
However, at the moment those logs do not show up in the WorkItem's report. But the Trace logs (e.g. Trace.WriteLine()) do, so use them instead.