Extensible Storage Revit 2021 - error storing data

Hi there,

I’ve been working on using the Extensible storage through Dynamo/Python according to the posts in ths thread: Extensible Storage with dynamo python
Got it to work in Revit 2018, however… now trying to accomplish the same in Revit 2021… Not so much of luck… If I use code below to create a schema and attach it to the project info, somehow the value does not get stored. Schema is created, field is created… but can’t get the value stored…

Code:

# Enable Python support and load DesignScript library
import clr
clr.AddReference('ProtoGeometry')
clr.AddReference('RevitServices')
clr.AddReference('RevitAPI')
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
from System import Guid, String, Boolean, Int16, Int32
from Autodesk.DesignScript.Geometry import *
from Autodesk.Revit.DB import *
from Autodesk.Revit.Attributes import *
from Autodesk.Revit.DB.ExtensibleStorage import *
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
dataEnteringNode = IN

TransactionManager.Instance.ForceCloseTransaction()
elem = UnwrapElement(IN[0][0])
schemaName = IN[1]
acces = UnwrapElement(IN[2])
myGuid = IN[3]
type1 = elem.GetTypeId()
asString = type1.ToString()

schemaBuilder = SchemaBuilder(Guid (myGuid))
schemaBuilder.SetReadAccessLevel(AccessLevel.Public)
schemaBuilder.SetWriteAccessLevel(AccessLevel.Public)
schemaBuilder.SetSchemaName (schemaName)
schemaBuilder.SetVendorId("JaJo")
fbStoredfield1 = schemaBuilder.AddSimpleField("Max_prefab_beton_wall_number", String)
schema = schemaBuilder.Finish()

ent = Entity(schema)
ent.Set ("Max_prefab_beton_wall_number", "Test")

t = Transaction(doc)
t.Start("Create Storage")
elem.SetEntity(Entity(schema))
t.Commit()
TransactionManager.Instance.TransactionTaskDone()


# Assign your output to the OUT variable.
OUT = elem

When I snoop the DB it finds the schema and it shows this massage:
4692c51f898f5030f1d08de7b92fcfd15d10c026_2_690x290

Als if I try to retrieve the value in throug Dynamo Python, there is no value retrieved…

My graph:
test_DS_2021.dyn (27.1 KB)

Can anybody give me a pointer on what’s going wrong? Thanks!

I think this should be setting with “ent” not Entity(schema)

Good example here:

1 Like

Hi SeanP,

Indeed that’s it. Data is stored and can be retrieved now. Thanks!

Just for info: in RevitLookup, when I snoop the Project Info, it still shows the same error message… however, the value is stored and can be retrieved with Dynamo Python. Maybe it’s the version of RevitLookup I’m using… not sure…

1 Like

Great to hear!

It probably has to do with the change in UnitTypes from 20-21. I believe the 2022 version of Lookup has been fixed for this, so you may want to see if you can install that and see if it will give you what your looking for.