What Libraries Are Included in the `packages/` Directory of text-to-cad
The packages/ directory in the earthtojake/text-to-cad repository contains three modular libraries—cadpy (Python), cadjs (TypeScript), and implicitjs (TypeScript)—which depend on build123d, cadquery-ocp, three, glslify, and related CAD rendering toolkits.
The earthtojake/text-to-cad project organizes its core functionality into a monorepo structure under the packages/ directory. Understanding what libraries are included in the packages/ directory helps developers integrate the CAD generation pipeline into their own workflows. Each package maintains its own dependency manifest declaring the specific third-party tools required for STEP file export, WebGL rendering, and implicit surface modeling.
Python Libraries in cadpy
The cadpy package provides the shared runtime for STEP and GLB topology artifact generation. Located at packages/cadpy/, this Python library handles the heavy lifting of CAD kernel operations.
Core Dependencies
According to the pyproject.toml file in packages/cadpy/, the library depends on two primary CAD frameworks:
- build123d – A Python CAD library for parametric modeling
- cadquery-ocp – The OpenCASCADE Python bindings that provide the underlying geometric kernel
These dependencies enable cadpy to export industrial-standard STEP files and mesh formats programmatically.
Usage Example
from cadpy import step_export
# Export a simple STEP file using cadpy utilities
step_export.export_step("example.stp")
JavaScript Libraries in cadjs
The cadjs package contains reusable, non-React CAD rendering and runtime code that powers the web-based viewer. This TypeScript library focuses on loading and displaying CAD models in browser environments.
Rendering Dependencies
The package.json in packages/cadjs/ declares several key libraries:
- three – The Three.js WebGL library for 3D rendering
- @vitejs/plugin-react – Build tooling for React integration
- @types/three – TypeScript type definitions for Three.js
These libraries allow cadjs to parse STEP files and render them interactively in the browser without relying on backend processing.
Usage Example
import { ModelRuntime } from '@earthtojake/cadjs';
const runtime = new ModelRuntime(canvasElement);
runtime.loadStep("model.stp");
JavaScript Libraries in implicitjs
The implicitjs package implements a stand-alone implicit CAD modeler with shader-based rendering, snapshot capabilities, mesh sampling, and export functionality. This package handles complex surface representations through mathematical implicit functions.
Shader and Mesh Dependencies
As specified in packages/implicitjs/package.json, the library includes:
- three – Core 3D rendering infrastructure shared with cadjs
- glslify – A tool for bundling GLSL shader modules
- glsl-noise – Procedural noise functions for shader-based surface generation
These tools enable implicitjs to generate and sample implicit surfaces directly in the browser using WebGL shaders.
Usage Example
import { generateImplicitMesh } from '@earthtojake/implicitjs';
const mesh = generateImplicitMesh({ resolution: 64 });
scene.add(mesh);
Summary
- The
packages/directory contains three distinct libraries: cadpy (Python), cadjs (TypeScript), and implicitjs (TypeScript). - cadpy depends on
build123dandcadquery-ocpfor CAD kernel operations as declared inpackages/cadpy/pyproject.toml. - cadjs uses
threeand React-related tooling for web-based CAD viewing according topackages/cadjs/package.json. - implicitjs leverages
three,glslify, andglsl-noisefor implicit surface modeling and shader rendering defined inpackages/implicitjs/package.json. - Each package maintains isolated dependencies through its own manifest, making the monorepo structure modular and maintainable.
Frequently Asked Questions
What Python CAD libraries does text-to-cad use?
The cadpy package relies on build123d and cadquery-ocp as its primary dependencies. These are declared in packages/cadpy/pyproject.toml and provide the OpenCASCADE-based geometric kernel required for STEP file generation and solid modeling operations.
How does cadjs differ from implicitjs in the text-to-cad monorepo?
While both are TypeScript packages using Three.js, cadjs focuses on reusable CAD viewing and runtime infrastructure for loading standard CAD formats like STEP. In contrast, implicitjs specializes in implicit surface modeling, shader-based rendering, and procedural mesh generation using GLSL noise functions.
Where are the dependency manifests located for each package?
Python dependencies for cadpy are defined in packages/cadpy/pyproject.toml. JavaScript dependencies for cadjs and implicitjs are declared in their respective packages/cadjs/package.json and packages/implicitjs/package.json files according to the repository structure.
Can I use cadpy independently of the text-to-cad web interface?
Yes, cadpy is a self-contained Python package that can be imported and used in standalone scripts or other Python applications. It exposes utilities like step_export for generating CAD files without requiring the JavaScript frontend components found in cadjs or implicitjs.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →