Script: Intersection solids

Intersection solids picture
Type
Typescript logo indicatortypescript
Author
matas
Date Created
Feb 23, 2024, 8:59:09 PM
Last Edit Date
Feb 27, 2024, 1:32:51 PM

Project Information

This project contains demo scripts for TypeScript Monaco editor that are used as examples in the "Getting Started" section of the documentation.

View Full Project

Script Code

const start = async () => {
    const boxOpt = new Bit.Inputs.OCCT.BoxDto();
    boxOpt.width = 5;
    boxOpt.length = 8;
    boxOpt.height = 5;
    const box = await bitbybit.occt.shapes.solid.createBox(boxOpt);


    const cylinderOpt = new Bit.Inputs.OCCT.CylinderDto();
    cylinderOpt.radius = 3;
    cylinderOpt.height = 7;
    cylinderOpt.center = [3, 0, 3];
    const cylinder = await bitbybit.occt.shapes.solid.createCylinder(cylinderOpt);


    const sphereOpt = new Bit.Inputs.OCCT.SphereDto();
    sphereOpt.radius = 3;
    sphereOpt.center = [-1.5, 1.5, -5];
    const sphere = await bitbybit.occt.shapes.solid.createSphere(sphereOpt);

    const diff = await bitbybit.occt.booleans.intersection({
        shapes: [box, cylinder, sphere],
        keepEdges: false
    })

    bitbybit.draw.drawAnyAsync({
        entity: diff
    });
}

start();