Skip to content

Getting Started

Light OCCT provides a clean, modern API for working with OpenCASCADE geometry across multiple programming languages.

Installation

C++ Library

bash
# Clone the repository
git clone https://github.com/your-org/light-occt.git
cd light-occt

# Build with CMake
mkdir build && cd build
cmake -DOCCT_INSTALL_PATH=/path/to/occt/install ..
ninja

# Optional: Build with language bindings
cmake -DBUILD_PYTHON_BINDINGS=ON ..
ninja

Python Package

bash
# Install from PyPI (when available)
pip install light-occt

# Or build from source
cd light-occt
cmake -DBUILD_PYTHON_BINDINGS=ON ..
ninja
pip install ./build/bindings/python/

Your First Light OCCT Program

C++

cpp
#include <light-occt/LCurve.hxx>
#include <iostream>

int main() {
    // Create a circle at origin with radius 5
    auto circle = LCurve::CreateCircle(
        Point(0, 0, 0),     // center
        Vector(0, 0, 1),    // normal (Z-axis)
        5.0                 // radius
    );
    
    // Check if creation was successful
    if (circle.IsValid()) {
        std::cout << "Circle created successfully!" << std::endl;
        
        // Evaluate a point on the circle
        Point pointOnCircle = circle.D0(M_PI/2);
        std::cout << "Point at π/2: (" 
                  << pointOnCircle.x << ", " 
                  << pointOnCircle.y << ", " 
                  << pointOnCircle.z << ")" << std::endl;
    }
    
    return 0;
}

Python

python
import light_occt as occt
import math

# Create a circle at origin with radius 5
circle = occt.LCurve.CreateCircle(
    occt.Point(0, 0, 0),    # center
    occt.Vector(0, 0, 1),   # normal (Z-axis)
    5.0                     # radius
)

# Check if creation was successful
if circle.IsValid():
    print("Circle created successfully!")
    
    # Evaluate a point on the circle
    point_on_circle = circle.D0(math.pi/2)
    print(f"Point at π/2: ({point_on_circle.x}, {point_on_circle.y}, {point_on_circle.z})")

Released under the LGPL-2.1 License