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: 

Sheet metal: is it flat?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
eljoseppo
1030 Views, 3 Replies

Sheet metal: is it flat?

Hi,

how can I check if my sheet metal part has any bends or it is flat? (I don't mean flattpattern.)

 

I mean if my part looks the same while it's folded and unfolded I want to export as dxf. If it has a bendind area I want to export as a igs. I can handle export but I don't know how to check it. In iLogic environment if possible.

 

BR,

joe

3 REPLIES 3
Message 2 of 4
rjay75
in reply to: eljoseppo

Try this.

 

Dim SMPart As SheetMetalComponentDefinition
SMPart = ThisDoc.Document.ComponentDefinition

If(SMPart.Bends.Count > 0) Then
    MessageBox.Show("Has Bends")
Else
    MessageBox.Show("Part Has no bends")
End If
Message 3 of 4
ekinsb
in reply to: rjay75

Rodney's suggestion is good with one caveat, bends can be flat if they've been unfolded.  Here's a slight modifcation to account for that that checks each of the bends to see if they're flat or not.

 

Public Sub TestFlat()
    Dim partDoc As PartDocument
    Set partDoc = ThisApplication.ActiveDocument
    
    ' Get the sheet metal component definition.
    ' This will fail if the active document isn't a sheet metal document.
    Dim smDef As SheetMetalComponentDefinition
    Set smDef = partDoc.ComponentDefinition
    
    Dim hasBend As Boolean
    hasBend = False
    Dim testBend As Bend
    For Each testBend In smDef.Bends
        If Not testBend.IsFlat Then
            hasBend = True
            Exit For
        End If
    Next
    
    If hasBend Then
        MsgBox "Part is NOT flat."
    Else
        MsgBox "Part is flat."
    End If
End Sub

 


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 4 of 4
rjay75
in reply to: ekinsb

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

Post to forums  

Autodesk Design & Make Report