GUID from Revit

Hello,

Im trying to get the GUID from my Revit model using Dynamo. I keep getting the error “No module named Element”. Can someone guide me in the right direction?

Im still very new to Dynamo/Python, so bear with me :wink:

import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
from Elements import Guid
inputlist = IN[0]
uuidlist = list()
uuidstrs = list()
for i in inputlist:
temp = Guid.NewGrid()
asString = temp.ToString()
uuidlist.append(temp)
uuidstrs.append(asString)

OUT = uuidlist, uuidstrs

Thx!

If you want to get the Id or the UniqueId - there are OOTB nodes for that. If you’re looking for the IfcGUID that is (optionally) stored during IFC export (or always when linking/importing an IFC), you can do that by querying that parameter (also with an OOTB node). I really don’t see a need for using Python.

2 Likes

Hi @DennisNordliHansen

Here is how you get GUID’s using OOTB node.

2 Likes

had prepered a solution… but @Andreas_Dieckmann and @Kulkul was faster than me :slight_smile:
It is very simple as they both write/show, my solution would be the exactly same

1 Like

It works!

That was pretty simple. I was using Python because i found some former topics, where this method was used. Im still learning :wink:

Thanks!

By the way: Keep in mind that UniqueId is not a GUID, it is only ever really unique on a per-file-basis. See this discussion for more info:
https://forums.autodesk.com/t5/revit-api-forum/understanding-the-use-of-the-uniqueid/td-p/5474167

2 Likes