• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor

    Reply
    Active Member
    Posts: 8
    Registered: ‎04-25-2012
    Accepted Solution

    Custom Multi-Value Menu in Drawing iProperties

    260 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. 

    Please use plain text.
    *Expert Elite*
    Posts: 5,604
    Registered: ‎12-01-2004

    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

     

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

    Please click "Accept as Solution" if this response answers your question.
    -------------------------------------------------------------------------------------
    2012 Product Design Suite Ultimate
    Windows 7 64 bit
    90G OCZ SATA 3 SSD (My SSD is faster than your HDD)
    Core I7 920 processor, ATI HD6970 graphics card, 12G Corsair RAM


    Please use plain text.
    *Expert Elite*
    Curtis_Waguespack
    Posts: 1,964
    Registered: ‎03-08-2006

    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.

    Please use plain text.
    *Expert Elite*
    Posts: 5,604
    Registered: ‎12-01-2004

    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..

     

    Please click "Accept as Solution" if this response answers your question.
    -------------------------------------------------------------------------------------
    2012 Product Design Suite Ultimate
    Windows 7 64 bit
    90G OCZ SATA 3 SSD (My SSD is faster than your HDD)
    Core I7 920 processor, ATI HD6970 graphics card, 12G Corsair RAM


    Please use plain text.
    Active Member
    Posts: 8
    Registered: ‎04-25-2012

    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.

    Please use plain text.
    *Expert Elite*
    Curtis_Waguespack
    Posts: 1,964
    Registered: ‎03-08-2006

    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.

    Please use plain text.