Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Find Sheet Metal Thickness with VB.Net

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Raider_71
2757 Views, 1 Reply

Find Sheet Metal Thickness with VB.Net

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?  Smiley Frustrated

 

Thanks a lot guys

 

Pieter

1 REPLY 1
Message 2 of 2
nmunro
in reply to: Raider_71

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

        


https://c3mcad.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report