- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
(Inventor 2017) I’m attempting to automate the population of some iProperties I use for my parts, which then populate fields in my drawings. My company uses charge numbers for billing time, which I’ve been recording in the iProperties “Project” text box on the Project tab.
I modified some of Curtis Waguespack’s code I found here (thank you, Curtis), to pull a list of charge numbers from an excel sheet into a multi-value parameter named “chargeNumbers” (my code below).All is good so far.
He included an input list box that I wanted to keep, too (thank you, Curtis) and I wanted to populate the iProperties “Project” parameter with that selection BUT….it seems that iLogic cannot access that parameter. The error I get is " 'Project' is not a member of 'Autodesk.iLogic.Interfaces.IiProperties'."
I’ll not bother to ask why one isn’t allowed to access that parameter, if that's the case; instead, does anyone know another way to accomplish this last step? Can I define my own iProperty called “Charge Number” and populate it by iLogic? Is there a Curtis-level line of code that lets me get at the iProperty I want? Should I just keep doing it manually instead of braining my damages with iLogic?
Much appreciation for any ideas,
Andrew
iLogicVb.UpdateWhenDone = True
'check For Parameter and create If Not found
Try
'get parameter value (just to see if it exists)
oTest = Parameter("chargeNumbers")
Catch
' Get the active document. Assumes a part document is active.
Dim partDoc As PartDocument
partDoc = ThisApplication.ActiveDocument
' Get the UserParameters collection
Dim userParams As UserParameters
userParams = partDoc.ComponentDefinition.Parameters.UserParameters
'create the parameter
oParam = userParams.AddByValue("chargeNumbers", "g-job", UnitsTypeEnum.kTextUnits)
End Try
'Set the list
MultiValue.List("chargeNumbers") = GoExcel.CellValues("chargeNumbers.xlsx", "Sheet1", "A1", "A10")
'Get user input and set number
iProperties.Project = InputListBox("Choose a number.", _
MultiValue.List("chargeNumbers"), MultiValue.List("chargeNumbers").Item(0), "iLogic", "List of charge numbers:")
Solved! Go to Solution.