Code number of Revit file

In Revit, has a code number of the Revit file? this number will be automatically changed when it’s detached or copied into new Revit file.

Do you mean the Element ID?

1 Like

It can be a value of such parameter, but most of element ID will be no change when the Revit file is detached or copied into new one

You could compare data from either the basic file info class or the transmission data class, and store a GUID in the notes section of the transmission data class, an external file, or some other location. If the file is a central file (I basic file info lists this) and the location aligns to the last central location, leave the GUID as is, if they mis-match than make a new GUID.

These classes are a bit odd to work with at first, but they have a big advantage in that Revit doesn’t have to open the model all the way to use them (not in the UI nor in the background) so you can very quickly iterate over a list of files of multiple versions.

Why do you want to do this?

1 Like

Thanks for your sharing, but unlucky it’s not my case.
It’s not an id of a project, It’s an id of revit file. That means I don’t need to track the change of revit file. If user detach their revit file into a new one that becomes independent, its code needs to be changed

You’d have to run the script every time you open a file just to confirm, but you could duplicate the model path and then compare to the actual file path opened. This would work for non-worksharing models on its own. A workshared model would have to be compared against the central model path instead, but would work the same way.

1 Like

Detaching and saving a model is a very intentional task. Just have your users update a project information field during that process I’d say, or use a Dynamo script to increase the value by 1. Prefix this ID with something unique like a company project number.

As you can see people are struggling to help you as it seems there isn’t a system designed here as of yet (we have no screenshots to assist us understanding). We’re not even sure what this Id is being used for.

2 Likes

This was pretty much what I was attempting to solve. Where you store that GUID isn’t known, but personally I would use the notes section of the transmission data class. Map that to the expected file path (can be saved to the same location or in an external DB) and you will be able to find tie the two together. You could even pull the document version and log that periodically, as any time that value decreases you’re dealing with a new document compared to what is in the DB.

2 Likes