BasicFileInfo IsCreatedLocal property outputting unexpected value

BasicFileInfo IsCreatedLocal property outputting unexpected value

thomas
Advocate Advocate
2,157 Views
11 Replies
Message 1 of 12

BasicFileInfo IsCreatedLocal property outputting unexpected value

thomas
Advocate
Advocate

I am attempting to ascertain if the active document is a local copy or the central model. I have used the BasicFileInfo IsCreatedLocal and IsLocal properties on a local copy of a central model and both return false? If I extract the IsCentral property I get true when I would expect false. I have done some simple checks, like checking the Document.PathName against the BasicFileInfo CentralPath property and both outputs are correct. As a workaround I can simply test both addresses for equality but I want to know what is causing this unusual behaviour?

 

 

bool docIsLocal;

try
{
    docIsLocal = BasicFileInfo.Extract(doc.PathName).IsLocal;
}
catch (Autodesk.Revit.Exceptions.FileArgumentNotFoundException)
{
    docIsLocal = false; 
}

 

 

This was tested in Revit 2016, and Dynamo (using Python) 1.3 

Accepted solutions (1)
2,158 Views
11 Replies
Replies (11)
Message 2 of 12

jeremytammik
Autodesk
Autodesk

Dear Thomas,

 

Thank you for your report.

 

Yes, this sounds like an issue that the development team should take a look at.

 

Can you please provide a minimal reproducible case for them to analyse?

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

Remember, they do not have access to an add-in development environment, so it is easier for them if you can provide a macro that demonstrates the

problem.

 

Thank you!

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 12

thomas
Advocate
Advocate

Hi Jeremy 

 

Thanks for your reply. Please find below a simple macro which reports the IsLocal, IsCreatedLocal, IsCentral properties from the BasicFileInfo class which demonstrates the problem.

 

Regards

 

Tom 

 

