iLogice rule to fill our iProperties from Microsof Excel file

iLogice rule to fill our iProperties from Microsof Excel file

Anonymous
Not applicable
1,068 Views
8 Replies
Message 1 of 9

iLogice rule to fill our iProperties from Microsof Excel file

Anonymous
Not applicable

Hello, I am very new to iLogic, but have been interested in getting to know it better.  I am trying to write a piece of code that will allow me to pull information from an excel file and insert that into the iProperties for the part specified.  the excel file is very simple and in the first row the columns read as follows: PART NUMBER, DESCRIPTION, PROJECT, TITLE

I have got the code to read from the file, but it only fills out the iProperties on the part with information listed from the first part on the list in the excel file. 

part_number = InputBox("Plese enter the part number", "Get Data")

i = GoExcel.FindRow("C:\LSE Vault\Data\iProperties_new.xlsx", "Sheet1", "PART NUMBER", "=", part_number, "DESCRIPTION", "=", part_description, "PROJECT", "=", part_project, "TITLE", "=", part_title)
part_description = GoExcel.CurrentRowValue("DESCRIPTION")
part_project = GoExcel.CurrentRowValue("PROJECT")
part_title = GoExcel.CurrentRowValue("TITLE")

iProperties.Value("Project", "Part Number") = part_number
iProperties.Value("Project", "Description") = part_description
iProperties.Value("Project", "Project") = part_project
iProperties.Value("Summary", "Title") = part_title

MessageBox.Show("All properties have been applied to " & part_number, "Success")
0 Likes
Accepted solutions (1)
1,069 Views
8 Replies
Replies (8)
Message 2 of 9

bradeneuropeArthur
Mentor
Mentor

could you provide the Excel file for testing?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 9

Anonymous
Not applicable

    

0 Likes
Message 4 of 9

clutsa
Collaborator
Collaborator

My guess is you need to not have all the extra lookup data for the row.

part_number = InputBox("Plese enter the part number", "Get Data")

i = GoExcel.FindRow("C:\LSE Vault\Data\iProperties_new.xlsx", "Sheet1", "PART NUMBER", "=", part_number)
part_description = GoExcel.CurrentRowValue("DESCRIPTION")
part_project = GoExcel.CurrentRowValue("PROJECT")
part_title = GoExcel.CurrentRowValue("TITLE")

iProperties.Value("Project", "Part Number") = part_number
iProperties.Value("Project", "Description") = part_description
iProperties.Value("Project", "Project") = part_project
iProperties.Value("Summary", "Title") = part_title

MessageBox.Show("All properties have been applied to " & part_number, "Success")
If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

Message 5 of 9

bradeneuropeArthur
Mentor
Mentor
part_number = InputBox("Plese enter the part number", "Get Data")

i = GoExcel.FindRow("C:\Vault\Projects\Forum\iProperties_new.xlsx", "Sheet1", "PART NUMBER", "=", part_number)
'i = GoExcel.FindRow("C:\Vault\Projects\Forum\iProperties_new.xlsx", "Sheet1", "PART NUMBER", "=", "0003", "DESCRIPTION", "=", part_description, "PROJECT", "=", part_project, "TITLE", "=", part_title)

part_description = GoExcel.CurrentRowValue("DESCRIPTION")

part_project = GoExcel.CurrentRowValue("PROJECT")
part_title = GoExcel.CurrentRowValue("TITLE")

iProperties.Value("Project", "Part Number") = part_number
iProperties.Value("Project", "Description") = part_description
iProperties.Value("Project", "Project") = part_project
iProperties.Value("Summary", "Title") = part_title

MessageBox.Show("All properties have been applied to " & part_number, "Success")

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 6 of 9

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

I have tried it, and it has worked for me, it has a variable to test if the values of the excel table are empty, not to search in all the excel cells and only those in the table.
I hope it works for you. regards

 

Dim Dirxlsx As String = "C:\LSE Vault\Data\iProperties_new.xlsx" 
Dim osheetbom As String = "Sheet1"     

xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlWorkbook = xlApp.Workbooks.Open(Dirxlsx)
xlWorksheet = xlWorkbook.Worksheets.Item(osheetbom)

part_number = InputBox("Plese enter the part number", "Get Data")

Dim j As Integer = 1
 
Line1 :
oTest = xlWorksheet.Range("A" & j).Value
 
If oTest <> "" Then 
	j = j + 1
	GoTo Line1
End If

For row = 2 To j
	If xlWorksheet.Range("A" & Row).Value = part_number Then
		iProperties.Value("Project", "Part Number") = xlWorksheet.Range("A" & Row).Value
		iProperties.Value("Project", "Description") = xlWorksheet.Range("B" & Row).Value
		iProperties.Value("Project", "Project") = xlWorksheet.Range("C" & Row).Value
		iProperties.Value("Summary", "Title") = xlWorksheet.Range("D" & Row).Value
		MessageBox.Show("All properties have been applied", "Success")

	End If
Next

xlWorkbook.Close (True)
xlApp.Quit

 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 7 of 9

bradeneuropeArthur
Mentor
Mentor

@clutsa 

That was close!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 8 of 9

Anonymous
Not applicable

Thank you! That works great! My next step is to figure out how to apply a rule like this to an assembly drawing and import properties to each part if the properties have yet to be established.  Do you have any advice on what I might look into to point me in the right direction?

0 Likes
Message 9 of 9

clutsa
Collaborator
Collaborator

@bradeneuropeArthur Right! I feel robbed!Smiley Tongue I dropped a "Dim part_number as string" and ran this on an part file with the spreadsheet embedded and it works fine. If I hadn't had a dentist appointment I could have tested it before I posted. Some days man.Smiley Frustrated

Dim part_number As String
part_number = InputBox("Plese enter the part number", "Get Data")

i = GoExcel.FindRow("iProperties_new.xlsx", "Sheet1", "PART NUMBER", "=", part_number)
part_description = GoExcel.CurrentRowValue("DESCRIPTION")
part_project = GoExcel.CurrentRowValue("PROJECT")
part_title = GoExcel.CurrentRowValue("TITLE")

iProperties.Value("Project", "Part Number") = part_number
iProperties.Value("Project", "Description") = part_description
iProperties.Value("Project", "Project") = part_project
iProperties.Value("Summary", "Title") = part_title

MessageBox.Show("All properties have been applied to " & part_number, "Success")
If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes