Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Multi-Value Menu in Drawing iProperties

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
jbauer
1900 Views, 5 Replies

Custom Multi-Value Menu in Drawing iProperties

Does anyone know how to make a multi-value drop down menu in drawing iProperties? 

 

I want to make a list with aluminum extrusion sizes where I can pick it's name from a list of names. Similar to the custom iProperties "Design State".

Thanks. 

5 REPLIES 5
Message 2 of 6
mcgyvr
in reply to: jbauer

easy enough to make an ilogic rule to populate a custom iproperty field from a predefined list.

 

First open your drawing template. Go to the custom tab of the iproperties and add a new iproperty named EXTRUSION

Then create a new ilogic rule (manage tab..ilogic section..add rule button) in your drawing template file and copy/paste the code between the asterisks below into that rule.

 

You modify/add the "Extrusion Type 1" to be whatever you want like .. You can add more than 3 or whatever..

 

 

***********************************************

'Requires a custom iProperty called "EXTRUSION" already defined in your drawing iproperties.
Dim CExt As New ArrayList
CExt.Add("Extrusion Type 1")
CExt.Add("Extrusion Type 2")
CExt.Add("Extrusion Type 3")

iProperties.Value("Custom", "EXTRUSION") = InputListBox("Select the extrusion type", CExt, iProperties.Value("Custom", "EXTRUSION"), Title := "Extrusion", ListName := "Extrusion")

iLogicVb.UpdateWhenDone = True

 

************************************************



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 3 of 6
Curtis_Waguespack
in reply to: jbauer

 

Hi jbauer, 

 

I'll add to mcgyvr's iLogic rule and suggest a Try/Catch to create the custom iProperty for you (if it's not found). The rule can then be created as an external rule and triggered on any appropriate part, without the need to setup the custom iProperty first.

 

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

 

'define the custom property name
Dim propertyName1 As String= "EXTRUSION"

'create a list of values
Dim CExt As New ArrayList
CExt.Add("Extrusion Type 1")
CExt.Add("Extrusion Type 2")
CExt.Add("Extrusion Type 3")

'define an input list and get the user selected value from the list
Dim sInput as String
sInput = InputListBox("Select the extrusion type", CExt, CExt.Item(0), "iLogic", "Extrusion")

Try
'set the custom property value
iProperties.Value("Custom", propertyName1) = sInput
Catch
' Assume error means the property was not found
'define custom property collection
oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")
'create the custom property
oCustomPropertySet.Add("", propertyName1)
'set the custom property value
iProperties.Value("Custom", propertyName1) = sInput
End Try

 

Message 4 of 6
mcgyvr
in reply to: Curtis_Waguespack

Nice Curtis

Clearly I'm an ilogic newbie..but you've got to start somewhere.. I will be adding that to my code.. Just last week I was getting annoyed because I had some old models that didn't have the custom props already assigned (its in my template files now) and kept having to go and add them.

 

ooo.. didn't notice we had an "Insert code" function on this board either..

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 5 of 6
jbauer
in reply to: jbauer

Thanks for the code. It works great. Is there a way the code can be made a multiple value? There are times when I may have 2 or more types of extrusion in a drawing.

Thanks again.

Message 6 of 6
Curtis_Waguespack
in reply to: jbauer

Hi jbauer,

 

Something like this maybe?

 

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

 

 

'define the custom property name
Dim propertyName1 As String= "EXTRUSION_A"
Dim propertyName2 As String= "EXTRUSION_B"

'create a list of values
Dim CExt1 As New ArrayList
CExt1.Add("Extrusion Type 1")
CExt1.Add("Extrusion Type 2")
CExt1.Add("Extrusion Type 3")

'create a list of values
Dim CExt2 As New ArrayList
CExt2.Add("Extrusion Type 4")
CExt2.Add("Extrusion Type 5")
CExt2.Add("Extrusion Type 6")

'define an input list and get the user selected value from the list
Dim sInput1 as String
sInput1 = InputListBox("Select the extrusion type", CExt1, CExt1.Item(0), "iLogic", propertyName1)

'define an input list and get the user selected value from the list
Dim sInput2 as String
sInput2 = InputListBox("Select the extrusion type", CExt2, CExt2.Item(0), "iLogic", propertyName2)

Try
'set the custom property value
iProperties.Value("Custom", propertyName1) = sInput1 
Catch
' Assume error means the property was not found 
'define custom property collection
oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")
'create the custom property
oCustomPropertySet.Add("", propertyName1)
'set the custom property value
iProperties.Value("Custom", propertyName1) = sInput1 
End Try

Try
'set the custom property value
iProperties.Value("Custom", propertyName2) = sInput2 
Catch
' Assume error means the property was not found 
'define custom property collection
oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")
'create the custom property
oCustomPropertySet.Add("", propertyName2)
'set the custom property value
iProperties.Value("Custom", propertyName2) = sInput2 
End Try

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report