Multi Select HELPP..

Multi Select HELPP..

Seyitusta2022
Explorer Explorer
554 Views
2 Replies
Message 1 of 3

Multi Select HELPP..

Seyitusta2022
Explorer
Explorer

Can we add to the custom section in the iproperties section by making multiple selections with the radio buttons on the form screen?

0 Likes
555 Views
2 Replies
Replies (2)
Message 2 of 3

Curtis_Waguespack
Consultant
Consultant

Hi @Seyitusta2022 

 

See the recent post from @WCrihfield :

 

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/multiselectlistbox-based-on-ilogic-s...

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 3 of 3

WCrihfield
Mentor
Mentor

Hi @Seyitusta2022.  As Curtis mentioned above, I would likely be much easier to do what you seem to be wanting to do here, by using just an iLogic rule, without that custom iLogic form, because a similar looking form can be presented by the rule itself, that will allow you to list multiple options to choose from, and also allow you to choose multiple of those items at the same time.  Then that rule can continue to create the custom iProperties within whatever document is currently 'active', matching the names chosen in the list.  The example code at that link is fairly basic, and may not immediately be clear to you how to use it, so I decided to show you another way to use some code like that shown at the link, within a custom code here for you, that will create those chosen custom iProperties for you after the selection part is done.

 

This iLogic rule code below first creates the needed list, and populates it with the String type values needed.  You may want to edit those values, or add more items, or remove items, as needed.  Then it uses the techniqe mentioned in that link to present you with a list type dialog, which will allow you to select multiple items before proceeding.  Then it loops through the chosen values, and attempts to create a new custom iProperty for each chosen name.  That iLogic snippet 'iProperties.Value()' will automatically create a custom iProperty for you, if it does not already exist, but only when attempting to set a value to it.  It will not create an iProperty if you are just checking a property's value.  Since no values were specified, I am simply setting the iProperty's name as its value too, but you can change that as needed too.

Dim CustomiPropertyNames As New List(Of String)
CustomiPropertyNames.Add("Operation 1")
CustomiPropertyNames.Add("Operation 2")
CustomiPropertyNames.Add("Operation 3")
CustomiPropertyNames.Add("Operation 4")
CustomiPropertyNames.Add("Operation 5")
CustomiPropertyNames.Add("Operation 6")

Dim SelectedCustomiPropertyNames As List(Of String)
Using oILBD As New Autodesk.iLogic.Runtime.InputListBoxDialog( _
	"Create Custom iProperties", "List Of Custom iProperty Names", _
	"Select the names of the custom iProperties you want to create.", CustomiPropertyNames, "")
	Dim oLB As System.Windows.Forms.ListBox = oILBD.Controls.Item(0).Controls.Item(2)
	oLB.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple
	Dim oDlgResult As System.Windows.Forms.DialogResult = oILBD.ShowDialog()
	'only attempt to 'cast' directly to String, if you know 'input' items were Strings
	SelectedCustomiPropertyNames = oLB.SelectedItems.Cast(Of String).ToList
End Using
If SelectedCustomiPropertyNames.Count = 0 Then Exit Sub
For Each SelectedCustomiPropertyName In SelectedCustomiPropertyNames
	iProperties.Value("Custom", SelectedCustomiPropertyName) = SelectedCustomiPropertyName
Next

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)