What You’ll Learn
By the end of this guide, you’ll understand:- ✅ How to create and structure
Baseobjects - ✅ The difference between direct attributes and the properties dictionary
- ✅ How to access and discover object properties
- ✅ How to work with lists and collections
Prerequisites
Before starting this guide, you should:- Have specklepy installed
- Understand basic Python (classes, lists, dictionaries)
- Be familiar with the quickstart
This guide focuses on working with objects - not sending/receiving them. For send/receive
operations, see the Quickstart.
How do I create a Speckle object?
You need to create custom data structures or add metadata to geometry for your Speckle project. Use theBase class - it’s the foundation of all Speckle objects and supports dynamic properties:
Base objects are Python classes that accept any property name dynamically (no predefined schema needed), serialize automatically for Speckle, support nesting (objects within objects), and work with Python’s native attribute access.
When to create Base objects:
- Building custom data structures (surveys, analysis results, schedules)
- Grouping related objects together
- Adding application-specific metadata
How do I add metadata: direct attributes vs. properties dictionary?
You need to attach metadata to objects, but you’re unsure whether to use direct attributes (obj.name) or the properties dictionary (obj.properties["name"]).
Use direct attributes for structure and organization:
obj.name) are part of your object’s structure, provide Python-level property access, and are good for relationships and hierarchies like obj.levels, obj.elements, obj.children.
Properties dictionary (obj.properties) is a standardized metadata container, follows BIM connector conventions, makes data searchable across applications, and commonly uses keys like category, family, type, material.
Which to use? Both are valid Speckle patterns! The
properties dictionary is a convention
that makes metadata more discoverable. If Revit sends a wall, its category will be in
properties["category"] - following this pattern makes your data easier to work with across
platforms.How do I access object properties?
You have a Speckle object and need to read its properties, but you don’t know what properties it has or how to access them safely. For direct attributes:get_member_names() to discover what properties an object has:
What does get_member_names() return?
What does get_member_names() return?
get_member_names() returns all property names on the object, automatically filtering out:- Private members (starting with
_) - Methods and functions
- Class attributes
if not name.startswith("_") - it’s already filtered!How do I work with lists and collections?
You need to work with multiple objects - filtering them, counting them, or processing them in bulk. Looping through lists:elements arrays for hierarchical structures:
Terminology Note: Examples here use terms like “building”, “level”, “room” to illustrate
hierarchical concepts. Real BIM data from connectors (Revit, Rhino, etc.) uses proxy
structures rather than direct nesting - for example, Revit levels are
LevelProxy objects that
reference elements by ID. See Proxification and
BIM Data Patterns for actual BIM structures.Practical Examples
Example 1: Create a Survey Point Collection
Example 2: Filter and Summarize Objects
Example 3: Build a Hierarchy
Learn More
Core Concepts:- Objects & Base Class - Deep dive into Base and object system
- Data Types - Understanding Speckle’s type system
- Simple Data Patterns - More examples of custom data structures
- Intermediate: Finding and Extracting Data - Learn to traverse and filter nested structures
- Base class methods - Complete Base API documentation
Next Steps
Now that you understand how to work with Speckle objects, you’re ready to:- Learn traversal - Navigate nested object structures recursively
- Extract data - Filter and find specific objects in complex hierarchies
- Work with geometry - Extract and manipulate displayValue meshes from BIM objects