Please add a Property or Method to the Inventor.Document object in Inventor's API which we can use to quickly & easily determine why that document may not be modifiable.
When using Inventor's API to automate Inventor by code, the Application, and Document objects are the two highest level objects that we need to interact with all the time. The Document object has the important Document.IsModifiable ReadOnly Property, which returns a Boolean (True/False) type value, indicating if we will be able to many any modifications to that Document. However, when that property's value equals False, there is no further explanation for WHY the document is 'not modifiable'. I want the Inventor developers to create and expose a new Method or Property for the Inventor.Document object in Inventor's API so that us Inventor users can more quickly and easily figure out exactly why a document may be 'not modifiable'. I would also suggest creating an Enum for that, for added stability. It might contain one variation which is something like ["Normal", "Modifiable", "IsModifiable", or similar], or maybe not, depending on how it gets implemented and/or where all it gets used. If my code process is iterating through multiple documents, and I am checking the Document.IsModifiable property value, and it returns False, I want to then be able to access a secondary property or use a secondary method, to figure out why it is not modifiable. This can be very important. Then, if the reason is because it is a ModelState member, or not checked out from Vault, there may still be a way to work around those situations, where there is no way to work around some of the other 'reasons'. This is also helpful for logging which components or documents had to be skipped over during a long process, so we can include the reason why they had to be skipped over, so we know if follow-up actions will be necessary. Knowing the 'reason(s)' why some were skipped can sometimes be important for determining if any manual follow-up actions may be required to deal with them properly.
When a user accesses the ReadOnly Property, or calls the method, a block of code could run in the background which checks for each of these possible reasons, if any, then return the appropriate variation, or value.
Possible Example Property/Method:
Document.ModificationObstacles As DocumentModificationObstaclesEnum
Document.ReasonsIfNotModifiable As [...Enum or String() or Inventor.NameValueMap]
Document.GetReasonsNotModifiable() As [...Enum or String() or Inventor.NameValueMap]
Possible Example Enum: (may need more variations &/or clearer names ; may need the 'Flags' attribute for possible combinations)
''' <summary>
''' An enumeration of possible reasons why a Document may not be modifiable
''' </summary>
Public Enum DocumentModificationObstaclesEnum
''' <summary>
''' The Document's File is located in a Library
''' </summary>
kFileIsInLibraryLocaion 'located in active DesignProject.LibraryPaths
''' <summary>
''' The Document's File has its ReadOnly attribute set
''' </summary>
kFileIsReadOnly 'FileAttributes.ReadOnly
''' <summary>
''' The Document is a Content Center member
''' </summary>
kIsContentCenterMember
''' <summary>
''' The Document is an iAssembly member
''' </summary>
kIsiAssemblyMember
''' <summary>
''' The Document is an iPart member
''' </summary>
kIsiPartMember
''' <summary>
''' The Document is a ModelState member
''' </summary>
kIsModelStateMember
''' <summary>
''' The Document is modifiable
''' </summary>
kIsModifiable 'Normal - can be modified (Default Value)
''' <summary>
''' The Document is Locked or set to Released state in Vault
''' </summary>
kVault_Locked 'or kVault_Released
''' <summary>
''' The Document is not checked-out from Vault
''' </summary>
kVault_NotCheckedOut 'or kVault_NotCheckedOutToYou
End Enum
It may not be possible for Inventor API Properties or Methods to directly interact with Vault's API, and if so, we could potentially leave those variations out of this...for now. But if that is the case, hopefully there could be a uniquely 'iLogic' tool like this instead. It may be possible for there to be multiple reasons why a specific document can not be modified. If so, and using an Enum, then it would either need to just return the most appropriate variation, or we would likely need to add the 'Flags' attribute to it, and allow combinations of the values as an Integer, which could be checked using Bitwise operations.
Show More