Inventor Customization

Inventor Customization

Reply
Distinguished Contributor
Raider_007
Posts: 484
Registered: ‎08-22-2006
Message 1 of 2 (587 Views)
Accepted Solution

Find Sheet Metal Thickness with VB.Net

587 Views, 1 Replies
10-24-2012 07:47 AM

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?  :smileyfrustrated:

 

Thanks a lot guys

 

Pieter

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

Distinguished Contributor
nmunro
Posts: 146
Registered: ‎10-20-2001
Message 2 of 2 (582 Views)

Re: Find Sheet Metal Thickness with VB.Net

10-24-2012 08:07 AM in reply to: Raider_007

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

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.