About the shortest way to get the value of that specific iProperty is using the Inventor API way, when you know which 'index' positions that PropertySet and Property are at. The first 4 PropertySets in every document will always be there, and the first 3 are stable, meaning we can not add to, subtract from, or reorder the properties in them. The one nicknamed 'Project' is just nicknamed that because of what 'tab' some of them are on in the standard dialog, but it is always the third PropertySet. We can chart-out all the properties in those first three sets, and count on them always being there, and in the same order, and positions. With that in mind, we can use the following, as an example:
Dim oDoc As Inventor.Document = ThisDoc.Document
Dim sDocSubTypeName As String = oDoc.PropertySets(3)(17).Value
MsgBox(sDocSubTypeName, vbInformation, "Document SubType Name")
The '3' in Line 2 is telling it which PropertySet, then the '17' is telling it which Property.
One negative aspect to using that iProperty is that 'regular' parts are just called "Modeling", instead of "Part", so you may need to 'interpret' that one result the way you want.
I have gone through this type of thing so many times over the years, and have used so many different ways to achieve the same results, that I finally settled on a method of checking document sub type that is a bit different than the typical routes. I now use the 'TypeOf' operator to check which base type of document I am dealing with (Drawing, Part, Assembly), then once I know it is one of the 'model' types (Part or Assembly), I then use another 'TypeOf' operator to check which Type of 'ComponentDefinition' it has. Each 'regular' type has a specific one, and each 'sub type' has a specific one. I know that we can use the DocumentTypeEnum for checking base document type, but using TypeOf operator actually processes faster, and is super simple to look at and read later. And since there is no DocumentSubTypeEnum (despite me asking for one in the Inventor Ideas forum), using the TypeOf operator seems to be the fastest, and easiest to read way of determining which one I am dealing with.
Example:
Dim oDoc As Inventor.Document = ThisDoc.Document
If TypeOf oDoc Is PartDocument Then
Dim oPDoc As PartDocument = oDoc
If TypeOf oPDoc.ComponentDefinition Is SheetMetalComponentDefinition Then
Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition
'and so on
End If
ElseIf TypeOf oDoc Is AssemblyDocument Then
Dim oADoc As AssemblyDocument = oDoc
If TypeOf oADoc.ComponentDefinition Is WeldmentComponentDefinition Then
Dim oWeldmentDef As WeldmentComponentDefinition = oADoc.ComponentDefinition
'and so on
End If
ElseIf TypeOf oDoc Is DrawingDocument Then
Dim oDDoc As DrawingDocument = oDoc
End If
Edit: Another way this could be done, using the same strategy is:
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))
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)