File path of central file

revit

#1

Is there a node that is able to retrieve the file path of the central file when running dynamo in a local user file? I can’t seem to find one.

Edit: I’m really new to Python but my script doesn’t seem to work. How do I use the Revit API properly in this case? ( http://revitapisearch.com/html/7b646d50-585e-1c52-54f5-5b2eddc546a9.htm ) How should I use the get argument?


#2

@Holthuis,

First of all please post code not an image of code. This forum supports code formatting very well.

Here’s how:

To get the basic file info you actually have to extract it from a file. There is a static method for that where you feed the file path of the document that you need the info about. In this case its your current open document since you are in Dynamo. To do that just call doc.PathName and then you are good to go.

you were also missing references to things like Revit API and Revit Services which are wrapper classes for Document object for working with Revit docuements in Dynamo.

Here’s a full code:

# Import RevitAPI
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

#Assign your output to the OUT variable.
OUT = BasicFileInfo.Extract(doc.PathName).CentralPath

#3

This also seems to work…

# Import RevitAPI
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import ModelPathUtils

# Import DocumentManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument
cen = doc.GetWorksharingCentralModelPath()

OUT = ModelPathUtils.ConvertModelPathToUserVisiblePath(cen)

Reference: Comments on this page …


#4

Thanks a lot! Both seem to work!


#5

Sorry for post ing to an old thread, but I’m just wondering why this isn’t a Core Revit node?
Seems like this kind of thing would be needed a lot.


#6

Reopening this thread on central file locations:

Curious if I can pick your brain for a technique to query the central file locations of linked models in our Revit base file. I am not interested in the saved file location under the manage links tab, but rather the deep seated central location the files looks to sync to.

Just a bit of background, improperly linked files (files that are copy pasted, and not e transmitted) cause performance issues that are tricky to troubleshoot. In a model with 40 links, it can be difficult to identify which ones have been disassociated from a consultants server.

Any help would be greatly appreciated!

Beno


#7

You probably want to start a new thread. This is a pretty old question and it’s hard to expect someone to answer a new question while this one already has an answer.


#8