Recognize bending in sheet metal parts

Recognize bending in sheet metal parts

Anonymous
Not applicable
5,445 Views
36 Replies
Message 1 of 37

Recognize bending in sheet metal parts

Anonymous
Not applicable

Hi,

 

Is it possible with VBA or ilogic that Inventor can recognize if a sheet metal part is just flat or that a bending exist?

I would like an automatic Iproperty of choice to be filled in if there is a bend in the plate part..

This would make sorting much easier for me.

 

I hope someone can help me with this.
Thanks in advance.

 

Regards.
Jeffrey

0 Likes
Accepted solutions (2)
5,446 Views
36 Replies
Replies (36)
Message 2 of 37

bradeneuropeArthur
Mentor
Mentor

Public Sub main()

Dim a As Application
Set a = ThisApplication

Dim b As PartDocument
Set b = a.ActiveDocument

Dim sm As SheetMetalComponentDefinition
Set sm = b.ComponentDefinition

MsgBox sm.Bends.Count

End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 37

Anonymous
Not applicable

Hi,

 

Thanks for your help.

Where should I indicate in which iProperty it must be completed?

I don't have so much experience in these thinks yet..

 

Regards,

Jeffrey

0 Likes
Message 4 of 37

bradeneuropeArthur
Mentor
Mentor

this:

Public Sub main()

Dim a As Application
Set a = ThisApplication

Dim b As PartDocument
Set b = a.ActiveDocument

Dim sm As SheetMetalComponentDefinition
Set sm = b.ComponentDefinition

MsgBox sm.Bends.Count

If sm.Bends.Count > 0 Then

Dim customProp As Property
On Error Resume Next
Set customProp = b.PropertySets.Item(4).Item("CustomProp").Value = "CustomProp"
Set customProp = b.PropertySets.Item(4).Add("Bend Exist", "CustomProp")

End If
End Sub

 

Regards,

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Dimension Component! | Partlist Export! | Derive I-properties! | Vault Prompts Via API! | Vault Handbook/Manual!
Drawing Toggle Sheets! | Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 37

Anonymous
Not applicable

SyntaxEditor Code Snippet

Public Sub Main()

Dim a As Application
Set a = ThisApplication

Dim b As PartDocument
Set b = a.ActiveDocument

Dim sm As SheetMetalComponentDefinition
Set sm = b.ComponentDefinition

MsgBox sm.Bends.Count

If sm.Bends.Count > 0 Then

Dim customProp As Property
On Error Resume Next
Set customProp = b.PropertySets.Item(4).Item("Bending").Value = "CustomProp"
Set customProp = b.PropertySets.Item(4).Add("Bend Exist", "Bending")

End If
End Sub

Did I fill it in so well? (name iproperty = bending)

Because I get some errors..

 

Rule Compile Errors in Bending, in 21629.ipt

Error on Line 4 : Let- en Set-toewijzingsinstructies worden niet langer ondersteund.
Error on Line 7 : Let- en Set-toewijzingsinstructies worden niet langer ondersteund.
Error on Line 10 : Let- en Set-toewijzingsinstructies worden niet langer ondersteund.
Error on Line 12 : Methodeargumenten moeten tussen haakjes worden geplaatst.
Error on Line 16 : Het sleutelwoord benoemt geen type.
Error on Line 18 : Let- en Set-toewijzingsinstructies worden niet langer ondersteund.
Error on Line 19 : Let- en Set-toewijzingsinstructies worden niet langer ondersteund.

 

Regards,

Jeffrey

 

 

0 Likes
Message 6 of 37

bradeneuropeArthur
Mentor
Mentor

the code is for VBA:

 

for illogic:

 

remove all "set"

 

Public Sub Main()

Dim a As Application
a = ThisApplication

Dim b As PartDocument
b = a.ActiveDocument
Dim sm As SheetMetalComponentDefinition
sm = b.ComponentDefinition

MsgBox sm.Bends.Count

If sm.Bends.Count > 0 Then

Dim customProp As Property
On Error Resume Next
customProp = b.PropertySets.Item(4).Item("Bending").Value = "Bend Exist"
customProp = b.PropertySets.Item(4).Add("Bend Exist", "Bending")

End If
End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 7 of 37

Anonymous
Not applicable

I still have a error left..

Sorry but I can not fix this myself Smiley Indifferent

 

Rule Compile Errors in Bending, in 21629.ipt

