0

i get the revit element's reference files, and then i want to convert the reference file absolute path to relative path.How to convert? ths! The code as follow:

Uri uriRoot = new Uri(AnaysisResultRootFolder);

foreach (ElementId elementId in elementIds)
{
    ExternalFileReference externalFileReference = 
      transmissionData.GetLastSavedReferenceData(elementId);
    ExternalFileReferenceType fileReferenceType = 
      externalFileReference.ExternalFileReferenceType;

    if (fileReferenceType == ExternalFileReferenceType.RevitLink)
    {
        ModelPath referenceModelPath = externalFileReference.GetAbsolutePath();
        //d:\doc\sub1.rvt
        string referenceFilePath = ModelPathUtils.ConvertModelPathToUserVisiblePath(
          referenceModelPath); 
        string relativeFilePath = "../Reference/sub1.rvt";
    }
}

I don't know how to convert "d:\doc\reference\sub1.rvt" to "./reference/sub1.rvt"

skeletank
  • 2,880
  • 5
  • 43
  • 75
Jason Lee
  • 77
  • 7

1 Answers1

0

Its called RELATIVE !so you should know the relation between Your current Location and You desired Location!

Mehdi Nourollah
  • 166
  • 1
  • 11