MotorXP-PM Scripting API
    Preparing search index...

    Interface Geom

    Built-in Geom object

    interface 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: Point2, p2: Point2): 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): Point2;
        helperPiece(shp: Shape, color?: number | Color): Piece;
        helperPiece(pt: Point3, radius?: number, color?: number | Color): Piece;
        infplane(pos?: Point3, dir?: Vector3): Shape;
        intersect(a: Shape, b: Shape): Shape;
        intersect(shapes: Shape[]): Shape;
        intersectionCircle2Circle2(
            c1: Point2,
            r1: number,
            c2: Point2,
            r2: number,
        ): Point2[];
        intersectionSegment2Circle2(
            p1: Point2,
            p2: Point2,
            c: Point2,
            r: number,
        ): Point2[];
        intersectionSegment2Segment2(
            p1: Point2,
            p2: Point2,
            q1: Point2,
            q2: Point2,
        ): Point2[];
        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: number | Color | AnyPart): Piece;
        point2(x?: number, y?: number): Point2;
        point3(x?: number, y?: number, z?: number): Point3;
        point3(p: Point2, 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: Point2, p2: Point2, t: number): Point2;
        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,
            infiniteLine?: boolean,
        ): Point3;
        projectToSegmentXY(
            p: Point3,
            p1: Point3,
            p2: Point3,
            infiniteLine?: boolean,
        ): Point3;
        projectToSegmentXZ(
            p: Point3,
            p1: Point3,
            p2: Point3,
            infiniteLine?: boolean,
        ): Point3;
        projectToSegmentYZ(
            p: Point3,
            p1: Point3,
            p2: Point3,
            infiniteLine?: boolean,
        ): 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;
    }
    Index

    Methods

    • 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.

    • Angle between vectors.

      Parameters

      Returns number

      Angle between vectors in degrees.

      Use angleBetweenVectors instead.

    • Angle between vectors.

      Parameters

      Returns number

      Angle between vectors in degrees.

    • 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.

    • 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.

    • 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.

    • 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.

    • Returns the bounding box of a shape.

      Parameters

      Returns BoundingBox

      Bounding box of the shape.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • Converts radians to degrees.

      Parameters

      • radians: number

        Angle in radians.

      Returns number

      Angle in degrees.

    • Converts degrees to radians; same as rad.

      Parameters

      • degrees: number

        Angle in degrees.

      Returns number

      Angle in radians.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • Rounds to an integer and makes it even.

      Parameters

      • v: number

        Number.

      Returns number

      Even integer.

    • Fills a closed wire by creating a face from it.

      Parameters

      Returns Shape

      Shape representing a face.

    • 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.

    • 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.

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

      Parameters

      • radius: number

        Radius.

      • angle: number

        Angle in degrees.

      Returns Point2

      Point in Cartesian coordinates.

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

      Parameters

      • shp: Shape

        Geometric shape of the piece.

      • Optionalcolor: number | Color

        Piece color: a Qt.* constant or a Color object (for example, Qt.rgba()).

      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: number | Color

        Piece color: a Qt.* constant or a Color object (for example, Qt.rgba()).

      Returns Piece

      Piece representing a helper motor part.

    • 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.

    • 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.

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

      Parameters

      • c1: Point2

        Center of circle 1.

      • r1: number

        Radius of circle 1.

      • c2: Point2

        Center of circle 2.

      • r2: number

        Radius of circle 2.

      Returns Point2[]

      Array of circle intersection points.

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

      Parameters

      • p1: Point2

        First endpoint of segment p.

      • p2: Point2

        Second endpoint of segment p.

      • c: Point2

        Circle center.

      • r: number

        Circle radius.

      Returns Point2[]

      Array of segment-circle intersection points.

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

      Parameters

      • p1: Point2

        First endpoint of segment p.

      • p2: Point2

        Second endpoint of segment p.

      • q1: Point2

        First endpoint of segment q.

      • q2: Point2

        Second endpoint of segment q.

      Returns Point2[]

      Array of intersection points of segments p and q.

    • 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.

    • 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.

    • 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.

    • 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.

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

      Parameters

      • v: number

        Number.

      Returns boolean

      True if the number is even.

    • 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.

    • 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.

    • 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.

    • 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.

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

      Parameters

      • v: number

        Number.

      Returns boolean

      True if the number is odd.

    • 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.

    • 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.

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

      Parameters

      • a: number

        Angle in degrees.

      Returns number

      Normalized angle in (0°, 360°).

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

      Parameters

      • a: number

        Angle in degrees.

      Returns number

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

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

      Parameters

      • a: number

        Angle in degrees.

      Returns number

      Normalized angle in (0°, 360°).

    • Rounds to an integer and makes it odd.

      Parameters

      • v: number

        Number.

      Returns number

      Odd integer.

    • Creates a motor piece from a geometric shape and a part (material assignment).

      Parameters

      • shp: Shape

        Geometric shape of the piece.

      • material: number | Color | AnyPart

        Part created by GeneralPart(), IronPart(), ... or a color (a Qt.* constant or a Color object) for a custom colored piece.

      Returns Piece

      Piece representing a motor part.

    • Creates a 2D point.

      Parameters

      • Optionalx: number

        Point x coordinate.

      • Optionaly: number

        Point y coordinate.

      Returns Point2

      Point in Cartesian coordinates.

    • 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: Point2

        Point with coordinates [x,y].

      • Optionalz: number

        Point z coordinate.

      Returns Point3

      Point3 representing a point in three-dimensional space.

    • 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).

    • 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).

    • 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).

    • 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).

    • 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: Point2

        First endpoint of the segment.

      • p2: Point2

        Second endpoint of the segment.

      • t: number

        Segment parameter, usually from 0 to 1.

      Returns Point2

      Point on the segment.

    • 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).

    • 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: 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.

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

      Parameters

      Returns Point3

      Point3 representing the projection onto the shape.

    • 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.

      • OptionalinfiniteLine: boolean

        If true, projects onto the infinite line through p1 and p2; if false, returns the nearest point of the segment.

      Returns Point3

      Point3 representing the projection onto the segment.

    • 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.

      • OptionalinfiniteLine: boolean

        If true, projects onto the infinite line through p1 and p2; if false, returns the nearest point of the segment.

      Returns Point3

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

    • 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.

      • OptionalinfiniteLine: boolean

        If true, projects onto the infinite line through p1 and p2; if false, returns the nearest point of the segment.

      Returns Point3

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

    • 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.

      • OptionalinfiniteLine: boolean

        If true, projects onto the infinite line through p1 and p2; if false, returns the nearest point of the segment.

      Returns Point3

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

    • Converts degrees to radians.

      Parameters

      • degrees: number

        Angle in degrees.

      Returns number

      Angle in radians.

    • Converts radians to degrees; same as deg.

      Parameters

      • radians: number

        Angle in radians.

      Returns number

      Angle in degrees.

    • 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].

    • 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].

    • 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].

    • 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].

    • 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.

    • 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.

    • Rounds value to the specified precision.

      Parameters

      • value: number

        Number.

      • precision: number

        Unknown

      Returns number

      Number rounded to the specified precision.

    • 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.

    • 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.

    • Returns the solid corresponding to the bounding box.

      Parameters

      Returns Shape

      Shape representing a box.

    • 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.

    • 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

      ...

    • 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.

    • 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

    • 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

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

      Parameters

      • shp: Shape

        Shape to simplify

      Returns Shape

      Shape resulting from simplification

    • 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

    • 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.

    • 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.