Reply
Solved! Go to solution

Revision Manager Occurrences Meaning

[ Edited ]

I am using a typical recursive function for an assembly using Revision Manager.

The revision manager document has an Occurrences property of type Integer.

I am interpreting it as the count of occurrences within one of the linked documents to check if it is a sub-assembly.

This does not seem to be correct.

A Part document shows the Occurrences as 2 which leads me to think this is the count of the part document instances in its parent assembly document.

Is this correct or is there any other meaning of the Occurrences count of a Revision Manager document ?

 

There is also a Count property on the LinkedDocuments collection which does not get listed, but seems to work.

 

Thanks.

~Tushar

 

4 REPLIES
Solution
Solution
Accepted by topic author Tushar
‎09-05-2015 04:02 AM

Re: Revision Manager Occurrences Meaning

Hello Tushar,

 

to determine whether a RevisionManager.Document is an assembly you could check its FullName property for the extension ".asm". But be aware that the FullName also might end with ".asm!*".

 

RevisionManager.Document.Occurrences indicates the number of instances of that document and has a value >= 1.

 

RevisionManager.Document.LinkedDocuments.Count indicates the number of referenced/linked documents from this document and has a value >= 0. Not only ASM documents, but also DFT, PAR and PSM documents may have LinkedDocuments. So its not a suitable indicator for ASM documents too.

 

Kind regards,
Wolfgang Kunert - www.wksyspro.de

Re: Revision Manager Occurrences Meaning

Thank you Wolfgang for the confirmation.

Your updates match my assumptions and findings.

 

Regards,

Tushar Suradkar

 

Re: Revision Manager Occurrences Meaning

Watch out in your recursive algorithm that you don't end up with an infinite recursion!

 

I found this happend to me when one of the parts (or sub-asms not sure which) had links to a parent assembly.  When my algoritm hit this link, it then set the process off down the chain again (and again, and again....!).

 

To fix, I created a list of strings and added the name of each assembly document as it was processed. I then checked against this list before processing each assembly incase it had been done before.

C# code below might make more sense (also my previous post here)

 

private void GetLinkedDocument(RevisionManager.LinkedDocuments input, List<RevisionManager.LinkedDocuments> linkedList, List<string> alreadyDone)
        {

            foreach (RevisionManager.Document x in input)
            {
                string ShortName = System.IO.Path.GetFileName(x.FullName);
                linkedList.Add((RevisionManager.LinkedDocuments)x.LinkedDocuments);
                if (System.IO.Path.GetExtension(x.FullName).Contains("asm") && !alreadyDone.Contains(ShortName)) //stops it re-doing assemblies it's already done and never finishing
                {
                    alreadyDone.Add(ShortName); //add already done asms to list
                    GetLinkedDocument((RevisionManager.LinkedDocuments)x.LinkedDocuments, linkedList, alreadyDone);

                }

            }

        }

Re: Revision Manager Occurrences Meaning

Hi @Alex_H I did see your other post on Friday and realised my query too was closely related.

I later gave up on using RM and used the SE Assembly API and the time-consuming process of accessing the occurrences there in.

Thank you so much for the insight !!

 

Best,

Tushar Suradkar