Script TS TypeScript Free

Example in TypeScript

Example in TypeScript picture
Author
bitbybit
Created
Mar 19, 2021, 8:18:09 AM
Last edit
Dec 5, 2023, 6:15:01 PM

Edit scriptPreview

Project

Nurbs curve along points

The NURBS curve gets created by using 7 control points. That curve is then subdivided into 20 equally distanced points. The result is visualised.

View full project
const Inputs = Bit.Inputs;

const whiteColour = '#ffffff';
const lightGreyColour = '#eeeeee';
const greyColour = '#666666';

const drawGridMeshInput = new Inputs.Draw.SceneDrawGridMeshDto();
drawGridMeshInput.mainColor = whiteColour;
drawGridMeshInput.secondaryColor = lightGreyColour;
bitbybit.draw.drawGridMesh(drawGridMeshInput);

const pointsForCurve = [[0, 0, 0], [1, 2, -2], [-2, 3, -1], [0, 4, 2], [2, 2, 0], [2, 3, 0], [0, 0, 1]] as Bit.Inputs.Base.Point3[];

const curve = bitbybit.verb.curve.createCurveByPoints({ points: pointsForCurve, degree: 3 });

const drawCurveInput = new Inputs.Draw.DrawBasicGeometryOptions();
drawCurveInput.size = 5;
drawCurveInput.colours = greyColour;
bitbybit.draw.drawAny({ entity: curve, options: drawCurveInput });

const subdividedPoints = bitbybit.verb.curve.divideByEqualArcLengthToPoints({
    curve,
    subdivision: 20,
});

const drawPointsInput = new Inputs.Draw.DrawBasicGeometryOptions();
drawPointsInput.size = 0.2;
drawPointsInput.colours = whiteColour;
bitbybit.draw.drawAny({ entity: subdividedPoints, options: drawPointsInput });

Plans and pricing

Choose your plan

Editor plans for 3D development, API keys for server-side CAD algorithms

EnterpriseB2BCustompricing

Custom software development, dedicated servers and CAD automation at scale.

Learn moreContact us

CAD automation and software
  • Custom software development
  • Cloud CAD automation pipelines
  • 3D configurators (STEP & GLTF)
  • Batch export jobs
  • Custom algorithms & deployment
Infrastructure and support
  • Custom compute allocation
  • Dedicated / VPS server tenants
  • Long-running computation jobs
  • Custom upload limits & overage
  • SLA & premium support

All prices exclude applicable taxesView all plan details

Contact

Talk to us

Tell us what you are building or what is blocking you, through whichever channel suits you.