A nice mix of topics for today:
Hernan Echevarria shared some valuable experience on working with Revit Server in the Revit API discussion forum thread on how to invoke the Revit Server base interface:
Question: The SDK provides limited information about Revit Server.
I want to call the base interface methods, like download
... can you provide an example?
Answer: Maybe some of these can help:
Response: Thanks for your solution, your answer helped me a lot; after reading these articles, I still have a question: after getting the Revit Server file path, how do I open the file by Revit API?
Answer: I created several add-ins to manage Revit Server files. One of them is to batch export Navisworks files from the Revit Server and the other one for exporting Revit files.
I didn't use the Revit Server API. You can use normal Revit and Windows methods to manage the paths and open the files.
You can access the Revit Server project through Windows File Explorer. If you don't know the path, ask your IT department. You will probably need permission to access these folders.
In this image, you can see what it looks like (blurred bits for confidentiality):
Note that each Revit file is represented by a folder, which ends in ".rvt"!
This is not the actual rvt
file.
However, if you get the path of one of these folders, you can use it to open the model.
Response: I read all the Revit Server articles above and I have a general understanding of how Revit Server works.
As described above, I can get the Revit Server RVT
file through Windows File Explorer.
For example, on a Revit Server "172.18.1.32", save a central file at "testfolder\1.rvt".
Now I can open the file in two ways; first:
doc.OpenFile( @"RSN://172.18.1.32/testfolder/1.rvt" )
Second:
Application.CopyModel
After modifying the file, I want to synchronise with the central file.
Will I get a different result depending on which of the two way used to open the file?
Response: I copy the folder from Revit Server to local, but I don't know how to open the .rvt
project though the folder and sub file:
Answer: In Revit, you need to open the highlighted folder:
You need to pass Revit the path to that folder, not to what is inside!
So, for example, assume you have the path Autodesk/Revit Server 2021/Projects/FOLDER.rvt.
Just pass that path to the Revit API. I know it is weird, because it is a folder and not a Revit file!!
But this is how it works.
Also, you will need to transform the path to a Revit Server path.
So, given this path:
I need to transform it to:
Note that I also changed slash /
to backslash \
.
Many thanks to Hernan for his experience and friendly guidance!
A nice suggestion by Francisco franpossetto Possetto on how to simply and efficiently communicate a problem to the user by highlighting element graphics instead of issuing a warning, from the Revit API discussion forum thread asking did you fill the parameter value or is it still blank?
Question: Prior to every synchronization, we have to check whether a specific parameter was filled in or not. If not, is there a way to remind user about it?
Answer: The Revit API provides numerous events that you can subscribe to in order to be notified before a command is executed or certain operations take place. I am confident that you can find a suitable event that you can use to analyse the model and the element properties to check whether all required information has been entered and cancel the command execution otherwise. For instance, in a DocumentSaving event handler, called before the document is saved, you could retrieve all the elements of interest, check that the required value has been set, and cancel the save operation if that is not the case.
Alternatively: I solved a similar requirement before without using the Revit API. I created a filter that paints elements if a certain parameter value is blank. That way, the users know whether they have to add the value or not. I think you could use this strategy, for instance. It worked for us; maybe you could consider it as an alternative.
I occasionally wish to archive some email text before Outlook does unexpected things with it, such as deleting it without warning.
I found little guidance on achieving this in a simple way without implementing macros or installing addition utility software, so I found my own simple and effective manual solution:
Example:
View Source