Inventor Customization

Inventor Customization

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

Find Sheet Metal Thickness with VB.Net

781 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: 148
Registered: ‎10-20-2001
Message 2 of 2 (776 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.