Here is the translation of the code examples you provided for drawing basic surfaces using MXCAD3D:
Plane
typescript
// Point on the plane
const pt = new Mx3dGePoint(0, 0, 0);
// Normal vector of the plane
const dir = new Mx3dGeDir(0, 0, 1);
// Parameterized geometric plane
const plane = new Mx3dGeomPlane(pt, dir);
// UV parameter range [0, 100], [0, 100] with precision 1e-5
const planeFace = plane.Face(0, 100, 0, 100, 1e-5);
// Add shape to the document
addShapeToDoc(planeFace);
// Update display (will update the model displayed in the canvas)
mxcad3d.update();
Cylinder
typescript
const csysr = new Mx3dGeCSYSR();
const cylinderMaker = new Mx3dMkCylinder(csysr, 15, 60, Math.PI * 3 / 2);
const cylinderFace = cylinderMaker.Face();
addShapeToDoc(cylinderFace);
mxcad3d.update();
Cone
typescript
const csysr = new Mx3dGeCSYSR();
const coneMaker = new Mx3dMkCone(csysr, 15, 5, 50, Math.PI * 3 / 2);
const coneFace = coneMaker.Face();
addShapeToDoc(coneFace);
mxcad3d.update();
Sphere
typescript
const csysr = new Mx3dGeCSYSR();
const sphereMaker = new Mx3dMkSphere(csysr, 15, Math.PI * 3 / 2);
const sphereFace = sphereMaker.Face();
addShapeToDoc(sphereFace);
mxcad3d.update();
Torus
typescript
const csysr = new Mx3dGeCSYSR();
const torusMaker = new Mx3dMkTorus(csysr, 13, 2, Math.PI / 2);
const torusFace = torusMaker.Face();
addShapeToDoc(torusFace);
mxcad3d.update();
B-Spline Surface
typescript
const pt1 = new Mx3dGePoint(0, 0, 0);
const pt2 = new Mx3dGePoint(0, 100, 20);
const pt3 = new Mx3dGePoint(0, 200, 100);
const pt4 = new Mx3dGePoint(0, 300, 0);
const pt5 = new Mx3dGePoint(100, 0, 50);
const pt6 = new Mx3dGePoint(100, 100, 30);
const pt7 = new Mx3dGePoint(100, 200, 200);
const pt8 = new Mx3dGePoint(100, 300, 0);
// Control points
const Poles = [[pt1, pt2, pt3, pt4],[pt5, pt6, pt7, pt8]];
// U knots
const UKnots = [0, 1];
// U multiplicities
const UMults = [2, 2];
// V knots
const VKnots = [0, 1, 2];
// V multiplicities
const VMults = [3, 1, 3];
// UV degrees 1, 2; UV periodicity false, false
const bSplSurface = new Mx3dGeomBSplineSurface(Poles, UKnots, VKnots, UMults, VMults, 1, 2, false, false);
const bSplSurfaceFace = bSplSurface.Face(1e-5);
addShapeToDoc(bSplSurfaceFace);
mxcad3d.update();
Bezier Surface
typescript
const pnt_1_1 = new Mx3dGePoint(10, 10, 10);
const pnt_1_2 = new Mx3dGePoint(20, 10, 15);
const pnt_1_3 = new Mx3dGePoint(30, 10, 20);
const pnt_1_4 = new Mx3dGePoint(40, 10, 15);
const pnt_1_5 = new Mx3dGePoint(50, 10, 10);
const pnt_2_1 = new Mx3dGePoint(10, 20, 15);
const pnt_2_2 = new Mx3dGePoint(20, 20, 20);
const pnt_2_3 = new Mx3dGePoint(30, 20, 15);
const pnt_2_4 = new Mx3dGePoint(40, 20, 10);
const pnt_2_5 = new Mx3dGePoint(50, 20, 15);
const pnt_3_1 = new Mx3dGePoint(10, 30, 10);
const pnt_3_2 = new Mx3dGePoint(20, 30, 15);
const pnt_3_3 = new Mx3dGePoint(30, 30, 20);
const pnt_3_4 = new Mx3dGePoint(40, 30, 15);
const pnt_3_5 = new Mx3dGePoint(50, 30, 10);
// Control points
const Poles = [[pnt_1_1, pnt_1_2, pnt_1_3, pnt_1_4, pnt_1_5], [pnt_2_1, pnt_2_2, pnt_2_3, pnt_2_4, pnt_2_5], [pnt_3_1, pnt_3_2, pnt_3_3, pnt_3_4, pnt_3_5]];
const bezierSurface = new Mx3dGeomBezierSurface(Poles);
// Precision 1e-5
const bezierSurfaceFace = bezierSurface.Face(1e-5);
addShapeToDoc(bezierSurfaceFace);
mxcad3d.update();