Document sub type in addin

Document sub type in addin

Anonymous
Not applicable
629 Views
4 Replies
Message 1 of 5

Document sub type in addin

Anonymous
Not applicable

trying to check whether a part is a sheet metal part in an inventor addin using this if statement

 

msbox(oDoc.SubType)

 

If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then

msgbox("Sheet metal part")

End If

 

I'm 100% certain oDoc is a sheet metal document, I've even tested the exact same code in VBA and I can see the SubType as sheet metal GUID to confirm this.

 

However, in my addin, the first message box in returns this string:

{41769AA9-4296-5CD8-C0D5-68AF8E5E79E2}

 

and if i try a different sheet metal part I will get another totally random number Smiley Frustrated

 

HELP !!!

0 Likes
Accepted solutions (1)
630 Views
4 Replies
Replies (4)
Message 2 of 5

bradeneuropeArthur
Mentor
Mentor
If I am correct there is also a documentsubtype

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 5

bradeneuropeArthur
Mentor
Mentor
I mean there is a document subtype also for part documents. Make sure that your odoc is defined as part document.

Hope this helps.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 4 of 5

bradeneuropeArthur
Mentor
Mentor
Accepted solution

Like below:

' Set a reference to the sheet metal document. 
' This assumes a part document is active.
Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument
' Make sure the document is a sheet metal document.
If oPartDoc.SubType "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
MsgBox "A sheet metal document must be open."
Exit Sub
End If

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 5 of 5

Anonymous
Not applicable

Thank you this solved the problem.

 

Final code

 

If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then

      Dim oPartDoc As PartDocument = g_inventorApplication.ActiveEditDocument

      If oPartDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then

            Msgbox("Is a sheet metal part")

      End If

End If

0 Likes