Renumber element GUIDs

Can Dynamo be used to renumber the GUIDs of elements in Revit? If I find out this is possible, then I can better explain why I’m asking the question.

According to the Revit API documentation, an element’s UniqueId property (which is also not globally unique–but that’s a different conversation) is read-only. The only workaround I can think of is copying an element in-place, which will generate a new UniqueId, but you won’t have any control over any of its characters. I don’t think this would work for connected or routed systems (pipes, cable trays, walls, ducts, etc.) but depending on what you’re actually trying to do, it might be fine.

@cgartland is correct. Element GUIDs are created one time when the object is created. While they may not be globally unique due to files being copied and renamed, the likelihood of a duplicate GUID on objects created in a file is infinitesimally small. Once that file is copied/saved as/distributed GUIDs will match.

Any particular reason you’re after this?

@JacobSmall, sorry for the delay in my response.

The particular reason I was after this was a crazy thought in my head for checking code requirements and manipulating slope in a drainage piping system. I was thinking that if pipes were sequentially numbered, just as they are routed, there could possibly be some benefit for changing a system layout just by exporting data to excel, making some changes and then importing back in.

The more I think about it, I’m not sure it would work in that manner. Thoughts?

From what you are describing, it seems that maintaining the element UniqueIds would be preferable as this allows you to link elements between Excel and Revit. If you do not use the element ids, there is no easy way to link your data between the two platforms. What are you trying to change–pipe diameters? Or are you doing something more complicated than that?

This is doable without having the GUIDs be sequential. Set up a Mark value which is sequential and export that and the guid and your location info/ parameters. You could then update the values in excel using whatever method you were thinking of there, and save the file. Then you can import the excel data, select the elements by GUID, and update the locations accordingly. As with any MEP system, moving things can cause issues with the connections so check carefully.

Alternatively, why not just calculate the locations and update the pipes in Dynamo?

@cgartland, sorry this topic got dropped off my radar for a while, now I’m getting back to it. Here’s what I want to do, but still just not sure if it’s actually possible or not.

I’ve got a drainage system (at the end of the day this could really probably apply to any pipe system classification as long as it has flow parameters) modeled all as the same size pipe thought and flow (gpm) being passed through the entire system.

I export the guide, size, slope, and flow to Excel. From Excel, I’ve created formulas to size each pipe segment based on the modeled flow and slope. This Excel data will get imported back into Revit to update the pipe sizes throughout the system.

The part I can’t seem to wrap my head around is this…in a drainage system, pipe cannot reduce size in the direction of flow (code requirement). So, I’m trying to come up with a method that will check the sizes of all upstream pipes to make sure any particular pipe segment isn’t smaller than a segment upstream (or prior) to it.

I imagine this data being something that can be exported to Excel and used with the current calculations I’ve already set up.

The easiest may be the suggestion by @JacobSmall to add a Mark value. I have to assume this is something that would need to be done manually in Revit before exporting to Excel?

@JacobSmall, can you please expand on what you meant by:


Here’s my take on what i would have done for that particular scenario.

  1. Get all elements in particular MEP system. Since they all all connected to a single MEP system
  2. Get the first element, which is for your case, either the tallest element (assuming it is gravity feed), or you can just mark it in some parameter if it is too complicated
  3. Use the connector manager of the first element to find its connector and check which connector it is connected to. From here you will find your second element.
  4. Repeat step 3 until all element in that particular MEP system is covered, and vola, you will have all the element in sequential order.
  5. In between step 3 & 4, you can add whatever automation or code compliant checker requirements to your code.

By doing so, we wouldnt need to export it to excel at all and thus reducing any potential error across the way

1 Like

What I was after there is that there isn’t a need for excel, as whatever calculations you are doing there can be done in Dynamo just as well. That is an extra step which may not be needed. Worth considering anyway.

1 Like

I know this isn’t necessarily a Dynamo question, but I’m going to ask regardless. I’d like to be able to pass a parameter through the piping system that tracks what the maximum upstream pipe size is. Is this possible?

Yes, this has been discussed a few times. Check the MEPover package, and if you get stuck start a new topic as that topic is unrelated to this thread.

1 Like