Cannot find Data within the Base in Specklepy

I’m trying to find certain parameters (volume, material) in the sent revit objects and then do some calculations and then send it back as a new parameter field. But I’m being stumped by the first step…

I was following the tutorial here for getting the information: Tutorial: Simple Dashboard | Speckle Docs

But I’m only getting the Base object of type Objects.Organization.Model and there’s no [‘data’] attached to it.

I was able to find it after running get_dynamic_member_names.

Is there a bettery way to access the data? How did you manage to get it in JSON format? @izzylys

Thanks!!

1 Like

Hi @shuzmm,

Welcome to the community! Feel free to Introduce yourself :person_gesturing_ok: to the community if you want to!:grinning:

We have another tutorial on accessing Revit data. Can you take a look at that and see if it helps.

I am not a Python expert but afaik, you can use BaseObjectSerializer, if you want to serialize your base object into a JSON string. This returns a tuple containing the object id of the base object and the serialized object string.

Let us know if it helps.:rose:

from specklepy.serialization.base_object_serializer import BaseObjectSerializer

serializer = BaseObjectSerializer()
serializer.write_json(your_base_object)

Ah this tutorial is exactly what I was looking for!
Thanks!

1 Like