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
Solved! Go to Solution.
Solved by ekinsb. Go to Solution.
Solved by rjay75. Go to Solution.
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
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
Thanks for the information.