Author Topic: File Dependency Manager  (Read 1480 times)

0 Members and 1 Guest are viewing this topic.

WILL HATCH

  • Bull Frog
  • Posts: 450
File Dependency Manager
« on: January 18, 2013, 12:54:48 PM »
Hi,

I'm trying to find a method for relocating a project folder which contains drawings with many external references.  With some research I've found it is fairly easy to repath DWG references using the xRefGraph, but I'm hitting a bit of a snag on other objects like image, PDF, datalink, OLE.  Looking at the classmap I would have thought that FileDependencyInfo or FileDependencyManager would be of help but the former appears to be full of read only properties (makes sense in hindsight) and the latter is scarcely documented (ARX docs are very short on data).

I can see how I can handle the objects separately... But this seems pretty messy, can anybody point me in the right direction?

Thanks!

Will

Jeff H

  • Needs a day job
  • Posts: 6150
Re: File Dependency Manager
« Reply #1 on: January 18, 2013, 01:36:02 PM »

I seem to remember when looking at it they forgot to expose needed members or whatever but is not correctly implemented to use in .NET, and have to use COM.

http://www.theswamp.org/index.php?topic=43099.msg483152#msg483152




Partially exposing classes are releasing classes that are useless tells me they do not even test them at least once.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: File Dependency Manager
« Reply #2 on: September 10, 2014, 03:11:36 PM »
Looks like pdf's do not show up and have to use FDMCOM in 2013 because they forget to expose "GetEntry Method"
 
All 3 methods seem to return the same collection for all files I tested
FDMCOM using DLR to access COM Library and use AcadApplication.ActiveDocument.FileDependencies
 
The only difference between FDM & FDMWalkTree is FDMWalkTree the last argument passed
Quote
If walkXRefTree is true, the IteratorNext property initializes an iterator that attempts to open the File Dependency List in any xref'd drawings that have a File Dependency List. In this case, the IteratorNext property returns entries from those lists also, recursively down through the entire xref tree. Entries returned from external drawings will have a special index value, always higher than 65536, indicating that they are not local to the current drawing. They will be accessible by that index number until the next save operation.

Seems to not walk very fall.
 
