Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm trying to find the assembly that contains the selected part.
Until now, I use a code where I select a face, from this face, I find the part document and from the part document, I find the assembly document which contains it. I do it following these steps because I need the face and part for other operations. It works well when I only have one assembly open. If another assembly that contains the part is opened, I may end up with the wrong result since I am using item 1.
Is there an easy way to find the assembly or subassembly that contains the selected part?
Attached is a simplified extract of the code :
Sub Main() Dim oFace As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select Face") If oFace Is Nothing Then Exit Sub Dim oPartDoc As PartDocument = oFace.Parent.ComponentDefinition.Document Dim oAsm As AssemblyDocument = oPartDoc.ReferencingDocuments.Item(1) MessageBox.Show(oAsm.DisplayName) End Sub
Thanks. Vincent.
Solved! Go to Solution.