AcEdPreviewJig

A generic, TypeScript-based version of AutoCAD’s AcEdJig system for interactive previews during editor input.

This class manages a transient preview entity that updates dynamically as the user moves the cursor or provides other incremental input.

AutoCAD’s jig can sample different types of values:

  • a 3D point → during acquirePoint()
  • a distance → during acquireDistance()
  • an angle → during acquireAngle()

Using a generic type parameter T allows the jig to update entities based on different input types while sharing the same structure.

AutoCAD AcEdJig Method Purpose This Class
sampler() Sample new input update(value: T)
worldDraw() Draw geometry render()
startJig() Begin preview setEntity()
drag() Main loop Controlled externally via JS events

The preview entity may optionally implement:

onJigUpdate(value: T): void

When present, the jig will call it whenever the input changes.

  • Point acquisition (T = AcGePoint3d)
  • Distance jig (T = number)
  • Angle jig (T = number)

Example:

const jig = new AcEdPreviewJig<AcGePoint3d>(view)
jig.setEntity(circleEntity)
await editor.getPoint("Specify center:", { jig })

Hierarchy (View Summary)

Constructors

Accessors

Methods

Constructors

Accessors

Methods

  • Find the point p2 on a line starting from p1 at a specified angle and at a distance length from p1.

    Parameters

    • p1: AcGeVector2dLike

      The start point of the line.

    • angle: number

      The angle of the line in radians relative to the x-axis.

    • length: number

      The distance from p1 to p2.

    Returns AcGeVector2dLike

    Return the point p2.

  • Update the preview entity based on incremental input.

    This method replaces the older updatePoint() and now accepts any type T, enabling use for point, distance, angle, or custom parameter updates.

    This function performs the conceptual role of AutoCAD’s sampler(): the editor triggers this method whenever the user’s input changes.

    If the preview entity implements:

    onJigUpdate(value: T)
    

    then it will be invoked here to recompute geometry.

    Parameters

    • point: AcGeVector3dLike

      Incremental value of type T describing new jig input. Examples: - world point - radius/distance - angle in radians

    Returns void