- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I use an ilogic code that recognizes when there is a bending in a sheet metal part. This code writes "Bend Exist" or "No Bend Exist" to a custom property in the part.
This code is included in the sheet metal template, which means that new files automatically receive this code. But unfortunately there are also parts that do not include this code. When such a part is copied, the code is missing again unless someone happens to think about it.
Now I would like to use this code as an External rule (and therefore also remove it from the template). However, I get the error below when trying to save a regular part (no sheet metal part). How to change the code so that it only runs on a sheet metal part.
Furthermore, I would like to see the "msgbox" close automatically after three seconds or not come up at all.
The ilogic code is stored in the system configuration folder within our Vault environment. So every user can access it. How do I ensure that this external ilogic rule works for all users '' automatically '' ...?
Public Sub Main()
Dim a As Inventor.Application
a = ThisApplication
Dim b As PartDocument
b = ThisDoc.Document
Dim sm As SheetMetalComponentDefinition
sm = b.ComponentDefinition
MsgBox (sm.Bends.Count)
Dim customProp As Inventor.Property
On Error Resume Next
customProp = b.PropertySets.Item(4).Add("Bend Exist", "Bending")
If Err.Description Then
Err.Clear
End If
customProp = b.PropertySets.Item(4).Item("Bending")
If sm.Bends.Count > 0 Then
customProp.Value = "Bend Exist"
Else If sm.Bends.Count = 0 Then
customProp.Value = "No Bend Exist"
End If
End Sub
I hope someone can help me with this.
Kinds regards,
Jeffrey
Solved! Go to Solution.