cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create Enum for DocumentSubType &/or Document.SubType

Create Enum for DocumentSubType &/or Document.SubType

Please create a DocumentSubTypeEnum or other simpler and readable way to determine if a document is a Sheet Metal Part, or Weldment Assembly, or other SubType's.  DocumentSubType and Document.SubType have to reference a long, unreadable string (GUID) or DocCLSIDs.h.  Having to specify one or multiple of those long strings for comparison, to determine SubType is really, really horrible!  I don't want to have to run through a long series of If...ElseIf... statements or Select Case statements or run seperate iLogic rule or module, every time, just to get this information.  It should be really simple to do, but it currently is not.

Please build something easier to use, and readable, into Inventor's iLogic and/or Inventor's VBA system.

3 Comments
WCrihfield
Mentor

The best workaround I've come up with, to get the readable SubType is to access the iProperty.

Within the "Design Tracking Properties" PropertySet...(AKA - PropertySets.Item(3)) /

Property number 16, which is "Document SubType".

And Property number 17, which is "Document SubType Name".

I know...pretty self explanatory.

Obviously the value of the second one will return the 'readable' SubType.

And since this PropertySet and this Property are both standard, this seems like a viable alternative to having to use the list of long 'unreadable' strings, to determine DocumentSubType & Document.SubType.

WCrihfield
Mentor

Just adding links in here to a couple of my related contribution posts for reference.  (And hopefully bump the topic back up in recent ideas activity, for better advertisement and more votes. 🙂)

Document.SubType List (Common Name = Inventor's Name = CSLID) (from Inv Pro 2021 Dev Tools)

Determine Document.DocumentSubType (or Document.SubType) (Recently Updated to include new technique)

WCrihfield
Mentor

Since those 'Contribution' posts, which used to be in the 'knowledge.autodesk.com/community/article/' area, got taken down by Autodesk, quite a while back, those links to them (which were in many places) are now all broken, so I will post something else here that may be a bit more useful to anyone finding this 'Idea' later.

 

I recently posted about this subject on the Inventor Programming Forum, where I included a Link to this Inventor Idea post.

https://forums.autodesk.com/t5/inventor-programming-ilogic/retrieve-file-subtype-of-parts-in-assembl... 

In that post I showed a series of Inventor API lines of code that I keep in my custom iLogic snippets, and figured it would be good to post those here also, to share the idea with others interested in this subject.  The main idea is showing a different way to identify both document types, and document sub types, that does not require any unrecognizable String values, is easy to read and understand.  It actually processes pretty fast this way also.  If someone has been writing iLogic rules for a little while, &/or are familiar with the vb.net coding language, then this will likely be pretty easy to understand and use.  The 'ThisDoc.Document' code phrase being used in the first line, is the only element unique to the iLogic API, while the rest is a combination of Inventor API and basic vb.net programming elements.  And since iLogic rules use and recognize the vb.net Framework programming language, it is all native in iLogic rules.  It seems like these principles could be used to create an 'Enum' for document sub types, which could at least be used as a 'ReadOnly' resource, for determining the sub types of 'existing' documents.  Might not be of much use for dictating the sub type of a 'New' document, or changing the sub type of an existing document, but it would at least be a good start.

Dim oDoc As Inventor.Document = ThisDoc.Document
Dim bIsPart As Boolean = (TypeOf oDoc Is PartDocument)
Dim bIsAssembly As Boolean = (TypeOf oDoc Is AssemblyDocument)
Dim bIsDrawing As Boolean = (TypeOf oDoc Is DrawingDocument)
Dim oCD As Inventor.ComponentDefinition = Nothing
If bIsPart OrElse bIsAssembly Then oCD = oDoc.ComponentDefinition
Dim bIsSheetMetal As Boolean = (bIsPart AndAlso TypeOf oCD Is SheetMetalComponentDefinition)
Dim bIsWeldment As Boolean = (bIsAssembly AndAlso TypeOf oCD Is WeldmentComponentDefinition)
Dim bRegularPart As Boolean = (bIsPart AndAlso (Not bIsSheetMetal))
Dim bRegularAssembly As Boolean = (bIsAssembly AndAlso (Not bIsWeldment))

 

Links to related properties and resources:

Document.DocumentType (ReadOnly Property with DocumentTypeEnum type value)

That one is easy enough to use, and I like it, so lets make one just like it for 'Document SubTypes' also.  I still prefer using the TypeOf operator though, because it seems to process faster.

 

Document Sub Type GUID's:

When we install the Inventor SDK Developer Tools stuff, there is a folder named "Include" which has a file in it named "DocCLSIDs.H".  In that file is where all those GUID values are defined for each type, and sub type of documents.  But it is a bit difficult to read through, and I certainly don't want to have to reference that file, or have to 'hard-code' any of those long, awkward Strings in my other codes, every single time I need to know which sub type of document I am dealing with.  The properties below were designed to work with those Strings, but I very much dislike having to use those, for obvious reasons.

 

Document.SubType (Read/Write Property with String type value, but returning/expecting one of those long, unreadable GUID type String values, so more complicated to use than it should be, in my opinion.

 

Document.DocumentSubType (ReadOnly Property with 'DocumentSubType' type value, which we can not even find any documentation about anymore.  Assuming this is because it used to be used a long time ago, then stopped relying on it, in favor of the other property 'SubType', but left it in place to support 'legacy' solution functionality.  That DocumentSubType object used to have a Property named 'DocumentSubTypeID', which returned the same thing as the 'SubType' property does now.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea