Can an iLogic Function return multiple parameters?

Can an iLogic Function return multiple parameters?

Anonymous
Not applicable
1,815 Views
4 Replies
Message 1 of 5

Can an iLogic Function return multiple parameters?

Anonymous
Not applicable

And if so, how?

If not, is there any good workaround?

 

I'm thinking shared parameters may not be a good solution since I'll be calling the function multiple times to modify different sets of parameters.

0 Likes
Accepted solutions (1)
1,816 Views
4 Replies
Replies (4)
Message 2 of 5

Sergio.D.Suárez
Mentor
Mentor

Hi, A simple method could be to take each parameter within the function and create a string with a specific dividing character, for example a "|", then return this string.
When this string is returned it could be divided with a "split" and take each parameter again to perform an action.
Here is an example of how to create a split

'Parameters
Dim p1 As Double = 5.3
Dim p2 As Double = 14.2
Dim p3 As Double = 515.8
Dim p4 As String = "Example"
Dim p5 As Double = - 8.8
Dim sep As String = "|" 
'Create String
Dim oString As String = p1 & sep  & p2 & sep & p3 & sep & p4 & sep & p5

MessageBox.Show(oString)

'Split String
Words = oString.Split(sep)

'List all values
For Each wrd In Words
	MessageBox.Show(wrd)
Next

 I hope to be clear, greetings!


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 5

Anonymous
Not applicable

Thank you!

I was hoping someone would prove me wrong, and there is a native way to return multiple parameters, but this approach gets the job done well! 😃

0 Likes
Message 4 of 5

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Maybe this comes closer to your needs!

Public Sub main()
MsgBox x(o)
End Sub
Public Function x() As Variant

 x = Array("parameter1", "parameter2", "parameter3")
End Function

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

Message 5 of 5

JelteDeJong
Mentor
Mentor
Accepted solution

just another option if you are using iLogic. You can use the posibility to ceate a class and use global variables.

Public Class ThisRule ' <-- This name is required
	Private para1 As String
	Private para2 As String
	Private para3 As String
	
	Public Sub Main() ' <-- This name is required
		
		subFunction()
		MsgBox(para1)
		MsgBox(para2)
		MsgBox(para3)
		
	End Sub
	
	Private Sub subFunction()
		para1 = "test1"
		para2 = "test2"
		para3 = "test3"
	End Sub
End Class

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com