Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I'm trying to create an iLogic rule that allows the user to create a set number of custom iProperties. The properties are always the same. Right now my rule will ask for each property individually, but I want the whole rule to stop running as soon as the user clicks on "cancel" and everything that has been typed so far to be deleted.
The last two values are booleans, which for whatever reason even though the first radio box button should be "true" returns false so I inverted the labels, which I am not happy about.
customPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")
Dim iprop(8) As String
iprop(1) = "Part Number"
iprop(2) = "Part code"
iprop(3) = "Ø1"
iprop(4) = "Ø2"
iprop(5) = "Total length"
iprop(6) = "Pitch"
iprop(7) = "Cone"
iprop(8) = "Watercooling"
For k = 1 To 6
Dim prop(k) As String
Try
prop(k) = iProperties.Value("Custom", iprop(k))
Catch
'Assume error means not found
customPropertySet.Add("", iprop(k))
iProperties.Value("Custom", iprop(k)) = "null"
End Try
Next
For j = 1 To 6
Dim var(j) As String
If iProperties.Value("Custom", iprop(j)) = "null" Then
var(j) = InputBox("Input a value " & iprop(j), "warning", "")
iProperties.Value("Custom", iprop(j)) = var(j)
End If
Next
For k = 7 To 8
Dim prop(k) As Boolean
Try
prop(k) = iProperties.Value("Custom", iprop(k))
Catch
'Assume error means not found
customPropertySet.Add("", iprop(k))
iProperties.Value("Custom", iprop(k)) = "null"
End Try
Next
For j = 7 To 8
Dim var(j) As Boolean
If iProperties.Value("Custom", iprop(j)) = "null" Then
var(j) = booleanParam = InputRadioBox(iprop(j), "No", "yes", booleanparam, Title := "warning")
iProperties.Value("Custom", iprop(j)) = var(j)
End If
I used this code that I ever so slightly modified : https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-custom-ipropertie/td-p/2953...
Solved! Go to Solution.