Skip to content

Completing Our Plex

We now have

  • Two components
  • A spatial constraint connecting them
  • A temporal constraint syncing them

Completed plex

We now have a complete Plex: a virtual, fully descriptive copy of our system that can be used throughout the Tangram Vision Platform. We're ready to write it out to JSON.

With the Rust API, we can use the PlexBuilder. This processes the components and constraints, validates the data, and constructs the Plex.

In other languages, we will rely on the generated and validated JSON.

let mut builder = PlexBuilder::new();
let plex =;

// Generate our Plex JSON
let json_string = serde_json::to_string(&plex).unwrap();
println!("{}", json_string);
components = [camera_a, camera_b]
creation_timestamp = time.time()
new_plex = plex.Plex(components, creation_timestamp, [spatial_constraint], [
    temporal_constraint], uuid.uuid4())

# Clean the empty and None values out of the final dictionary.
# See in Tangram Vision Basic for example code.
formatted_plex_dict = clean_nones(plex.plex_to_dict(new_plex))

# Generate our Plex JSON
plex_file = open("plexpy.json", "w")
std::vector<tangviz::Component> components{camera_a, camera_b};
double creation_timestamp = time(NULL);
tangviz::Plex plex{
    components, creation_timestamp,

nlohmann::json j;
nlohmann::to_json(j, plex);

// Clean the empty and None values out of the final dictionary.
// See generate_plex.cpp in Tangram Vision Basic for example code.

// Generate the plex file into our build folder
std::ofstream plex_file;"plexcpp.json");
plex_file << j.dump();

Next Steps

There's a lot more to a Plex! Get to know them better, as well as other core concepts in the Tangram Vision Platform, here in the docs.

Core Concepts

If you're eager to start calibrating, don't let us stop you! Check out TVCal.