- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Here's my setup,
- I have 14 rules that all use the same dictionary.
- I would like to place that dictionary in a rule, and then pass the value i want to lookup in that dictionary to that rule.
- I would then like the dictionary rule to send the entry back to the main rule
- I would like the main rule to pull values from that entry
my current code looks something like this:
SyntaxEditor Code Snippet
Dim WPS As New Dictionary(Of String, List(Of String))
WPS.Add("10N-888", New List(Of String)(New String(){"10N-888", "P1-P1", "GTAW", "FCAW", "SAW", "N/A", "N/A", "N/A", "0.188-8.000", "CS", "-60", "0.750-1.750"})) ....
....
....
....
.... WPSx = WPS(Parameter("Weld_G1S_WPS"))
Parameter("Weld_G1S_MaxWall") = WPSx(8) Parameter("Weld_G1S_Filler") = WPSx(9) Parameter("Weld_G1S_MinT") = WPSx(10) Parameter("Weld_G1S_CVNR") = WPSx(11)
Does anybody have a tutorial or can provide some help with creating a function that can have varibles passed to and from it?
Basically, I want to pass the parameter "Weld_G1S_WPS" to the new function and then have that function send the entry back and then it pulls the index value out of the entry. I want to do this because when these dictionary entries change, i want to change it in the code once, rather than in 14 different rules.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Nick.Steele.205,
quick and dirty example, but try something like this.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Rule1
Sub Main
Call Number()
Dim map As Inventor.NameValueMap
map = ThisApplication.TransientObjects.CreateNameValueMap()
Dim sString As String
map.Add("sString", "Hello World! : " & oNumber)
iLogicVb.RunRule("Rule2",map)
MessageBox.Show(SharedVariable("Foo_Variable"), "iLogic Rule1")
End Sub
Dim oNumber As Integer
Function Number
oNumber = 12
End Function
Rule2
Dim sArg as String
sArg = RuleArguments("sString")
MessageBox.Show(sArg, "iLogic Rule2")
Dim sNonsense As String
sNonsense = "foo"
SharedVariable("Foo_Variable") = sArg & " " & sNonsense
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Nick,
Hope this might helpful.
Sub sample()
Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument
Dim oFunction As Variant
Dim oAut(1 To 3) As String
Dim tesn As String
oAut(1) = oDoc.PropertySets("Summary Information").Item("Author").value
oFunction = TestFunction(oAut(1)) 'Sending parameter to the function
oAut(2) = oFunction(2) 'getting back one value send by the function TestFunction
oAut(3) = oFunction(3) 'getting back another value send by the function TestFunction
End Sub
Function TestFunction(oAut As String)
Dim oFunction(2 To 3)
oFunction(2) = oAut & "2"
oFunction(3) = oAut & "3"
TestFunction = oFunction
End Function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report