Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cadcamfun.xyz/llms.txt

Use this file to discover all available pages before exploring further.

API Extensions System

Welcome to the API Extensions documentation for the CAD/CAM application. This system allows third-party developers to create plugins that extend the application’s capabilities, particularly for generating CAD models from text descriptions using AI.

Overview

The API Extensions system provides a framework for developing, installing, and using extensions that integrate with the application’s core functionality. Extensions can be used to add new features, enhance existing capabilities, or provide integrations with other tools and services.

Key Features

  • Text-to-CAD Generation: Convert natural language descriptions into 3D CAD models
  • Extensible Architecture: Add custom model generators, modifiers, and exporters
  • Security and Access Control: Built-in authentication and permission management
  • Easy Integration: Simple API for incorporating the extension system into your projects

System Architecture

The API Extensions system consists of several core components:
  1. API Gateway: Routes and validates incoming requests, handles authentication, and manages responses
  2. Extension Manager: Manages extension lifecycle, including registration, execution, and uninstallation
  3. Extension Registry: Maintains a catalog of available extensions and their capabilities
  4. Extension Loader: Handles loading extensions from files and validating their structure
  5. Text Processor: Analyzes natural language descriptions and extracts structured information
  6. Model Generator: Creates CAD models based on processed text descriptions
  7. File Exporter: Converts CAD models into various file formats (STL, OBJ, STEP, etc.)

Extension Types

The system supports the following types of extensions:
  • CAD Generators: Create 3D models from processed text or other inputs
  • Model Modifiers: Modify existing 3D models (add features, transform, etc.)
  • Exporters: Export models to specific file formats or platforms

Getting Started

To start using or developing extensions, see the following guides:

Example Usage

Here’s a simple example of using the Text-to-CAD API with a custom extension:
import { initializeApiExtensions } from 'api-extensions';

// Initialize the API Extensions system
const { apiGateway, extensionManager } = await initializeApiExtensions();

// Generate a CAD model from text
const result = await extensionManager.handleCadGenerationRequest({
  textDescription: 'Create a cylindrical container with a diameter of 10cm and height of 15cm',
  format: 'stl',
  options: {
    resolution: 'high',
    units: 'mm'
  }
}, user);

// Use the resulting model
console.log(`Generated model: ${result.model.id}`);
console.log(`File format: ${result.model.format}`);
// The base64-encoded file data is in result.file.data