Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Changing Item# in part list of individual Part to match the Item# of Main PartsList

Anonymous

Changing Item# in part list of individual Part to match the Item# of Main PartsList

Anonymous
Not applicable

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!

0 Likes
Reply
Accepted solutions (1)
890 Views
7 Replies
Replies (7)

JhoelForshav
Mentor
Mentor
Accepted solution

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

 

FINET_Laurent
Advisor
Advisor

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"

@LinkedIn     @JohnCockerill

WCrihfield
Mentor
Mentor

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

EESignature

(Not an Autodesk Employee)

Anonymous
Not applicable

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. 

0 Likes

Anonymous
Not applicable

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!

 

0 Likes

Anonymous
Not applicable

Custom iProperties, Yes that is something I can try too.

Thank you

0 Likes

WCrihfield
Mentor
Mentor

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.

DrawingBOM Object 

DrawingBOMRow Object 

DrawingBOMRow.BOMRow Property 

PartsList Object 

PartsListRow Object 

PartsListRow.ReferencedRows Property 

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)