MotorXP-AFM Scripting API
    Preparing search index...

    Variable GeomConst

    Geom: {
        angle(x: number, y: number): number;
        angle(v1: Vector3, v2: Vector3): number;
        angleBetweenVector(v1: Vector3, v2: Vector3): number;
        angleBetweenVectors(v1: Vector3, v2: Vector3): number;
        angleX(point: Point3): number;
        angleX(x: number, y: number, z: number): number;
        angleY(point: Point3): number;
        angleY(x: number, y: number, z: number): number;
        angleZ(point: Point3): number;
        angleZ(x: number, y: number, z: number): number;
        arc(radius: number, angle: number): Shape;
        arc(radius: number, angle1: number, angle2: number): Shape;
        arc(p1: Point3, p2: Point3, p3: Point3): Shape;
        boundingBox(shp: Shape): BoundingBox;
        box(x: number, y: number, z: number): Shape;
        box(a: number): Shape;
        bspline(points: Point3[], closed?: boolean): Shape;
        chamfer(shp: Shape, r: number): Shape;
        chamfer(shp: Shape, r: number, refs: Point3[]): Shape;
        circle(radius: number): Shape;
        circle(radius: number, angle: number): Shape;
        circle(radius: number, angle1: number, angle2: number): Shape;
        collar(r1: number, r2: number, h: number): Shape;
        collar(r1: number, r2: number, h: number, angle: number): Shape;
        cone(r1: number, r2: number, h: number): Shape;
        cone(r1: number, r2: number, h: number, angle: number): Shape;
        cylinder(r: number, h: number): Shape;
        cylinder(r: number, h: number, angle: number): Shape;
        deg(radians: number): number;
        degreesToRadians(degrees: number): number;
        diff(a: Shape, b: Shape): Shape;
        diff(shapes: Shape[]): Shape;
        difference(a: Shape, b: Shape): Shape;
        difference(shapes: Shape[]): Shape;
        distance(p1: Point3, p2: Point3): number;
        distance(p1: point, p2: point): number;
        distanceToSegment(p1: Point3, p2: Point3, p: Point3): number;
        distanceToSegmentXY(p1: Point3, p2: Point3, point: Point3): number;
        distanceToSegmentXZ(p1: Point3, p2: Point3, point: Point3): number;
        distanceToSegmentYZ(p1: Point3, p2: Point3, point: Point3): number;
        ellipse(majorRadius: number, minorRadius: number): Shape;
        ellipse(
            majorRadius: number,
            minorRadius: number,
            angle1: number,
            angle2: number,
        ): Shape;
        ellipse(s1: Point3, s2: Point3, center: Point3): Shape;
        ellipse(
            s1: Point3,
            s2: Point3,
            center: Point3,
            angle1: number,
            angle2: number,
        ): Shape;
        even(v: number): number;
        fill(shp: Shape): Shape;
        fillet(shp: Shape, r: number): Shape;
        fillet(shp: Shape, r: number, refs: Point3[]): Shape;
        filletFace(shp: Shape, r: number, ref: Point3 | Shape): Shape;
        fromPolar(radius: number, angle: number): point;
        helperPiece(shp: Shape, color?: color): Piece;
        helperPiece(pt: Point3, radius?: number, color?: color): Piece;
        infplane(pos?: Point3, dir?: Vector3): Shape;
        intersect(a: Shape, b: Shape): Shape;
        intersect(shapes: Shape[]): Shape;
        intersectionCircle2Circle2(
            c1: point,
            r1: number,
            c2: point,
            r2: number,
        ): point[];
        intersectionSegment2Circle2(
            p1: point,
            p2: point,
            c: point,
            r: number,
        ): point[];
        intersectionSegment2Segment2(
            p1: point,
            p2: point,
            q1: point,
            q2: point,
        ): point[];
        intersectionSegment3Segment3(
            p1: Point3,
            p2: Point3,
            q1: Point3,
            q2: Point3,
        ): Point3;
        intersectsSegments(p1: Point3, p2: Point3, q1: Point3, q2: Point3): Point3;
        isEpsilon(arg: number, eps?: number): boolean;
        isEqual(arg1: number, arg2: number, eps?: number): boolean;
        isEven(v: number): boolean;
        isGreat(v1: number, v2: number): boolean;
        isGreatEqual(arg1: number, arg2: number, eps?: number): boolean;
        isLess(v1: number, v2: number): boolean;
        isLessEqual(arg1: number, arg2: number, eps?: number): boolean;
        isOdd(v: number): boolean;
        middleAngle(a1: number, a2: number, dir: Coil): number;
        ngon(radius: number, n: number): Shape;
        normAngle(a: number): number;
        normAngleAt180(a: number): number;
        normSpanAngle(a: number): number;
        odd(v: number): number;
        piece(
            shp: Shape,
            material:
                | ConductorMaterial
                | CustomMaterial
                | EmptyMaterial
                | EndturnMaterial
                | GeneralMaterial
                | IronMaterial
                | MagnetParallelMaterial
                | MagnetRadialMaterial,
        ): Piece;
        point2(x?: number, y?: number): point;
        point3(x?: number, y?: number, z?: number): Point3;
        point3(p: point, z?: number): Point3;
        pointAtPolygon(polygon: Point3[], point: Point3): number;
        pointAtPolygonXY(polygon: Point3[], point: Point3): number;
        pointAtPolygonXZ(polygon: Point3[], point: Point3): number;
        pointAtPolygonYZ(polygon: Point3[], point: Point3): number;
        pointAtSegment(p1: Point3, p2: Point3, t: number): Point3;
        pointAtSegment(p1: point, p2: point, t: number): point;
        pointAtShape(shape: Shape, point: Point3): number;
        polygon(points: Point3[]): Shape;
        polysegment(points: Point3[], closed?: boolean): Shape;
        project(p: Point3, shape: Shape): Point3;
        projectToSegment(p: Point3, p1: Point3, p2: Point3): Point3;
        projectToSegmentXY(p: Point3, p1: Point3, p2: Point3): Point3;
        projectToSegmentXZ(p: Point3, p1: Point3, p2: Point3): Point3;
        projectToSegmentYZ(p: Point3, p1: Point3, p2: Point3): Point3;
        rad(degrees: number): number;
        radiansToDegrees(radians: number): number;
        radius(x: number, y: number): number;
        radiusX(point: Point3): number;
        radiusX(x: number, y: number, z: number): number;
        radiusY(point: Point3): number;
        radiusY(x: number, y: number, z: number): number;
        radiusZ(point: Point3): number;
        radiusZ(x: number, y: number, z: number): number;
        rectangle(a: number, b: number, center?: boolean): Shape;
        ring(radius1: number, radius2: number): Shape;
        ring(radius1: number, radius2: number, angle: number): Shape;
        ring(
            radius1: number,
            radius2: number,
            angle1: number,
            angle2: number,
        ): Shape;
        round(value: number, precision: number): number;
        section(a: Shape, b: Shape, pretty?: boolean): Shape;
        segment(p1: Point3, p2: Point3): Shape;
        shape(bbox: BoundingBox): Shape;
        sign(n: number): number;
        spanAngle(a1: number, a2: number, dir: Coil): number;
        sphere(r: number): Shape;
        sphere(r: number, an1: number): Shape;
        sphere(r: number, an1: number, an2: number): Shape;
        sphere(r: number, an1: number, an2: number, an3: number): Shape;
        square(a: number, center?: boolean): Shape;
        torus(r1: number, r2: number): Shape;
        torus(r1: number, r2: number, ua: number): Shape;
        torus(r1: number, r2: number, va1: number, va2: number): Shape;
        torus(r1: number, r2: number, va1: number, va2: number, ua: number): Shape;
        unify(shp: Shape): Shape;
        unite(a: Shape, b: Shape): Shape;
        unite(shapes: Shape[]): Shape;
        vector3(x?: number, y?: number, z?: number): Vector3;
        vector3(p: Point3): Vector3;
        vector3(p1: Point3, p2: Point3): Vector3;
        wire(shapes: Shape[]): Shape;
    }

    Built-in Geom object

    Type Declaration

    • angle: function
      • Gets the angle of a point.

        Parameters

        • x: number

          X coordinate value

        • y: number

          Y coordinate value

        Returns number

        Angle of the point in degrees about [0,0]. Zero is the three o'clock direction; the angle increases clockwise.

      • Angle between vectors.

        Parameters

        Returns number

        Angle between vectors in degrees.

    • angleBetweenVector: function
      • Angle between vectors.

        Parameters

        Returns number

        Angle between vectors in degrees.

        Use angleBetweenVectors instead.

    • angleBetweenVectors: function
      • Angle between vectors.

        Parameters

        Returns number

        Angle between vectors in degrees.

    • angleX: function
      • Gets the angle of a point about [0,0,0] in the YOZ plane.

        Parameters

        • point: Point3

          Point in three-dimensional space.

        Returns number

        Angle of the point in degrees about [0,0,0] in the YOZ plane. Zero is the three o'clock direction; the angle increases clockwise.

      • Gets the angle of [x,y,z] about the origin in the YOZ plane.

        Parameters

        • x: number

          X coordinate (unused).

        • y: number

          Y coordinate.

        • z: number

          Z coordinate.

        Returns number

        Angle of the point in degrees.

    • angleY: function
      • Gets the angle of a point about [0,0,0] in the XOZ plane.

        Parameters

        • point: Point3

          Point in three-dimensional space.

        Returns number

        Angle of the point in degrees about [0,0,0] in the XOZ plane. Zero is the three o'clock direction; the angle increases clockwise.

      • Gets the angle of [x,y,z] about the origin in the XOZ plane.

        Parameters

        • x: number

          X coordinate.

        • y: number

          Y coordinate (unused).

        • z: number

          Z coordinate.

        Returns number

        Angle of the point in degrees.

    • angleZ: function
      • Gets the angle of a point about [0,0,0] in the XOY plane.

        Parameters

        • point: Point3

          Point in three-dimensional space

        Returns number

        Angle of the point in degrees about [0,0,0] in the XOY plane. Zero is the three o'clock direction; the angle increases clockwise.

      • Gets the angle of [x,y,z] about the origin in the XOY plane.

        Parameters

        • x: number

          X coordinate.

        • y: number

          Y coordinate.

        • z: number

          Z coordinate (unused).

        Returns number

        Angle of the point in degrees.

    • arc: function
      • 2D arc in the XOY plane, centered at [0,0,0], with angles in degrees.

        Parameters

        • radius: number

          Arc radius.

        • angle: number

          Arc angle in degrees in (0°, 360°), starting at 0.

        Returns Shape

        Shape representing an arc.

      • 2D arc in the XOY plane, centered at [0,0,0], with angles in degrees.

        Parameters

        • radius: number

          Arc radius.

        • angle1: number

          Start angle of the arc in degrees in (0°, 360°).

        • angle2: number

          End angle of the arc in degrees in (0°, 360°).

        Returns Shape

        Shape representing an arc.

      • 2D arc in the XOY plane, centered at [0,0,0], with angles in degrees.

        Parameters

        • p1: Point3

          First point through which the arc passes.

        • p2: Point3

          Second point through which the arc passes.

        • p3: Point3

          Third point through which the arc passes.

        Returns Shape

        Shape representing an arc.

    • boundingBox: function
      • Returns the bounding box of a shape.

        Parameters

        Returns BoundingBox

        Bounding box of the shape.

    • box: function
      • 3D solid primitive: a box of dimensions x, y, z, positioned relative to [0,0,0].

        Parameters

        • x: number

          Box size along X.

        • y: number

          Box size along Y.

        • z: number

          Box size along Z.

        Returns Shape

        Box.

      • 3D solid primitive: a box of dimensions x, y, z, positioned relative to [0,0,0].

        Parameters

        • a: number

          Cube size.

        Returns Shape

        Box.

    • bspline: function
      • B-spline: a smooth 3D curve passing through all specified points, supplied as the points array.

        Parameters

        • points: Point3[]

          Array of points defining the smooth curve.

        • Optionalclosed: boolean

          closed [default=false] - Whether the curve is closed.

        Returns Shape

        B-spline.

    • chamfer: function
      • Chamfers a shape. Unlike filleting, this operation applies only to solids. The chamfer is defined by distance r from the edge to the chamfer line and an array of nearby reference points refs.

        Parameters

        • shp: Shape

          Solid to chamfer.

        • r: number

          Distance from the edge to the chamfer line.

        Returns Shape

        Result of the chamfer operation.

      • Chamfers a shape. Unlike filleting, this operation applies only to solids. The chamfer is defined by distance r from the edge to the chamfer line and an array of nearby reference points refs.

        Parameters

        • shp: Shape

          Solid to chamfer.

        • r: number

          Distance from the edge to the chamfer line.

        • refs: Point3[]

          Array of reference points near the edges to chamfer.

        Returns Shape

        Result of the chamfer operation.

    • circle: function
      • 2D circle or circular sector in the XOY plane, centered at [0,0,0], with angles in degrees.

        Parameters

        • radius: number

          Circle radius.

        Returns Shape

        Shape representing a circle or circular sector.

      • 2D circle or circular sector in the XOY plane, centered at [0,0,0], with angles in degrees.

        Parameters

        • radius: number

          Circle radius.

        • angle: number

          Sector angle in degrees in (0°, 360°); the shape is centered about the OX axis.

        Returns Shape

        Shape representing a circle or circular sector.

      • 2D circle or circular sector in the XOY plane, centered at [0,0,0], with angles in degrees.

        Parameters

        • radius: number

          Circle radius.

        • angle1: number

          Start angle of the sector in degrees in (0°, 360°).

        • angle2: number

          End angle of the sector in degrees in (0°, 360°).

        Returns Shape

        Shape representing a circle or circular sector.

    • collar: function
      • 3D solid primitive: a sleeve (a cylinder with an axial hole), defined by outer radius r1, inner radius r2, and height h, relative to [0,0,0]. The angle parameter can specify a sleeve sector.

        Parameters

        • r1: number

          Outer radius of the sleeve.

        • r2: number

          Inner radius of the sleeve.

        • h: number

          Sleeve height.

        Returns Shape

        Shape representing a sleeve.

      • 3D solid primitive: a sleeve (a cylinder with an axial hole), defined by outer radius r1, inner radius r2, and height h, relative to [0,0,0]. The angle parameter can specify a sleeve sector.

        Parameters

        • r1: number

          Outer radius of the sleeve.

        • r2: number

          Inner radius of the sleeve.

        • h: number

          Sleeve height.

        • angle: number

          Sleeve sector angle in degrees; the shape is centered about OX.

        Returns Shape

        Shape representing a sleeve.

    • cone: function
      • 3D solid primitive: a cone defined by bottom radius r1, top radius r2, and height h, relative to [0,0,0]. The angle parameter can specify a cone sector.

        Parameters

        • r1: number

          Bottom radius of the cone.

        • r2: number

          Top radius of the cone.

        • h: number

          Cone height.

        Returns Shape

        Shape representing a cone.

      • 3D solid primitive: a cone defined by bottom radius r1, top radius r2, and height h, relative to [0,0,0]. The angle parameter can specify a cone sector.

        Parameters

        • r1: number

          Bottom radius of the cone.

        • r2: number

          Top radius of the cone.

        • h: number

          Cone height.

        • angle: number

          Cone sector angle in degrees; the shape is centered about OX.

        Returns Shape

        Shape representing a cone.

    • cylinder: function
      • 3D solid primitive: a cylinder defined by radius r and height h, relative to [0,0,0]. The angle parameter can specify a cylinder sector.

        Parameters

        • r: number

          Cylinder radius.

        • h: number

          Cylinder height.

        Returns Shape

        Shape representing a cylinder.

      • 3D solid primitive: a cylinder defined by radius r and height h, relative to [0,0,0]. The angle parameter can specify a cylinder sector.

        Parameters

        • r: number

          Cylinder radius.

        • h: number

          Cylinder height.

        • angle: number

          Cylinder sector angle in degrees; the shape is centered about OX.

        Returns Shape

        Shape representing a cylinder.

    • deg: function
      • Converts radians to degrees.

        Parameters

        • radians: number

          Angle in radians.

        Returns number

        Angle in degrees.

    • degreesToRadians: function
      • Converts degrees to radians; same as rad.

        Parameters

        • degrees: number

          Angle in degrees.

        Returns number

        Angle in radians.

    • diff: function
      • Boolean operation: difference of two or more shapes.

        Parameters

        Returns Shape

        Shape resulting from the difference operation.

      • Boolean operation: difference of two or more shapes.

        Parameters

        • shapes: Shape[]

          Array of shapes for the difference operation.

        Returns Shape

        Shape resulting from the difference operation.

    • difference: function
      • Boolean operation: difference of two or more shapes.

        Parameters

        Returns Shape

        Shape resulting from the difference operation.

      • Boolean operation: difference of two or more shapes.

        Parameters

        • shapes: Shape[]

          Array of shapes for the difference operation.

        Returns Shape

        Shape resulting from the difference operation.

    • distance: function
      • Calculates the distance between two points.

        Parameters

        Returns number

        Distance between two points.

      • Calculates the distance between two 2D points.

        Parameters

        Returns number

        Distance between two points.

    • distanceToSegment: function
      • Calculates the distance from a point to a segment.

        Parameters

        • p1: Point3

          First endpoint of the segment.

        • p2: Point3

          Second endpoint of the segment.

        • p: Point3

          Point from which the distance is measured.

        Returns number

        Distance from the point to the segment.

    • distanceToSegmentXY: function
      • Calculates the distance from a point to a segment in the XOY plane. All points are three-dimensional, but only X and Y are used in the calculation.

        Parameters

        • p1: Point3

          Start point of the segment.

        • p2: Point3

          End point of the segment.

        • point: Point3

          Point from which the distance is measured.

        Returns number

        Distance from the point to the segment in the XOY plane.

    • distanceToSegmentXZ: function
      • Calculates the distance from a point to a segment in the XOZ plane. All points are three-dimensional, but only X and Z are used in the calculation.

        Parameters

        • p1: Point3

          Start point of the segment.

        • p2: Point3

          End point of the segment.

        • point: Point3

          Point from which the distance is measured.

        Returns number

        Distance from the point to the segment in the XOZ plane.

    • distanceToSegmentYZ: function
      • Calculates the distance from a point to a segment in the YOZ plane. All points are three-dimensional, but only Y and Z are used in the calculation.

        Parameters

        • p1: Point3

          Start point of the segment.

        • p2: Point3

          End point of the segment.

        • point: Point3

          Point from which the distance is measured.

        Returns number

        Distance from the point to the segment in the YOZ plane.

    • ellipse: function
      • 2D ellipse or elliptic sector in the XOY plane, centered at [0,0,0], with angles in degrees.

        Parameters

        • majorRadius: number

          First radius of the ellipse.

        • minorRadius: number

          Second radius of the ellipse.

        Returns Shape

        Shape representing an ellipse or elliptic sector.

      • 2D ellipse or elliptic sector in the XOY plane, centered at [0,0,0], with angles in degrees.

        Parameters

        • majorRadius: number

          First radius of the ellipse.

        • minorRadius: number

          Second radius of the ellipse.

        • angle1: number

          Start angle of the elliptic sector in degrees in (0°, 360°).

        • angle2: number

          End angle of the elliptic sector in degrees in (0°, 360°).

        Returns Shape

        Shape representing an ellipse or elliptic sector.

      • Ellipse centered at center: its major axis passes through center and s1, and its minor radius is the distance from s2 to the major axis. The ellipse lies in the plane through center, s1, and s2.

        Parameters

        • s1: Point3

          Point on the major axis.

        • s2: Point3

          Point defining the minor radius.

        • center: Point3

          Ellipse center.

        Returns Shape

        Shape representing an ellipse.

      • Elliptic sector centered at center (see ellipse(s1, s2, center)).

        Parameters

        • s1: Point3

          Point on the major axis.

        • s2: Point3

          Point defining the minor radius.

        • center: Point3

          Ellipse center.

        • angle1: number

          Start angle of the sector in degrees.

        • angle2: number

          End angle of the sector in degrees.

        Returns Shape

        Shape representing an elliptic sector.

    • even: function
      • Rounds to an integer and makes it even.

        Parameters

        • v: number

          Number.

        Returns number

        Even integer.

    • fill: function
      • Fills a closed wire by creating a face from it.

        Parameters

        • shp: Shape

          Closed wire.

        Returns Shape

        Shape representing a face.

    • fillet: function
      • Fillets a shape. For solids, edges are modified; for planar shapes, vertices are modified. Fillets are defined by radius r and an array of reference points refs near the edges or vertices to modify.

        Parameters

        • shp: Shape

          Shape to fillet.

        • r: number

          Fillet radius.

        Returns Shape

        Shape resulting from the fillet operation.

      • Fillets a shape. For solids, edges are modified; for planar shapes, vertices are modified. Fillets are defined by radius r and an array of reference points refs near the edges or vertices to modify.

        Parameters

        • shp: Shape

          Shape to fillet.

        • r: number

          Fillet radius.

        • refs: Point3[]

          Array of reference points refs near the edges or vertices to fillet.

        Returns Shape

        Shape resulting from the fillet operation.

    • filletFace: function
      • Fillets the edges of a face of a shape.

        Parameters

        • shp: Shape

          Shape to fillet.

        • r: number

          Fillet radius.

        • ref: Point3 | Shape

          Face of the shape, or a point nearest to the face to fillet.

        Returns Shape

        Shape resulting from filleting.

    • fromPolar: function
      • Converts polar coordinates (radius, angle) to Cartesian coordinates (x, y).

        Parameters

        • radius: number

          Radius.

        • angle: number

          Angle in degrees.

        Returns point

        Point in Cartesian coordinates.

    • helperPiece: function
      • Creates a helper motor piece from a shape and a color.

        Parameters

        • shp: Shape

          Geometric shape of the piece.

        • Optionalcolor: color

          Piece color.

        Returns Piece

        Piece representing a helper motor part.

      • Creates a helper motor piece from a shape and a color.

        Parameters

        • pt: Point3

          Sphere center point.

        • Optionalradius: number

          Sphere radius.

        • Optionalcolor: color

          Piece color.

        Returns Piece

        Piece representing a helper motor part.

    • infplane: function
      • Creates a plane.

        Parameters

        • Optionalpos: Point3

          pos [default=Geom.point(0,0,0)] - Plane position: a point on the plane.

        • Optionaldir: Vector3

          dir [default=Geom.vector3(0,0,1)] - Direction vector perpendicular to the plane.

        Returns Shape

        Shape representing a plane.

    • intersect: function
      • Boolean operation: intersection of two or more shapes.

        Parameters

        Returns Shape

        Shape resulting from the intersection operation.

      • Boolean operation: intersection of two or more shapes.

        Parameters

        • shapes: Shape[]

          Array of shapes to intersect.

        Returns Shape

        Shape resulting from the intersection operation.

    • intersectionCircle2Circle2: function
      • Returns circle intersection points; the array is empty if there are no intersections.

        Parameters

        • c1: point

          Center of circle 1.

        • r1: number

          Radius of circle 1.

        • c2: point

          Center of circle 2.

        • r2: number

          Radius of circle 2.

        Returns point[]

        Array of circle intersection points.

    • intersectionSegment2Circle2: function
      • Returns segment-circle intersection points; the array is empty if there are no intersections.

        Parameters

        • p1: point

          First endpoint of segment p.

        • p2: point

          Second endpoint of segment p.

        • c: point

          Circle center.

        • r: number

          Circle radius.

        Returns point[]

        Array of segment-circle intersection points.

    • intersectionSegment2Segment2: function
      • Returns intersection points of segments p and q; if the segments do not intersect, the point is invalid.

        Parameters

        • p1: point

          First endpoint of segment p.

        • p2: point

          Second endpoint of segment p.

        • q1: point

          First endpoint of segment q.

        • q2: point

          Second endpoint of segment q.

        Returns point[]

        Array of intersection points of segments p and q.

    • intersectionSegment3Segment3: function
      • Returns the intersection point of segments p and q; the point is invalid if they do not intersect.

        Parameters

        • p1: Point3

          First endpoint of segment p.

        • p2: Point3

          Second endpoint of segment p.

        • q1: Point3

          First endpoint of segment q.

        • q2: Point3

          Second endpoint of segment q.

        Returns Point3

        Intersection point of segments p and q.

    • intersectsSegments: function
      • Returns the intersection point of segments p and q; the point is invalid if they do not intersect.

        Parameters

        • p1: Point3

          First endpoint of segment p.

        • p2: Point3

          Second endpoint of segment p.

        • q1: Point3

          First endpoint of segment q.

        • q2: Point3

          Second endpoint of segment q.

        Returns Point3

        Intersection point of segments p and q.

    • isEpsilon: function
      • Returns true if the absolute value of arg is less than or equal to eps.

        Parameters

        • arg: number

          Numeric value to process.

        • Optionaleps: number

          eps [default=Math.EPSILON] - Floating-point comparison tolerance.

        Returns boolean

        Operation result.

    • isEqual: function
      • Returns true if the difference between the absolute values of arg1 and arg2 is less than or equal to eps.

        Parameters

        • arg1: number

          First numeric value.

        • arg2: number

          Second numeric value.

        • Optionaleps: number

          eps [default=Math.EPSILON] - Floating-point comparison tolerance.

        Returns boolean

        Operation result.

    • isEven: function
      • Returns true if the number is even after rounding to an integer.

        Parameters

        • v: number

          Number.

        Returns boolean

        True if the number is even.

    • isGreat: function
      • Returns true if v1 is strictly greater than v2, allowing for Math.EPSILON.

        Parameters

        • v1: number

          First numeric value.

        • v2: number

          Second numeric value.

        Returns boolean

        Comparison result.

    • isGreatEqual: function
      • Returns true if arg1 is greater than or equal to arg2, allowing for eps.

        Parameters

        • arg1: number

          First numeric value.

        • arg2: number

          Second numeric value.

        • Optionaleps: number

          eps [default=Math.EPSILON] - Floating-point comparison tolerance.

        Returns boolean

        Operation result.

    • isLess: function
      • Returns true if v1 is strictly less than v2, allowing for Math.EPSILON.

        Parameters

        • v1: number

          First numeric value.

        • v2: number

          Second numeric value.

        Returns boolean

        Comparison result.

    • isLessEqual: function
      • Returns true if arg1 is less than or equal to arg2, allowing for eps.

        Parameters

        • arg1: number

          First numeric value.

        • arg2: number

          Second numeric value.

        • Optionaleps: number

          eps [default=Math.EPSILON] - Floating-point comparison tolerance.

        Returns boolean

        Operation result.

    • isOdd: function
      • Returns true if the number is odd after rounding to an integer.

        Parameters

        • v: number

          Number.

        Returns boolean

        True if the number is odd.

    • middleAngle: function
      • Calculates the mean angle between a1 and a2 in the specified direction (CW — clockwise, CCW — counterclockwise).

        Parameters

        • a1: number

          First angle in degrees.

        • a2: number

          Second angle in degrees.

        • dir: Coil

          Traversal direction (required): Coil.CW (clockwise) or Coil.CCW (counterclockwise).

        Returns number

        Mean angle in degrees.

    • ngon: function
      • 2D regular N-sided polygon in the XOY plane, centered at [0,0,0].

        Parameters

        • radius: number

          Polygon radius: distance from the center to the vertices.

        • n: number

          Number of polygon vertices (at least 3).

        Returns Shape

        Shape representing a regular N-sided polygon.

    • normAngle: function
      • Normalizes an angle to the range from 0° to 360°.

        Parameters

        • a: number

          Angle in degrees.

        Returns number

        Normalized angle in (0°, 360°).

    • normAngleAt180: function
      • Normalizes an angle to the range from -180° to +180°.

        Parameters

        • a: number

          Angle in degrees.

        Returns number

        Normalized angle in (-180°, +180°).

    • normSpanAngle: function
      • Normalizes the angular distance to the range from 0° to 360°.

        Parameters

        • a: number

          Angle in degrees.

        Returns number

        Normalized angle in (0°, 360°).

    • odd: function
      • Rounds to an integer and makes it odd.

        Parameters

        • v: number

          Number.

        Returns number

        Odd integer.

    • piece: function
    • point2: function
      • Creates a 2D point.

        Parameters

        • Optionalx: number

          Point x coordinate.

        • Optionaly: number

          Point y coordinate.

        Returns point

        Point in Cartesian coordinates.

    • point3: function
      • Creates a point in 3D space.

        Parameters

        • Optionalx: number

          Point x coordinate.

        • Optionaly: number

          Point y coordinate.

        • Optionalz: number

          Point z coordinate.

        Returns Point3

        Point3 representing a point in three-dimensional space.

      • Creates a point in 3D space.

        Parameters

        • p: point

          Point with coordinates [x,y].

        • Optionalz: number

          Point z coordinate.

        Returns Point3

        Point3 representing a point in three-dimensional space.

    • pointAtPolygon: function
      • Determines the position of a point relative to a polygon in 3D space.

        Parameters

        • polygon: Point3[]

          Polygon defined by an array of points.

        • point: Point3

          Point to test.

        Returns number

        -1 — outside the polygon (ON_UNBOUNDED_SIDE), 0 — on the polygon boundary (ON_BOUNDARY), 1 — inside the polygon (ON_BOUNDED_SIDE).

    • pointAtPolygonXY: function
      • Determines the position of a point relative to a polygon in the XY plane (Z is ignored).

        Parameters

        • polygon: Point3[]

          Polygon (list of points).

        • point: Point3

          Point to test.

        Returns number

        -1 — outside (ON_UNBOUNDED_SIDE), 0 — on the boundary (ON_BOUNDARY), 1 — inside (ON_BOUNDED_SIDE).

    • pointAtPolygonXZ: function
      • Determines the position of a point relative to a polygon in the XZ plane (Y is ignored).

        Parameters

        • polygon: Point3[]

          Polygon (list of points).

        • point: Point3

          Point to test.

        Returns number

        -1 — outside (ON_UNBOUNDED_SIDE), 0 — on the boundary (ON_BOUNDARY), 1 — inside (ON_BOUNDED_SIDE).

    • pointAtPolygonYZ: function
      • Determines the position of a point relative to a polygon in the YZ plane (X is ignored).

        Parameters

        • polygon: Point3[]

          Polygon (list of points).

        • point: Point3

          Point to test.

        Returns number

        -1 — outside (ON_UNBOUNDED_SIDE), 0 — on the boundary (ON_BOUNDARY), 1 — inside (ON_BOUNDED_SIDE).

    • pointAtSegment: function
      • Returns the point at parameter t along a segment. Returns the start point at t = 0 and the end point at t = 1.

        Parameters

        • p1: Point3

          First endpoint of the segment.

        • p2: Point3

          Second endpoint of the segment.

        • t: number

          Segment parameter, usually from 0 to 1.

        Returns Point3

        Returns a Point3.

      • Returns the 2D point at parameter t along a segment.

        Parameters

        • p1: point

          First endpoint of the segment.

        • p2: point

          Second endpoint of the segment.

        • t: number

          Segment parameter, usually from 0 to 1.

        Returns point

        Point on the segment.

    • pointAtShape: function
      • Determines the position of a point relative to a geometric shape in 3D space.

        Parameters

        • shape: Shape

          Geometric shape, such as a curve, edge, or wire.

        • point: Point3

          Point to test.

        Returns number

        -1 — outside the shape (ON_UNBOUNDED_SIDE), 0 — on the shape boundary (ON_BOUNDARY), 1 — inside the shape (ON_BOUNDED_SIDE).

    • polygon: function
      • 2D polygon in the XOY plane, centered at [0,0,0].

        Parameters

        • points: Point3[]

          Array of polygon vertices.

        Returns Shape

        Shape representing a polygon.

    • polysegment: function
      • Polysegment: a 3D polyline defined by the points array.

        Parameters

        • points: Point3[]

          Array of polyline vertices.

        • Optionalclosed: boolean

          closed [default=false] - If true, connects the end of the polyline to its start.

        Returns Shape

        Shape representing a polyline.

    • project: function
      • Returns the projection of a point onto an Edge or Face.

        Parameters

        Returns Point3

        Point3 representing the projection onto the shape.

    • projectToSegment: function
      • Returns the projection of a point onto a segment.

        Parameters

        • p: Point3

          Point.

        • p1: Point3

          Endpoint 1 of the segment.

        • p2: Point3

          Endpoint 2 of the segment.

        Returns Point3

        Point3 representing the projection onto the segment.

    • projectToSegmentXY: function
      • Returns the projection of a point onto a segment in the XOY plane.

        Parameters

        • p: Point3

          Point.

        • p1: Point3

          Endpoint 1 of the segment.

        • p2: Point3

          Endpoint 2 of the segment.

        Returns Point3

        Point3 representing the projection onto the segment in the XOY plane.

    • projectToSegmentXZ: function
      • Returns the projection of a point onto a segment in the XOZ plane.

        Parameters

        • p: Point3

          Point.

        • p1: Point3

          Endpoint 1 of the segment.

        • p2: Point3

          Endpoint 2 of the segment.

        Returns Point3

        Point3 representing the projection onto the segment in the XOZ plane.

    • projectToSegmentYZ: function
      • Returns the projection of a point onto a segment in the YOZ plane.

        Parameters

        • p: Point3

          Point.

        • p1: Point3

          Endpoint 1 of the segment.

        • p2: Point3

          Endpoint 2 of the segment.

        Returns Point3

        Point3 representing the projection onto the segment in the YOZ plane.

    • rad: function
      • Converts degrees to radians.

        Parameters

        • degrees: number

          Angle in degrees.

        Returns number

        Angle in radians.

    • radiansToDegrees: function
      • Converts radians to degrees; same as deg.

        Parameters

        • radians: number

          Angle in radians.

        Returns number

        Angle in degrees.

    • radius: function
      • Radial distance of a point in 2D space.

        Parameters

        • x: number

          Point x coordinate

        • y: number

          Point y coordinate

        Returns number

        Radial distance of [x,y] from [0,0].

    • radiusX: function
      • Radial distance of a point in the YOZ plane.

        Parameters

        • point: Point3

          Point in three-dimensional space.

        Returns number

        Radial distance of a point from [0,0,0].

      • Radial distance of a point in the YOZ plane.

        Parameters

        • x: number

          Point x coordinate

        • y: number

          Point y coordinate

        • z: number

          Point z coordinate

        Returns number

        Radial distance of a point from [0,0,0].

    • radiusY: function
      • Radial distance in the XOZ plane, with origin [0,0,0].

        Parameters

        • point: Point3

          Point in three-dimensional space.

        Returns number

        Radial distance of a point from [0,0,0].

      • Radial distance in the XOZ plane, with origin [0,0,0].

        Parameters

        • x: number

          Point x coordinate

        • y: number

          Point y coordinate

        • z: number

          Point z coordinate

        Returns number

        Radial distance of a point from [0,0,0].

    • radiusZ: function
      • Radial distance in the XOY plane, with origin [0,0,0].

        Parameters

        • point: Point3

          Point in three-dimensional space.

        Returns number

        Radial distance of a point from [0,0,0].

      • Radial distance in the XOY plane, with origin [0,0,0].

        Parameters

        • x: number

          Point x coordinate

        • y: number

          Point y coordinate

        • z: number

          Point z coordinate

        Returns number

        Radial distance of a point from [0,0,0].

    • rectangle: function
      • 2D rectangle in the XOY plane.

        Parameters

        • a: number

          Rectangle side along X

        • b: number

          Rectangle side along Y

        • Optionalcenter: boolean

          If true, the rectangle is centered at [0,0,0]; otherwise, one corner is at [0,0,0].

        Returns Shape

        Shape representing a rectangle.

    • ring: function
      • 2D ring or ring sector in the XOY plane, centered at [0,0,0], with angles in degrees.

        Parameters

        • radius1: number

          Outer ring radius

        • radius2: number

          Inner ring radius

        Returns Shape

        Shape representing a ring or ring sector.

      • 2D ring or ring sector in the XOY plane, centered at [0,0,0], with angles in degrees.

        Parameters

        • radius1: number

          Outer ring radius

        • radius2: number

          Inner ring radius

        • angle: number

          Ring sector angle from 0 to 360°. The shape is centered about OX.

        Returns Shape

        Shape representing a ring or ring sector.

      • 2D ring or ring sector in the XOY plane, centered at [0,0,0], with angles in degrees.

        Parameters

        • radius1: number

          Outer ring radius

        • radius2: number

          Inner ring radius

        • angle1: number

          Start angle of the ring sector in degrees

        • angle2: number

          End angle of the ring sector in degrees

        Returns Shape

        Shape representing a ring or ring sector.

    • round: function
      • Rounds value to the specified precision.

        Parameters

        • value: number

          Number.

        • precision: number

          Unknown

        Returns number

        Number rounded to the specified precision.

    • section: function
      • Creates a section.

        Parameters

        • a: Shape

          First shape for the section operation

        • b: Shape

          Second shape for the section operation

        • Optionalpretty: boolean

          Simplify the section result.

        Returns Shape

        Shape representing the section of two shapes.

    • segment: function
      • Creates a 3D segment defined by two points.

        Parameters

        • p1: Point3

          Start point of the segment

        • p2: Point3

          End point of the segment

        Returns Shape

        Shape representing a segment.

    • shape: function
      • Returns the solid corresponding to the bounding box.

        Parameters

        Returns Shape

        Shape representing a box.

    • sign: function
      • Returns the sign of a number.

        Parameters

        • n: number

          Number whose sign is determined.

        Returns number

        -1 if the number is negative, 0 if the number is zero, 1 if the number is positive.

    • spanAngle: function
      • Angular span between a1 and a2 in direction dir.

        Parameters

        • a1: number

          Angle in degrees.

        • a2: number

          Angle in degrees.

        • dir: Coil

          Direction: Coil.CW or Coil.CCW.

        Returns number

        ...

    • sphere: function
      • 3D solid primitive: a sphere positioned relative to [0,0,0].

        Parameters

        • r: number

          Sphere radius

        Returns Shape

        Shape representing a sphere.

      • 3D solid primitive: a sphere positioned relative to [0,0,0].

        Parameters

        • r: number

          Sphere radius

        • an1: number

          First rotation angle in degrees

        Returns Shape

        Shape representing a sphere.

      • 3D solid primitive: a sphere positioned relative to [0,0,0].

        Parameters

        • r: number

          Sphere radius

        • an1: number

          First rotation angle in degrees

        • an2: number

          Second rotation angle in degrees

        Returns Shape

        Shape representing a sphere.

      • 3D solid primitive: a sphere positioned relative to [0,0,0].

        Parameters

        • r: number

          Sphere radius

        • an1: number

          First rotation angle in degrees

        • an2: number

          Second rotation angle in degrees

        • an3: number

          Third rotation angle in degrees

        Returns Shape

        Shape representing a sphere.

    • square: function
      • 2D square in the XOY plane.

        Parameters

        • a: number

          Square side length

        • Optionalcenter: boolean

          If true, the square is centered at [0,0,0]; otherwise, one corner is at [0,0,0].

        Returns Shape

        Shape representing a square

    • torus: function
      • 3D solid primitive: a torus positioned relative to [0,0,0].

        Parameters

        • r1: number

          Major torus radius

        • r2: number

          Minor torus radius

        Returns Shape

        Shape representing a torus

      • 3D solid primitive: a torus positioned relative to [0,0,0].

        Parameters

        • r1: number

          Major torus radius

        • r2: number

          Minor torus radius

        • ua: number

          Rotation angle along U

        Returns Shape

        Shape representing a torus

      • 3D solid primitive: a torus positioned relative to [0,0,0].

        Parameters

        • r1: number

          Major torus radius

        • r2: number

          Minor torus radius

        • va1: number

          Start angle along V

        • va2: number

          End angle along V

        Returns Shape

        Shape representing a torus

      • 3D solid primitive: a torus positioned relative to [0,0,0].

        Parameters

        • r1: number

          Major torus radius

        • r2: number

          Minor torus radius

        • va1: number

          Start angle along V

        • va2: number

          End angle along V

        • ua: number

          Rotation angle along U

        Returns Shape

        Shape representing a torus

    • unify: function
      • Simplifies the geometry by removing redundant edges and merging faces.

        Parameters

        • shp: Shape

          Shape to simplify

        Returns Shape

        Shape resulting from simplification

    • unite: function
      • Boolean operation: union of two or more shapes.

        Parameters

        • a: Shape

          First shape to unite

        • b: Shape

          Second shape to unite

        Returns Shape

        Shape resulting from the union

      • Boolean operation: union of two or more shapes.

        Parameters

        • shapes: Shape[]

          Array of shapes to unite

        Returns Shape

        Shape resulting from the union

    • vector3: function
      • Creates a 3D vector specifying a direction and length.

        Parameters

        • Optionalx: number

          Point x coordinate

        • Optionaly: number

          Point y coordinate

        • Optionalz: number

          Point z coordinate

        Returns Vector3

        Vector3 representing a three-dimensional vector.

      • Creates a 3D vector specifying a direction and length.

        Parameters

        • p: Point3

          Point defining the vector origin

        Returns Vector3

        Vector3 representing a three-dimensional vector.

      • Creates a 3D vector specifying a direction and length.

        Parameters

        • p1: Point3

          Start point of the vector

        • p2: Point3

          End point of the vector

        Returns Vector3

        Vector3 representing a three-dimensional vector.

    • wire: function
      • Creates wire geometry from a set of points or segments. Forms a polyline in space by connecting the supplied elements.

        Parameters

        • shapes: Shape[]

          Array of Shape objects (points, arcs, or segments) to connect in sequence.

        Returns Shape

        Shape representing the resulting polyline.