Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
Is it possible to get the source of the parts list, for which model it is?
have a lovely day
Solved! Go to Solution.
Hi
Is it possible to get the source of the parts list, for which model it is?
have a lovely day
Solved! Go to Solution.
Hi @engilic. Yes. The PartsList object has a property called ReferencedDocumentDescriptor that will help in this situation. That property returns a DocumentDescriptor object, which then has a lot of useful properties of its own, such as the FullDocumentName, and the ReferencedDocument.
Dim oDDoc As DrawingDocument = ThisApplication.ActiveDocument
oPList = oDDoc.ActiveSheet.PartsLists.Item(1)
oFDN = oPList.ReferencedDocumentDescriptor.FullDocumentName
MsgBox("PartsList source = " & oFDN, vbInformation, "")
Wesley Crihfield
(Not an Autodesk Employee)
One more question if I can.
Is it possible to change the Source of the Parts List, both by code and also in Inventor, manually?
You can choose it when you put it, manually, but I do not see the option to change it even when you have views of more than one file in the drawing.
thank you very much @WCrihfield
Hi @engilic. It is 'sort of' possible to change the source of a PartsList, but it is likely not as ideal as you are expecting. It is similar to the effects of using the Manage tab > Modify panel > Replace Model Reference tool (manually), or replacing the model being referenced by a drawing view. It seems to replace that model reference for the whole drawing document, not just for the PartsList, even though the process is started from the PartsList. And, I believe the other model document you are specifying to be the replacement must be open (not necessarily the 'active' document though) for the replacement (by code) to work.
Below is an example of what I'm talking about:
Dim oDDoc As DrawingDocument = ThisApplication.ActiveDocument
oPList = oDDoc.ActiveSheet.PartsLists.Item(1)
oRFD = oPList.ReferencedDocumentDescriptor.ReferencedFileDescriptor
oRFD.ReplaceReference("C:\Temp\Tests\TestAssembly 1.iam")
oDDoc.Update
It is most likely going to be more advantageous to capture the position of the existing PartsList, then delete it, then create a new one in its place that has the other model reference. When creating a new PartsList by code, you can provide either a DrawingView object, or a Document object to the PartsLists.Add() method as its source.
Wesley Crihfield
(Not an Autodesk Employee)