# Schemas

**URL:** <https://forum.dynamobim.com/t/schemas/100946>\
**Category:** Developers\
**Created:** [May 13, 2024, 11:19am UTC](https://forum.dynamobim.com/t/schemas/100946 "2024-05-13T11:19:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [May 13, 2024, 11:19am UTC](https://forum.dynamobim.com/t/schemas/100946/1 "2024-05-13T11:19:15Z")

</div>

I have created my very first schema in Python. 🐍

No idea how to use it yet… but I created it.

@jacob.small Thanks for the suggestion. 😃

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/a/fa91c6d0316a9b5390bb397a28ce0c368a315262.png)

```auto
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitServices')
clr.AddReference('RevitAPIUI')

from Autodesk.Revit.DB import *
from Autodesk.Revit.UI.Selection import ObjectType
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
import System

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

TransactionManager.Instance.EnsureInTransaction(doc)

wallRef = uidoc.Selection.PickObject(ObjectType.Element, "Select a wall")
wall = doc.GetElement(wallRef.ElementId)

schemaId = System.Guid("USE YOUR OWN GUID :dragon_face:")
schema = ExtensibleStorage.Schema.Lookup(schemaId)

if schema is None:
    builder = ExtensibleStorage.SchemaBuilder(schemaId)
    builder.SetReadAccessLevel(ExtensibleStorage.AccessLevel.Public)
    builder.SetWriteAccessLevel(ExtensibleStorage.AccessLevel.Public)
    builder.SetSchemaName("VeryFirstAttemptAtThis")
    builder.SetDocumentation("Data store for my very first attempt")
    schema = builder.Finish()
    output = "Schema created successfully."
else:
    output = "Schema already exists."
        
TransactionManager.Instance.TransactionTaskDone()
OUT = output, "moose!"

```

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/9/897d59d8bac5ac4b05a4c75ccfb072b4f2dec7b3.png)

Test after creation

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 13, 2024, 11:54am UTC](https://forum.dynamobim.com/t/schemas/100946/2 "2024-05-13T11:54:30Z")

</div>

@Alien ,

what does it mean you can create your own unique identity for your elements ?

KR

Andreas

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [May 13, 2024, 12:10pm UTC](https://forum.dynamobim.com/t/schemas/100946/3 "2024-05-13T12:10:36Z")

</div>

Storage in Revit…  
So you can store a load of data that you can allow the user to change… or you can make it so only your app can change it.

I’m currently wading through this and trying to put it into Python  
[https://adndevblog.typepad.com/aec/2012/07/a-beginners-overview-to-extensible-storage-api.html](https://adndevblog.typepad.com/aec/2012/07/a-beginners-overview-to-extensible-storage-api.html)

So far I’ve made the Schema and added a field builder. 🤪

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 13, 2024, 1:01pm UTC](https://forum.dynamobim.com/t/schemas/100946/4 "2024-05-13T13:01:30Z")

</div>

@Alien ,

is this similar to [https://directus.io/](https://directus.io/) ?

where you can monitor your projects regarding data ?

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [May 13, 2024, 1:04pm UTC](https://forum.dynamobim.com/t/schemas/100946/5 "2024-05-13T13:04:37Z")

</div>

Don’t think so…  
Extensible Storage is storage IN your Revit model.

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 13, 2024, 1:10pm UTC](https://forum.dynamobim.com/t/schemas/100946/6 "2024-05-13T13:10:16Z")

</div>

@Alien ,

i have to see practical use 😉 the article is more than 12 years old… 🙂

ok like metadata thats not visible in the “forground”

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [May 13, 2024, 1:18pm UTC](https://forum.dynamobim.com/t/schemas/100946/7 "2024-05-13T13:18:23Z")

</div>

Well for me I wanna store loads of data that my users can’t delete;  
“I deleted it cos I dunno what it is”…  
🤣

Also @Draxl_Andreas it’s been in Revit for a decade and you’ve never heard of it… (neither had I)

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [May 13, 2024, 1:36pm UTC](https://forum.dynamobim.com/t/schemas/100946/8 "2024-05-13T13:36:01Z")

</div>

> [@Draxl\_Andreas](#):
>
> the article is more than 12 years old… 🙂

But still as relevant as ever. 😉

Basically extensible storage allows you to put data that doesn’t comply to a typical Revit data type into your model, and work with it as you might need. Two examples:

1. Imagine you wanted to pack the path of travel produced via VASA to go from Room A on level 3 to Room B on level 1; currently Revit has no default way to store that data, as there is no such thing as a 3d polyline of unknown definition, nor can we make points in a standard environment. But extensible storage allows us to define a schema which packs the point locations into the model. An add-in can then access the data to display a spline in 3D between the points and generate the graphic in your plan/section/whatnot as desired.

2. Imagine you have to do the plumbing fixture count for a mixed use occupancy in the city of Boston, Massachusetts. You could go and update a key schedule and build out the nightmare list of formulas, or you could pack the formaulas and lookup tables into extensible storage via an add-in, and then use another module of the add-in to calculate the value(s).

The scope of what you can put in here is only limited by what can be serialized into code - I have packed images, .rfa files, .dyn files, and even .exe files in there before.
