- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Everybody,
I need to provide PartsList to individual Part when I place it on drawing sheet.
But that Part List has item number starting from 1.
However at this Point i will already have Main Assembly Part List on the first Sheet of the document and it has it's own numbering starting from 1.
I want to match the item# between these two = "Assembly" Part list and "individual Part" Part list.
Instead of overwriting the item# manually, I am thinking to create ilogic to the process.
I am already writing the code to loop through the partlist available on sheets and match the referenceDocument file name in each row of each part list to find the common base.
Before continuing I want to make that can we actually overwrite the item# in part list to match with main partList in ilogic.? Is it possible? If so what function will help to achieve that? Please help!
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @Anonymous
Assuming that the main partslist is the first partslist of the first sheet in the document, and the itemnumber is the first cell of each row in your partslist style, this should at least make it look right. I couldn't find a way to change the start index of the partslists for the individual parts, but you can override the value with a static value.
There are a lot of loops in this code but at least it worked when I tried it ![]()
Dim oDrawing As DrawingDocument = ThisDoc.Document Dim oMainPartsList As PartsList = oDrawing.Sheets(1).PartsLists(1) For Each oRow As PartsListRow In oMainPartsList.PartsListRows For Each oBOMrow As DrawingBOMRow In oRow.ReferencedRows For Each oDef As ComponentDefinition In oBOMrow.BOMRow.ComponentDefinitions For Each oSheet As Sheet In oDrawing.Sheets For Each oPartsList As PartsList In oSheet.PartsLists If oPartsList IsNot oMainPartsList If oPartsList.ReferencedDocumentDescriptor.ReferencedDocument Is oDef.Document _ Then oPartsList.PartsListRows.Item(1).Item(1).Value = oBOMrow.BOMRow.ItemNumber End If Next oSheet.Update Next Next Next Next
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Maybe create a custom iProperty with the right item numbers and display it inside the part list ?
Regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How is the drawing set up? For example, are the views on all the other pages also views of the main assembly file, but are all filtered to only show one component, using ViewRepresentation and or Level of Detail representations, or are the views on those other pages all created from the different model files directly? If they are all views of the main assembly file that are filtered to only show the one part/sub-assembly, then it sounds like you could just copy the same PartsList to all the other pages, but then turn visibility of all rows, accept the one representing the model being shown on that sheet, off within each PartsList, per sheet.
Or if each of the other sheets only contain views based on the individual model files, yet you still want to maintain the same PartsList ItemNumber of that item that is shown on the first sheet, for the matching item on the individual sheet later in the drawing, then that situation is a bit more complicated, and could possibly be solved using something similar to the methods mentioned above.
If going the custom iProperties route, you could loop through the main parts list on the first page, and write that rows item number to a custom iProperty within the document being represented by that row. Then within the other sheets/PartsLists, simply recall that custom iProperty from the document being represented on that sheet to use as the ItemNumber to show within its PartsList row on that sheet.
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I tired that but the issue with that is that every time my Partlist is updated I have to Renumbering and that again will deviate from custom item numbers. So I had to do something with the ilogic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This worked perfectly! Exactly what I was looking for.
I tweaked this code a little such that it will search for the mainPartlist through each sheet and since my mainpartlist will have atleast more than 2 rows I provided that If oRowMain >2 Then statement.
Thank you for this solution. But I do have one question with this line below.
For Each oBOMrow As DrawingBOMRow In oRow.ReferencedRows
This means that it is trying to find that item in Partlist row in the BOM with common reference document? And from that it is grabbing the component definition? What this definition would be? Please elaborate if you can!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Basically, the PartsList (local to the drawing document) is refferencing the DrawingBOM (local to the drawing document), then the DrawingBOM is referencing the model's BOM (obviously local to the model document).
A model BOM row can contain 'child' rows, and therefore you can retrieve ComponentDefinitions (plural) from that row. Usually, if there are no child rows, the first item in this collection will be the one being represented by the row. You can then get the document object from that ComponentDefinition. That document can then be compared to the document being represented on each sheet's PartsList.
Here are the online help pages for those items in question.
PartsListRow.ReferencedRows Property
Wesley Crihfield
(Not an Autodesk Employee)