Skip to content

Snaptrude API Reference

The Snaptrude Public API (snaptrude) provides a structured way to interact with the Snaptrude model, perform geometric operations, and manage project data.

Namespaces

The API is organized into the following top-level namespaces:

  • Entity: Types and functions to find BIM entities.
  • Tools: Tools to modify and interact with the model (Selection, Transform, etc.).
  • Project: Access project-level settings (Units).
  • Query: Query geometric information.
  • Core: Fundamental data structures (Math, Geometry).

Usage Example

typescript
import snaptrude from "snaptrude";

// Get selected components
const selection = snaptrude.tools.selection.get();

if (selection.length > 0) {
  // Move them by 10 units in X
  const displacement = new snaptrude.core.math.Vector3(10, 0, 0);
  snaptrude.tools.transform.move(selection, displacement);
}