/*
 * Created by SharpDevelop.
 * User: Thomas
 * Date: 28/05/2017
 * Time: 14:37
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using System.Collections.Generic;
using System.Linq;

namespace WorkSharedDocumentStatus
{
    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
    [Autodesk.Revit.DB.Macros.AddInId("590D0F74-A5D6-449F-B101-8A2501A7083A")]
	public partial class ThisDocument
	{
		private void Module_Startup(object sender, EventArgs e)
		{

		}

		private void Module_Shutdown(object sender, EventArgs e)
		{

		}

		#region Revit Macros generated code
		private void InternalStartup()
		{
			this.Startup += new System.EventHandler(Module_Startup);
			this.Shutdown += new System.EventHandler(Module_Shutdown);
		}
		#endregion
		
		public void WorksharedProperties()
		{
			Document doc = Application.ActiveUIDocument.Document;
			string docPath = doc.PathName;
			
			try {
				bool docIsLocal = BasicFileInfo.Extract(docPath).IsLocal;
				bool docIsCreatedLocal = BasicFileInfo.Extract(docPath).IsCreatedLocal;
				bool docIsCentral = BasicFileInfo.Extract(docPath).IsCentral;
				
				string centralPath = BasicFileInfo.Extract(docPath).CentralPath;
				bool pathsMatch = docPath == centralPath;
				
				TaskDialog td = new TaskDialog("Bimorph")
	            {
	                Title = "Results",
	                MainContent = "IsLocal Property result : " + docIsLocal.ToString() + 
	                	"\nIsCreatedLocal Property result : " + docIsCreatedLocal.ToString() +
	                	"\nIsCentral Property result : " + docIsCentral.ToString() +
	                	"\nCentral path == active doc path result : " + pathsMatch.ToString()
	            };
	            td.Show();
			} 
			catch (Exception) {
				
				TaskDialog td = new TaskDialog("Bimorph")
	            {
	                Title = "Results",
	                MainContent = "This is not a workshared file"
	            };
	            td.Show();
			}
			
		}
	}
}
0 Likes
Message 4 of 12

jeremytammik
Autodesk
Autodesk

Dear Tom,

 

Thank you for your update and macro code.

 

I logged the issue REVIT-114470 [unexpected value of BasicFileInfo IsCreatedLocal property -- 13022634] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.

 

This issue is important to me. What can I do to help?

 

This issue needs to be assessed by our engineering team, and prioritised against all other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:

 

  • Impact on your application and/or your development.
  • The number of users affected.
  • The potential revenue impact to you.
  • The potential revenue impact to Autodesk.
  • Realistic timescale over which a fix would help you.
  • In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.

 

This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 12

thomas
Advocate
Advocate

Thanks Jeremy

 

I've attempted to find the case via my Autodesk support portal to send further information but couldn't locate it. I have been sent a case number however it states the case is closed!

 

Regards

 

Tom 

0 Likes
Message 6 of 12

jeremytammik
Autodesk
Autodesk

Dear Tom,

 

Thank you for your appreciation; my pleasure 🙂

 

The ADN case 13022634 [BasicFileInfo IsCreatedLocal property outputting unexpected value] was closed because the change request is in place in the development database.

 

Whether the ADN case is open or closed makes no difference whatsoever as long as we are aware of its existence and case number.

 

Afaik, you can reopen, update and add any new information you wish to it at any time you like regardless.

 

Were you unable to access it? Or unable to open it?

 

You can also submit your additional information here, if it is not confidential.

 

The status of this ADN case in no way affects the internal development issue REVIT-114470 [unexpected value of BasicFileInfo IsCreatedLocal property -- 13022634].

 

The development team only care about the latter. I have not had any feedback from them on it yet, though.

 

Somebody on the team has to notice whatever you add to the ADN case and manually forward that to the development issue.

 

Cheers,

 

Jeremy

 

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 7 of 12

thomas
Advocate
Advocate

Hi Jeremy 

 

I was unable to find it using the support requests search tool? Nevertheless, I can provide the information requested here:

 

Impact on your application and/or your development

Minor since I can use a workaround using the addresses and so far have only needed to call methods/properties from the problem class in about 2% of my work.

 

The number of users affected 

Dev side 1

Client side 500

(on the assumption the workaround fails to perform as required)

 

The potential revenue impact to you

Negligible (on the assumption the workaround fails to perform as required)

 

Realistic timescale over which a fix would help you

1-2 months

 

Thanks once again for your quick response/resolution, its appreciated.

 

Tom

0 Likes
Message 8 of 12

jeremytammik
Autodesk
Autodesk

Dear Tom,

Thank you for your update, appreciation and business case.

 

I added it to the internal development issue REVIT-114470 [unexpected value of BasicFileInfo IsCreatedLocal property -- 13022634] to make the development team aware of its importance.

Cheers,

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 9 of 12

Anonymous
Not applicable

Hey hey,

 

I ran into the same problem. Whenever I create a new local copy, the IsCentral returns true and IsLocal false. However, I also noticed after synchronizing for the first time, the problem goes away. 

 

I feel like this might be the same issue where one creates a fresh local file and close out without synchronizing. The next time that local file gets opened directly, a message will pop up saying "This central file has been copied or moved from... If you want this file to remain a central model, resave the file as a central model".

 

Tom, I also tried to have a work around by comparing the file paths. However, if the central file lives on a network drive,  the BasicFileInfo.Extract().CentralPath returns the UNC address of the file (\\Server\Folder\SubFolder\file.rvt) and the doc.PathName returns the path with the mapped drive letter (D:\Subfolder\file.rvt) Do you know a way of converting between the two?

 

Thanks,

HT

0 Likes
Message 10 of 12

dantartaglia8696
Advocate
Advocate

I sometimes have to recreate the central model to resolve this issue.

0 Likes
Message 11 of 12

jeremytammik
Autodesk
Autodesk
Accepted solution

Hi guys,

 

Awfully sorry about all the hoo-ha and confusion about this issue.

 

I heard back from the development team on the case REVIT-116425 [unexpected value of BasicFileInfo IsCreatedLocal property -- 13022634], which they closed as 'by design'. They say:

 

`IsCreatedLocal` is currently used in the Revit Server workflow.

 

If a local model is created by the `RevitServerTool` command line tool, the `IsCreatedLocal` property in `BasicFileInfo` is true.

 

The properties `IsCreatedLocal` and `IsLocal` are mutually exclusive -- when `IsCreatedLocal` is true, `IsLocal` is actually false.

 

To safely determine whether a model is local, API users can use the following:

 

  IsCreatedLocal || IsLocal 

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 12 of 12

thomas
Advocate
Advocate

Thanks for confirming Jeremy, that's good to know

0 Likes