Hello there!
I am trying to rename our old files with new naming system.
The Question:
I was familiar with AllReferencedDocuments function and created, a working loop, where I use:
Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument
For Each oRefDoc In oAsmDoc.AllReferencedDocuments
Is there a way to access Parent of Referenced Document?
There is some oRefDoc.Parent option, but I don't know how to use it.
I found in all threads, suggestion to use Occurences.... is there another way?
The Problem:
Old naming was Project Name P-1112-000, 001, 002 and so on.
The new system has design "XXX.YYYZZZ", where XXX represents if its part, assembly, weldment. It it is weldment, then its subparts do not need drawing, because they are consumed in weldment drawing. With this P-1112-011 weldment subpart becomes 201.YYYZZZ-letter. With "AllReferencedComponents" Loop I know, when I go into assembly, but don't know when I leave them. My only Info is, that when there is another weldment, I need start using letters from the start. The problem occur, when there were weldment, part1, part2 on same level; and program thought that part1 and part2 were also part of weldment.
Solved! Go to Solution.
Solved by yuzeaa. Go to Solution.
why is iLogic so easy... if you know it 😄
The working code:
Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument Dim oRefDoc As Document For Each oRefDoc In oAsmDoc.allreferenceddocuments If InStr(oRefDoc.DisplayName, "P-") <> 0 Or InStr(oRefDoc.DisplayName, "RP30-") <> 0 Or InStr(oRefDoc.DisplayName, "RVP30-") <> 0 Then Logger.Info("Child: " & oRefDoc.DisplayName & "____ Parent: " & oRefDoc.ReferencingDocuments.Item(1).DisplayName) End If Next
*There is additional If sentence, to filter out the unneccesary parts,assemblies...
Tnx @yuzeaa
Can't find what you're looking for? Ask the community or share your knowledge.