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:
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!