Code - C#: [Select]
  1.  
  2.  [CommandMethod("FDM")]
  3.         public void FDM()
  4.         {
  5.             using (FileDependencyManager fdm = Db.FileDependencyManager)
  6.             {
  7.                 fdm.IteratorInitialize(null, false, false, false);
  8.                 int index = fdm.IteratorNext;
  9.                 Ed.WriteLine(index);
  10.                 while (index > 0)
  11.                 {
  12.                     FileDependencyInfo fdi = fdm.GetEntry(index, true);
  13.                     Ed.WriteLine();
  14.                     Ed.WriteLine(fdi.FileName);
  15.                     Ed.WriteLine("{0} {1}: {2}", "----", "Feature", fdi.Feature);
  16.                     Ed.WriteLine("{0} {1}: {2}", "----", "FileSize", fdi.FileSize);
  17.                     Ed.WriteLine("{0} {1}: {2}", "----", "FingerprintGuid", fdi.FingerprintGuid);
  18.                     Ed.WriteLine("{0} {1}: {2}", "----", "FoundPath", fdi.FoundPath);
  19.                     Ed.WriteLine("{0} {1}: {2}", "----", "FullFileName", fdi.FullFileName);
  20.                     Ed.WriteLine("{0} {1}: {2}", "----", "Index", fdi.Index);
  21.                     Ed.WriteLine("{0} {1}: {2}", "----", "IsAffectsGraphics", fdi.IsAffectsGraphics);
  22.                     Ed.WriteLine("{0} {1}: {2}", "----", "IsModified", fdi.IsModified);
  23.                     Ed.WriteLine("{0} {1}: {2}", "----", "ReferenceCount", fdi.ReferenceCount);
  24.                     Ed.WriteLine("{0} {1}: {2}", "----", "TimeStamp", fdi.TimeStamp);
  25.                     Ed.WriteLine("{0} {1}: {2}", "----", "VersionGuid", fdi.VersionGuid);
  26.                     Ed.WriteLine();
  27.                     index = fdm.IteratorNext;
  28.                     Ed.WriteLine(index);
  29.                 }
  30.             }
  31.         }
  32.         [CommandMethod("FDMWalkTree")]
  33.         public void FDMWalkTree()
  34.         {
  35.             using (FileDependencyManager fdm = Db.FileDependencyManager)
  36.             {
  37.                 fdm.IteratorInitialize(null, false, false, true);
  38.                 int index = fdm.IteratorNext;
  39.                 Ed.WriteLine(index);
  40.                 while (index > 0)
  41.                 {
  42.                     fdm.UpdateEntry(index);
  43.                     FileDependencyInfo fdi = fdm.GetEntry(index, false);
  44.                     Ed.WriteLine();
  45.                     Ed.WriteLine(fdi.FileName);
  46.                     Ed.WriteLine("{0} {1}: {2}", "----", "Feature", fdi.Feature);
  47.                     Ed.WriteLine("{0} {1}: {2}", "----", "FileSize", fdi.FileSize);
  48.                     Ed.WriteLine("{0} {1}: {2}", "----", "FingerprintGuid", fdi.FingerprintGuid);
  49.                     Ed.WriteLine("{0} {1}: {2}", "----", "FoundPath", fdi.FoundPath);
  50.                     Ed.WriteLine("{0} {1}: {2}", "----", "FullFileName", fdi.FullFileName);
  51.                     Ed.WriteLine("{0} {1}: {2}", "----", "Index", fdi.Index);
  52.                     Ed.WriteLine("{0} {1}: {2}", "----", "IsAffectsGraphics", fdi.IsAffectsGraphics);
  53.                     Ed.WriteLine("{0} {1}: {2}", "----", "IsModified", fdi.IsModified);
  54.                     Ed.WriteLine("{0} {1}: {2}", "----", "ReferenceCount", fdi.ReferenceCount);
  55.                     Ed.WriteLine("{0} {1}: {2}", "----", "TimeStamp", fdi.TimeStamp);
  56.                     Ed.WriteLine("{0} {1}: {2}", "----", "VersionGuid", fdi.VersionGuid);
  57.                     Ed.WriteLine();
  58.                     index = fdm.IteratorNext;
  59.                     Ed.WriteLine(index);
  60.                 }
  61.             }
  62.  
  63.         }
  64.        
  65.         [CommandMethod("FDMCOM")]
  66.         public void FDMCOM()
  67.         {
  68.             dynamic acadApp = Application.AcadApplication;
  69.             dynamic acadFileDependencies = acadApp.Application.ActiveDocument.FileDependencies;
  70.             Ed.WriteLine();
  71.             foreach (var fdi in acadFileDependencies)
  72.             {
  73.                
  74.                 Ed.WriteLine((string)fdi.FileName);
  75.                 Ed.WriteLine("{0} {1}: {2}", "----", "Feature", (string)fdi.Feature);
  76.                 Ed.WriteLine("{0} {1}: {2}", "----", "FileSize", (int)fdi.FileSize);
  77.                 Ed.WriteLine("{0} {1}: {2}", "----", "FingerprintGuid", (string)fdi.FingerprintGuid);
  78.                 Ed.WriteLine("{0} {1}: {2}", "----", "FoundPath", (string)fdi.FoundPath);
  79.                 Ed.WriteLine("{0} {1}: {2}", "----", "FullFileName", (string)fdi.FullFileName);
  80.                 Ed.WriteLine("{0} {1}: {2}", "----", "Index", (int)fdi.Index);
  81.                 Ed.WriteLine("{0} {1}: {2}", "----", "AffectsGraphics", (bool)fdi.AffectsGraphics);
  82.                 Ed.WriteLine("{0} {1}: {2}", "----", "IsModified", (bool)fdi.IsModified);
  83.                 Ed.WriteLine("{0} {1}: {2}", "----", "ReferenceCount", (int)fdi.ReferenceCount);
  84.                 Ed.WriteLine("{0} {1}: {2}", "----", "TimeStamp", (int)fdi.TimeStamp);
  85.                 Ed.WriteLine("{0} {1}: {2}", "----", "VersionGUID", (string)fdi.VersionGUID);
  86.                 Ed.WriteLine();
  87.                
  88.             }
  89.          
  90.         }
  91.  
  92.