IronPython ReflectedProperty value

I’m having trouble with the simple code below to get the IsCentral and AllLocalChangesSavedToCentral property from the BasicFileInfo class.

import clr

# Import RevitAPI
from Autodesk.Revit.DB import *

isCentral = BasicFileInfo.IsCentral
changesSaved = BasicFileInfo.AllLocalChangesSavedToCentral

OUT = isCentral , changesSaved

What I’m getting as the OUT is a couple of IronPython ReflectedProperty:


Apparently the boolean value stored in IsCentral and AllLocalChangesSavedToCentral is wrapped by IronPython. Is there a way to unwrap this? If not how should I get the actual value inside the parameter?


What is missing in your code is the use of the class constructor (Extract).
To see how to properly use the BasicFileInfo class (which is for models not currently opened in Revit) have a look at this new node in Clockwork (will be in the next update):


Thanks Anreas, I should’ve read the remarks better. Excuse my ignorance but I find it weird that with some classes you can get the value of the property with a dot and some require separate methods and to be initialized.

I also tried:

doc = DocumentManager.Instance.CurrentDBDocument    
localFilePath = doc.PathName

isCentral = BasicFileInfo.Extract(localFilePath).IsCentral
changesSaved = BasicFileInfo.Extract(localFilePath).AllLocalChangesSavedToCentral

And it seems to be working as I’m getting boolean values (from the current open document).
Although I noticed a very weird behavior:

When I open a local file from central and run the script, the isCentral variable returns true. But when I synchronize and run again isCentral becomes false!

In another instance I’m trying to get the Username and LoginUserId property of the current Revit session.

I’m using the ApplicationServices class, and again I’m getting the same ReflectedProperty. I read the documentation a few times to see if there is something similar to the BasicFileInfo.Extract() method. But there’s nothing in ApplicationServices class.

When I didn’t get the results I wanted, I tried the Username property in the BasicFileInfo class. However that one strangely returns nothing.

In the Revit session I am testing the code on, there is a username specified but the user is not logged in to the Autodesk ID.


Here’s the code and the result:

import clr
from Autodesk.Revit.DB import *
from Autodesk.Revit.ApplicationServices import *

# Import DocumentManager
import RevitServices
from RevitServices.Persistence import DocumentManager

userName1 = Application.Username
loginUser = Application.LoginUserId

doc = DocumentManager.Instance.CurrentDBDocument
userName2 = BasicFileInfo.Extract(doc.PathName).Username

OUT = userName1 , loginUser , userName2


Any suggestion what I am doing wrong? :face_with_raised_eyebrow: