Hi guys I am looking for a solid way of finding the Thickness parameter of a sheet metal part. I have tried two ways so far:
1. oCompDef.Parameters.Item(Thickness)
This works but if Inventor is installed with a different language pack like German for instance then it fails
2. oCompDef.Parameters.Item(1).Value
This also works but if the user started the part with a normal part template and then converts the part to a sheet metal part down the line, then this method fails.
Any bright ideas?
Thanks a lot guys
Pieter
Solved! Go to Solution.
Solved by nmunro. Go to Solution.
VBA - Mostly taken from an example in the help system (always the first place to look)
Public Sub GetThick()
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
Dim oSheetMetalCompDef As SheetMetalComponentDefinition
Set oSheetMetalCompDef = oPartDoc.ComponentDefinition
Dim thickParam As Parameter
Set thickParam = oSheetMetalCompDef.Thickness
End Sub