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

    Autodesk Inventor Customization

    Reply
    Contributor
    Posts: 12
    Registered: ‎08-24-2012

    Part , Description,excel and ilogic

    722 Views, 12 Replies
    08-24-2012 09:10 AM

    Thanks to Curtis who guide me to this Discussion Groups over my question. We make assemblies from solid bodies. Every part must have material and material description. We created custom iproperties for those two,and we would like to have ilogic rule with drop list of our library(samle excel library file att) which has over 3000 material codes and is growing every day. On the end this information should be filled in inventor bom becouse we exporting bom csv file for use in other program . If this can be done with ilogic it will save a tone of time. I'm typing info for each part in iproperties and it is taking a long  to complete job.

    I 'm apreciate help

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

    Re: Part , Description,excel and ilogic

    08-24-2012 11:27 AM in reply to: MisterZS

     

    Hi MisterZS,

     

    I'm not aware of a way to add a list to the BOM editor, but you might be able to do it using a custom form. I won't have time to look at this any time soon, but here are some snippets that might help someone else if they get a chance to help.

     

    These snippets get the list of materials from Excel, reading from row 2 to the last used row (assuming the list isn't longer than 10000 rows).

     

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

     

    'get list from XL using an arraylist
    
    'define the XLS to look at
    myXLS = "U:\iLogic examples\XLS lookup\Mat Library.xls"
    GoExcel.Open(myXLS)
    
    'index row 2 through 10000
    For rowNumber = 2 To 10000
    'find first empty cell in column A
     If (GoExcel.CellValue("A" & rowNumber) = "") Then
    '  If (GoExcel.CellValue(myXLS,"Sheet1", "A" & rowNumber) = "") Then
    'create a variable for the row that is one row less than the first empty row found
    'this assumes the first empty row is the end of the list
    lastUsedRow = rowNumber - 1
    Exit For
    End If
    Next
    
    'set the list to be read from the XLS file
    Dim myArrayList As New ArrayList
    i = 2
    
    'add the values from the Excel file to an array list
    Do until i = lastUsedRow +1 
    myArrayList.add(GoExcel.CellValue("B" & i)) 
    i = i + 1
    Loop
    
    'present the list to the user
    myMatl= InputListBox("Select from the list", myArrayList, myArrayList.Item(0), "iLogic", "Available Materials")
    
    'set the iProperty
    iProperties.Value("Project", "Description") = myMatl
    
    'present the result
    MessageBox.Show("The Description is: " & iProperties.Value("Project", "Description"), "iLogic")

     

    OR

     

    'get list from XL using an existing multi value parameter list

    'define the XLS to look at myXLS = "U:\iLogic examples\XLS lookup\Mat Library.xls" GoExcel.Open(myXLS) 'index row 2 through 10000 For rowNumber = 2 To 10000 'find first empty cell in column A If (GoExcel.CellValue("A" & rowNumber) = "") Then 'create a variable for the row that is one row less than the first empty row found 'this assumes the first empty row is the end of the list lastUsedRow = rowNumber - 1 Exit For End If Next 'add the values from the Excel file to the list MultiValue.List("Material_List") = GoExcel.CellValues(myXLS, "Sheet1", "B2", "B" & lastUsedRow) 'present the list to the user myMatl= InputListBox("Select from the list", MultiValue.List("Material_List"), MultiValue.List("Material_List").Item(0), "iLogic", "Available Materials") 'set the iProperty iProperties.Value("Project", "Description") = myMatl 'present the result MessageBox.Show("The Description is: " & iProperties.Value("Project", "Description"), "iLogic")

     

     



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

    Please use plain text.
    ADN Support Specialist
    xiaodong.liang
    Posts: 805
    Registered: ‎06-12-2011

    Re: Part , Description,excel and ilogic

    08-29-2012 08:48 PM in reply to: Curtis_Waguespack

    Hi,

     

    As I know, there is no API for "BOM column customization" like UI does. Curtis’s solution is nice to me, i.e. customize with Excel table. You can also customize the Excel table directly, e.g. add a column and read the relevant information from the PropertySet of the corresponding BOM componenet.

     

    In addition, another thread may be of a bit help:

     

    http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Add-custom-iProperty-to-BOM-using-API/...



    Xiaodong Liang
    Developer Technical Services
    Autodesk Developer Network

    Please use plain text.
    Contributor
    Posts: 12
    Registered: ‎08-24-2012

    Re: Part , Description,excel and ilogic

    08-30-2012 01:14 PM in reply to: MisterZS

    Thank you for your help. Link you gave doesn't work. Code from Curtis is nice and is working but i'm afraid that is not what i'm looking for. After i make components my parts need to receive saome text informaton. That text need to be in iproperties which i map to Bom in Inventor. That is becouse i'm saving bom file as csv(comma delimited) for use in another program.. With text parameter with multi value option would work perfect, but how to do that.  I made bom columns in way how we need and bom is done, except i need  to fill those 2 columns with text which is most time every time different. Any idea how to export  text parameter or something similar .

    Please use plain text.
    Contributor
    Posts: 12
    Registered: ‎08-24-2012

    Re: Part , Description,excel and ilogic

    09-04-2012 02:36 PM in reply to: MisterZS

    I realy need help in this. If you look first code written by  Curtis. It is working very well for me, but i need upgrade.

    This code read column A. What i need is that whatever i choose from column A to fill out what is in column b in same row. For  example if i choose A 55 i need to fill iproperties what is in B55.

    A column is code and B column is description.

    Thank you for help and support

    Please use plain text.
    ADN Support Specialist
    xiaodong.liang
    Posts: 805
    Registered: ‎06-12-2011

    Re: Part , Description,excel and ilogic

    09-04-2012 06:10 PM in reply to: MisterZS

    oops, the link is truncted. It should be

     

    http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Add-custom-iProperty-to-BOM-using-API/...

     

    Hope it helps a bit.



    Xiaodong Liang
    Developer Technical Services
    Autodesk Developer Network

    Please use plain text.
    Contributor
    Posts: 12
    Registered: ‎08-24-2012

    Re: Part , Description,excel and ilogic

    09-05-2012 10:42 AM in reply to: MisterZS

    Here is code that i was worked on it folowing code from Curtis. I do have 2 parameters in iproperties material code and material description. Runing this rule it fillout my 2iproperties.

    I would like  just to pick code and description to be filled automaticly. Any idea?

    In Excel ther is only two columns. Code and material description.

    Thanks for any idea comments sugestions

     

    'get list from XL using an arraylist

    'define the XLS to look at
    myXLS="K:\ExcelMaterial.xls"
    GoExcel.Open(myXLS)

    'index row 2 through 10000
    ForrowNumber=2To10000
    'find first empty cell in column A
    If(GoExcel.CellValue("A"&rowNumber)=(""))Then
    ' If (GoExcel.CellValue(myXLS,"Sheet1", "A" & rowNumber) = "") Then
    '
    create a variable for the row that is one row less than the first empty row found
    '
    this assumes the first empty row is the end of the list
    lastUsedRow=rowNumber-1



    EndIf

    If(GoExcel.CellValue("B"&rowNumber)=(""))Then
    ' If (GoExcel.CellValue(myXLS,"Sheet1", "B" & rowNumber) = "") Then
    '
    create a variable for the row that is one row less than the first empty row found
    '
    this assumes the first empty row is the end of the list
    lastUsedRow=rowNumber-1

    ExitFor
    EndIf
    Next

    'set the list to be read from the XLS file
    DimmyArrayListAsNewArrayList
    i=2

    'add the values from the Excel file to an array list
    DoUntili=lastUsedRow+1
    myArrayList.add(GoExcel.CellValue("A"&i))
    myArrayList.add(GoExcel.CellValue("B"&i))
    i=i+1
    Loop



    'present the list to the user
    myMatl=InputListBox("Select from the list", myArrayList, myArrayList.Item(0), "iLogic", "Available Codes")
    myMat2=InputListBox("Select from the list", myArrayList, myArrayList.Item(0), "iLogic", "Available Materials")
    'set the iProperty
    iProperties.Value("Custom", "PartMat")=myMatl
    iProperties.Value("Custom", "MATERIAL DESCRIPTION")=myMat2
    'present the result
    MessageBox.Show("The Code is: "&iProperties.Value("Custom", "PartMat"), "iLogic")
    MessageBox.Show("The description is: "&iProperties.Value("Custom", "MATERIAL DESCRIPTION"), "iLogic")
    Please use plain text.
    Contributor
    Posts: 12
    Registered: ‎08-24-2012

    Re: Part , Description,excel and ilogic

    09-07-2012 04:17 AM in reply to: MisterZS

    Any idea?

    Please use plain text.
    ADN Support Specialist
    xiaodong.liang
    Posts: 805
    Registered: ‎06-12-2011

    Re: Part , Description,excel and ilogic

    09-09-2012 10:24 PM in reply to: MisterZS

    Hi,

     

    it looks to me the code has achieved what you need. Its workflow is:

     

    1) get the values of each column of the Excel (part material and material description)

    2) fill in the dropdown box of the dilaogs with the values of  each column

    3) ask the user to select what he wants to use

    4) set the corresponding iProperties with the values the user selects.

     

    So, It is not clear to me what is your problem right now. Could you elaborate?

     

     



    Xiaodong Liang
    Developer Technical Services
    Autodesk Developer Network

    Please use plain text.
    Contributor
    Posts: 12
    Registered: ‎08-24-2012

    Re: Part , Description,excel and ilogic

    09-10-2012 03:06 AM in reply to: MisterZS

    Well,

    thanks for the comment. Here is what i would like. If i pick part in for example in A1 to fill automaticly what is in B1

    or what is in A10 to be auto fill in B10. List is long and it take time to find what i need but code like this is working just fine. But my question is can we work to find even better?

    Thanks to all for comments, ideas sugestions.

    Please use plain text.