Inventor General Discussion

Reply
Active Member
jbauer
Posts: 8
Registered: ‎04-25-2012
Message 1 of 6 (532 Views)
Accepted Solution

Custom Multi-Value Menu in Drawing iProperties

532 Views, 5 Replies
07-10-2012 07:11 AM

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. 

*Expert Elite*
mcgyvr
Posts: 6,716
Registered: ‎12-01-2004
Message 2 of 6 (521 Views)

Re: Custom Multi-Value Menu in Drawing iProperties

07-10-2012 09:59 AM 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

 

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

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

Down with IDW/DWG files..... Long live 3D PMI... Hurry it up already..
-------------------------------------------------------------------------------------
2015 Product Design Suite Ultimate
Windows 7 64 bit
Core i7 4820k processor (OC'd to 4.4Ghz), Nvidia GTX 770, 16G RAM


*Expert Elite*
Curtis_Waguespack
Posts: 2,805
Registered: ‎03-08-2006
Message 3 of 6 (511 Views)

Re: Custom Multi-Value Menu in Drawing iProperties

07-10-2012 11:33 AM 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

 



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





*Expert Elite*
mcgyvr
Posts: 6,716
Registered: ‎12-01-2004
Message 4 of 6 (506 Views)

Re: Custom Multi-Value Menu in Drawing iProperties

07-10-2012 11:38 AM 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..

 

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

Down with IDW/DWG files..... Long live 3D PMI... Hurry it up already..
-------------------------------------------------------------------------------------
2015 Product Design Suite Ultimate
Windows 7 64 bit
Core i7 4820k processor (OC'd to 4.4Ghz), Nvidia GTX 770, 16G RAM


Active Member
jbauer
Posts: 8
Registered: ‎04-25-2012
Message 5 of 6 (494 Views)

Re: Custom Multi-Value Menu in Drawing iProperties

07-10-2012 01:56 PM 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.

*Expert Elite*
Curtis_Waguespack
Posts: 2,805
Registered: ‎03-08-2006
Message 6 of 6 (488 Views)

Re: Custom Multi-Value Menu in Drawing iProperties

07-10-2012 02:22 PM 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

 



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube