Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with Library / Template (aka, Reconcile to/from Library/Templates) #2486

Closed
svalenziano opened this issue Dec 20, 2024 · 4 comments
Closed
Labels
New Feature New feature request [class->Implemented #{number}: {title}]

Comments

@svalenziano
Copy link

svalenziano commented Dec 20, 2024

Is your feature request related to a problem? Please describe

You update an .rfa loadable-family in one .rvt file and save it to the Family Library (perhaps stored in Google Drive). It's now up-to-date in your .rvt file and the library, but it's out-of-date in all of the other .rvt files. How do you update the family in each of those revit files?

Also, how do you avoid saving over a family in your library if it has been modified recently by another user, creating a sync conflict?

In a perfect world, every Revit project would start out with a fully-formed template. All families would be fully fleshed out, with no need for modification. As we know, it's not a perfect world, and reality often demands that we make improvements to our methods while a project is being designed.

Perhaps there's an existing solution using Pyrevit, or another tool?

Describe the solution you'd like

I'm considering writing a Pyrevit extension that would solve this problem, if it's not a dumb idea, and if there's not already a good solution to this problem. I would also be happy to collaborate on such a project. Here's a sketch of what such a solution would look like:

Press the 'Sync with Family Library' button. The following things happen:

  • Sync from library: Load newer families from Library
  • Sync to library: Save families to library if the loadable family within the .rvt is newer than the family in the Library

Provide useful information to user: display warning and refer user to logs if any anomalies occur. Logs include:

  • Display list of sync conflicts, if they exist
  • Display list of successful syncs: to the library and from the library
  • Display list of errors, if any were encountered & excepted

Behind the scenes, PyRevit's "Extension Hooks" can probably be utilized to auto-save the last-modified date as a Parameter within the file to sidestep the hazard posed by Google Drive's (and other filesystems) unreliability regarding last-modified timestamps (see forum post for example).

Describe alternatives you've considered

Additional context

Here's a diagram describing the problem in further detail:

Screenshot 2024-12-20 100626

@svalenziano svalenziano added the New Feature New feature request [class->Implemented #{number}: {title}] label Dec 20, 2024
@sanzoghenzo
Copy link
Contributor

Hi @svalenziano,

I'm offering my personal point of view, that doesn't necessarily coincide with pyRevit team's.

File based "libraries" are a PITA to manage, if you want some robustness it's better to have a layer on top of the filesystem that manages metadata and versioning.
As a bare minimum, there should be a (REST API) server with endpoints to upload, download and update a family, and a database (could be as simple as a SQLite .db file) to hold the information about the families: file path on the server, name, description, and so on. by leveraging a relational database, you can have a table with the basic info of the families, and another table which holds the versions: version number, date uploaded, who did the changes, path on the server of that specific version.
Note that the clients (Revit) won't directly access the paths on the server, but requests the family info via the API, and if there's a new version it can ask for the download.
The next step would be to make a notification system that sends a "family updated" message to the clients that use that family.

I hope you understand that this is not that simple, and pyRevit teams is really undersized for even thinking about implementing something like this, which is largely out of scope.

By the way, pyRevit Extension Hooks are nothing more that a wrapper around the Revit Application events, so they can be used by the hypothetical clients mentioned earlier directly in c# without having to depend on this project.

@svalenziano
Copy link
Author

@sanzoghenzo , thanks a lot for your thoughts! Your proposed database-based system definitely sounds robust, but could you elaborate on the downfalls that you forsee with a file-based system? Below are the pros and cons that I could think of, although I'm sure I'm missing some key points....

Upsides of file-based library

  • Simple (at least in theory): no server/database to setup & maintain, file transfer is already solved

Downsides of File-based library

  • Potential problems due to simultaneous access
  • Potentially very slow if each file must be opened to read the 'last-synced', 'last-modified', or other properties. Must use workarounds like sidecar files or metadata writing via a library like pywin32.

Existing solutions
Do you know of any existing solutions to this problem? It seems like a really annoying problem that someone would have solved already?

@sanzoghenzo
Copy link
Contributor

a file-based library biggest downside is the vulnerability to... file-based operations: renaming or moving the files would break everything, if you rely on folder structures and file names for the system to work.

And since we're talking about a shared environment, every head thinks differently and wants to organize things as they see fit;
If they can, they will have an hard time finding things, and will eventually abandon the system in favor of local copies.

Finally, if you want to rely on a cloud drive, you could get any kind of problems with its sync process.

Unfortunately I don't know of any solution for this, I recall my colleagues tried some services a long time ago, but I can't remember what it was (and it probably doesn't exist anymore).

@svalenziano
Copy link
Author

@sanzoghenzo that all makes sense; those are some real issues that I hadn't considered.

We're considering implementing the solution at a small firm, so perhaps some of the issues would be less acute, but I can definitely see how a database + API would be a much better solution.

I will probably drop this for now, but may revisit in the future. Thank you for your time and expertise!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Feature New feature request [class->Implemented #{number}: {title}]
Projects
None yet
Development

No branches or pull requests

2 participants