Error on Line 11 : Methodeargumenten moeten tussen haakjes worden geplaatst.
Error on Line 15 : Het sleutelwoord benoemt geen type.

0 Likes
Message 8 of 37

bradeneuropeArthur
Mentor
Mentor
set your project to "straight Vba Code"

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 9 of 37

Anonymous
Not applicable

I have adjusted that now.

One error left:

 

Rule Compile Errors in Bending, in 21634.ipt

Error on Line 1 : De instructie is niet geldig in een naamruimte.

 

 

0 Likes
Message 10 of 37

bradeneuropeArthur
Mentor
Mentor

Dim a As inventor.Application

a = ThisApplication

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 11 of 37

Anonymous
Not applicable

Still have a error..

 

Rule Compile Errors in Bending, in 21634.ipt

Error on Line 1 : De instructie is niet geldig in een naamruimte.

 

This is the code right now:

 

SyntaxEditor Code Snippet

Public Sub Main()

Dim a As Inventor.Application
Set a = ThisApplication

Dim b As PartDocument
Set b = a.ActiveDocument

Dim sm As SheetMetalComponentDefinition
Set sm = b.ComponentDefinition

MsgBox sm.Bends.Count

If sm.Bends.Count > 0 Then

Dim customProp As Property
On Error Resume Next
Set customProp = b.PropertySets.Item(4).Item("Bending").Value = "CustomProp"
Set customProp = b.PropertySets.Item(4).Add("Bend Exist", "Bending")

End If
End Sub
0 Likes
Message 12 of 37

bradeneuropeArthur
Mentor
Mentor

tested and it works now:

 

Public Sub Main()
Dim a As Inventor.Application
a = ThisApplication

Dim b As PartDocument
 b = a.ActiveDocument

Dim sm As SheetMetalComponentDefinition
 sm = b.ComponentDefinition

MsgBox (sm.Bends.Count)

If sm.Bends.Count > 0 Then

Dim customProp As Inventor.Property
On Error Resume Next
 customProp = b.PropertySets.Item(4).Item("Bending").Value = "CustomProp"
customProp = b.PropertySets.Item(4).Add("Bend Exist", "Bending")

End If
End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 13 of 37

Anonymous
Not applicable

Strange..

 

If I do Save & Run i do not get any errors but nothing happens when I look to the custom properties..

When I run the rule again in the Ilogic browser I get the error..

 

Error on Line 1 : De instructie is niet geldig in een naamruimte.   (The statement is not valid in a namespace.)

 

Regards,

Jeffrey

0 Likes
Message 14 of 37

bradeneuropeArthur
Mentor
Mentor
Remove the public sub main and the end sub from this module...

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 15 of 37

Anonymous
Not applicable

Hi,

 

Sorry but I realy do not understand what you mean..

I tried diferent thinks but keep getting errors everytime.

Could you possibly place the complete code as it should be?

 

Regards,

Jeffrey

0 Likes
Message 16 of 37

bradeneuropeArthur
Mentor
Mentor
I already provided you the working Code but there must be something wrong or different on your side. I am far away from my desktop so I can help you on this earliest Monday. Could you please send me a private message with a link to this topic so I will not forget.

Regards.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 17 of 37

bradeneuropeArthur
Mentor
Mentor

could you please provide me the complete code you are using?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 18 of 37

Anonymous
Not applicable

Hi,

 

I used the same code as the one that works for you.

 

Public Sub Main()
Dim a As Inventor.Application
a = ThisApplication

Dim b As PartDocument
 b = a.ActiveDocument

Dim sm As SheetMetalComponentDefinition
 sm = b.ComponentDefinition

MsgBox (sm.Bends.Count)

If sm.Bends.Count > 0 Then

Dim customProp As Inventor.Property
On Error Resume Next
 customProp = b.PropertySets.Item(4).Item("Bending").Value = "CustomProp"
customProp = b.PropertySets.Item(4).Add("Bend Exist", "Bending")

End If
End Sub

 

Error on Line 1 : De instructie is niet geldig in een naamruimte.


Regards,

Jeffrey

0 Likes
Message 19 of 37

bradeneuropeArthur
Mentor
Mentor
could you please provide the ipt too?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 20 of 37

Anonymous
Not applicable

Hi,

 

I have attached the file.

I also tested it with a different file.

 

Regards,

Jeffrey

0 Likes