Autodesk Inventor
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
iLogic Rule to Print String to Parts List
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hello,
I am trying to make an iLogic rule that gets mutliple strings from different places, and prints them to a user property in the Parts List.
My ultimate goal is to print the drawing number, sheet number and the item column value to the user property with the format being...
"XXXXX-X-X"
So far, i can get the drawing number from an iProperty and the sheet number easily. But im getting stumped on obtaining the item coloum value and printing it to the same row.
This is what i have so far...
Dim DWGNUM As String = iProperties.Value("custom", "DWG Number")
SheetNumber = Mid(ThisDoc.Document.ActiveSheet.Name, InStr(1, ThisDoc.Document.ActiveSheet.Name, ":") + 1)
MessageBox.Show(DWGNUM+"-"+SheetNumber, "DXF Number")
And print the message box output to a column in the parts list
Any help is appreciated!
Thanks in advanced
Solved! Go to Solution.
Re: iLogic Rule to Print String to Parts List
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hey everyone, I work with Thomas and have been assisting where i can on the iLogic rule, we have been able to generate the "dxf" number for each row now, dxf number being "Drawing Number - Sheet Number - Item Number"
ex: 123456-7-8. What we would like it to do now is reference/scan our custom iProperty column called "Overall Dim" wich gives us the length of a structual component (10 1/4") or the overall length and width of a sheetmetal component (15 1/8" x 32 1/2"). Our goal is for the iLogic rule to recognize wether or not the "x" is present or not and only generate a dxf for those rows with the x. and then ultimately write that information in our custom DXF No column.
Re: iLogic Rule to Print String to Parts List
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi cmt-edgar,
Here's a quick example of using the String.Contains method to do this.
Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Cu
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
s1 = iProperties.Value("Custom", "Overall Dim")
Dim s2 As String = "x"
Dim b As Boolean
b = s1.Contains(s2)
If b = True Then
MessageBox.Show(s1 & " does contain: " & s2, "iLogic")
Else
MessageBox.Show(s1 & " does NOT contain: " & s2, "iLogic")
End if

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: iLogic Rule to Print String to Parts List
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks Curtis!
This will definitely help.
Is there a way to use the String.Contains method to check a column of the Parts List in the current drawing?
We want to check if a specific cell of the Parts List has an "x", and if it does, we want to write the "dxf" number (Drawing Number - Sheet Number - Item Number) to a cell in the same row as the number tested.
The cell that will contain the DXF number is a user property in the parts list.
Thanks for the help.
Re: iLogic Rule to Print String to Parts List
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi TomTom111,
Here's a quick ilogic example that iterates through the parts list and reads each cell. I'm not sure how you plan tol identify the specific cell to look at so I didn't really look into targeting a specific cell. But hopefully you can use it to work up a solution with the previous example, if not post back and I'll have another look.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
' Set a reference to the first parts list on the active sheet.
' This assumes that a parts list is on the active sheet.
Dim oPartList As PartsList
oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1)
' Iterate through the contents of the parts list.
Dim i As Long
For i = 1 To oPartList.PartsListRows.Count
' Get the current row.
Dim oRow As PartsListRow
oRow = oPartList.PartsListRows.Item(i)
' Iterate through each column in the row.
Dim j As Long
For j = 1 To oPartList.PartsListColumns.Count
' Get the current cell.
Dim oCell As PartsListCell
oCell = oRow.Item(j)
'Display the value of the current cell.
sCell = "Row: " & i & vblf & oPartList.PartsListColumns.Item(j).Title & " = "& oCell.Value
Dim Result = MessageBox.Show( sCell , "iLogic",MessageBoxButtons.OKCancel)
If Result = DialogResult.Cancel Then
Return
Else
End If
Next
Next

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: iLogic Rule to Print String to Parts List
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thank you Curtis,
your expertise has been most helpful.
So now i can show only the values of a certain coloum.
Hopefully, my final question would be-
Can you change the value of a cell in the Parts List with an iLogic rule, or are the cells of the Parts List 'Read Only'?
If you can, what is the code for that?
Say the parts list cell is blank, and you want to wrint a string of text to it.
Re: iLogic Rule to Print String to Parts List
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi TomTom111,
Here's a quick example that looks for a part number and then writes to the description column of that row if the part number matches.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
' Set a reference to the first parts list on the active sheet.
' This assumes that a parts list is on the active sheet.
Dim oPartList As PartsList
oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1)
' Iterate through the contents of the parts list.
Dim i As Long
For i = 1 To oPartList.PartsListRows.Count
'look at only the part number column
oCell = oPartList.PartsListRows.Item(i).Item("PART NUMBER")
'find a specific part number
If oCell.Value = "12-345" Then
'identify the cell in the description column for the row that
'the part number was found in
oCell2 = oPartList.PartsListRows.Item(i).Item("DESCRIPTION" )
'write to the target cell
oCell2.Value = "Bingo!"
End if
Next

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: iLogic Rule to Print String to Parts List
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This works great!
Thank you for your time in helping me along with this!
*Expert_Elite* for a reason apparently.
P.S.
Your blog is also of much help.
Thanks much
