KJDRAW / USING THE WORKBENCH
Using the workbench
Open a drawing, create and modify geometry with exact coordinates, then save the result.
Talk to a drawing model#
Open AI Chat in the side panel to describe a drawing or ask for changes. The conversation keeps a bounded recent history in memory. Enter sends, Shift+Enter adds a line, and Stop cancels the current request. Starting a new conversation or opening another drawing clears the current conversation and cancels pending proposals.
Use Connect model to choose the protocol, model name and your application's same-origin server endpoint. Keys stay on that server. Sending a message shares your request and queried drawing data with the configured model. For local setup, follow model proxy setup. The public static demo does not connect to a model; choose Local examples to explore preset workflows without one.
The chat displays drawing reads, measurements and proposal activity. A proposed edit appears as a review card: Preview on drawing, Apply changes, or Discard. Applied changes can be undone or saved as a KJP project. Every model operation runs through a bounded CAD tool and produces structured results; model text alone is never treated as an execution receipt. Request a fresh proposal after the drawing changes.
Open a drawing#
Open the Live Demo and choose an industry drawing, or choose Open to load a DXF, KJD or KJP file. You can also drag a supported file onto the canvas. The embedded editor opens DXF and KJD; the Demo project workspace also opens multi-drawing KJP packages.
The active drawing appears in the title area. Choose Fit view after opening a file if the geometry is outside the current view. Opening a file replaces the current Demo workspace, so save edits you want to keep first.
To start empty in the Demo, choose + beside the drawing tabs, give the drawing a name and select its units. The new drawing is added to the current project; existing drawings remain available.
The drawing workflow#
Choose a drawing tool from the Ribbon or the Drawing tool list. Tool-specific settings appear in the options bar or drawing dialog. Set these before picking points, then follow the prompt above the command bar.
- Click the canvas to accept the prompted point.
- Enter a coordinate in the command bar to place the same point exactly.
- Press Backspace or choose Undo point to remove the last uncommitted point.
- For a polyline, spline or hatch, press Enter or choose Finish when enough points have been accepted. Press C or choose Close when the tool offers a closed result.
- Press Esc to cancel the current operation and return to Select. No entity is added and no undo entry is created.
After a fixed-length object such as a line or circle is created, the same tool remains ready for the next object. Press Esc when you are finished drawing.
Enter exact coordinates#
While a drawing or point-driven modification is active, use one of these forms in the command bar:
| Input | Meaning |
|---|---|
100,50 | Absolute point X=100, Y=50 |
@40,-10 | 40 units right and 10 units down from the last accepted point |
@25<30 | 25 units from the last point at 30 degrees |
Polar angles are measured in degrees, counter-clockwise from the positive X axis. Relative input needs an earlier point in the current operation. Typed coordinates are exact; canvas picks can use the Snap and Ortho controls.
Example: choose Line, enter 100,50, then enter @40<0. This creates a 40-unit horizontal line from (100,50) to (140,50).
Create basic geometry#
| Tool | Point order and finish action |
|---|---|
| Point | Position |
| Line | Start, endpoint |
| Rectangle | First corner, opposite corner |
| Polyline | Two or more vertices; Enter keeps it open, C closes it |
| Polygon | Center, one vertex on the circumscribed circle; set Sides first |
| Ray | Origin, direction point |
| Construction line | Origin, direction point; extends in both directions |
Ray and construction-line tools do not create an object when selected or when placing the origin. Moving the pointer shows a finite direction guide. The second point commits the infinite construction line (or one-way ray); Esc before confirmation removes the preview without changing the drawing.
Confirmed construction lines and rays export as native XLINE/RAY in DXF 2000–2024, including their space ownership and 3D direction. R12/R14 export is outside this supported subset. Rendering clips each line to the current viewport, so a distant origin does not make a line disappear when you pan or zoom.
Fit view frames finite geometry without including construction-line or ray origins, including guides inside blocks. If the drawing only contains guides, it centers the first visible guide origin and keeps the current zoom.
For example, to make a closed outline, choose Polyline, enter 0,0, @80,0, @0,50, @-80,0, then press C. The outline is committed as one closed polyline and can be undone in one step.
Circles, arcs and ellipses#
Choose the construction mode before placing points:
- Circle · Center / radius: center, then a point on the circle. In the Demo, after picking the center you may also enter a positive radius such as
25. - Circle · Two points: the two endpoints of a diameter.
- Circle · Three points: three different, non-collinear points on the circle.
- Arc · Center / start / end: center, start point, end point. The arc runs counter-clockwise from start to end.
- Arc · Three points: start, a point the arc must pass through, then end.
- Ellipse: center, major-axis endpoint, then a third point that sets the perpendicular minor-axis distance.
Coincident points, a zero radius and three collinear circle points are rejected. Correct the last point and try it again; the earlier accepted points remain available until you cancel.
Splines and hatches#
For a Spline, choose the degree first. Pick at least degree + 1 control points, then press Enter to finish. Use Backspace to revise the last control point before committing. C produces a closed spline when enough points are available.
For a Hatch, choose SOLID, ANSI31 or ANSI37 and set the scale before drawing the boundary. Pick at least three boundary vertices, then press Enter or C. KJDraw closes the boundary when it creates the hatch. ANSI31 is a single diagonal pattern; ANSI37 is a crossed diagonal pattern. In the embedded drawing dialog, clear Solid fill when choosing a line pattern.
Each hatch operation accepts one polygon boundary. Draw separate hatches for separate regions.
Imported DXF hatches use their actual line definitions, including custom names, dashed lines, dots and staggered row origins. Polygon/bulge and LINE/ARC boundaries use even-odd hole clipping. Moving, rotating, uniformly scaling or mirroring a hatch transforms its pattern with its boundary; saving DXF retains the transformed definition. Ellipse/spline hatch boundaries and nonstandard collinear dash offsets remain unsupported. Very dense patterns draw partially within a bounded work budget; the editor prompts you to zoom in. A partial pattern is not complete plotting output.
For an application-defined pattern, supply patternLines in drawing coordinates: each line has an angle in radians, base: [x,y], offset: [dx,dy] and signed dashes (positive stroke, negative gap, zero dot; [] is continuous). These values already include the current patternAngle/patternScale. Store those settings as patternDefinitionAngle/patternDefinitionScale if your application will later change the global settings without rewriting the definitions. The renderer's report.hatchDiagnostics identifies budget, unsupported-pattern or unsupported-boundary limitations by entity ID.
Add dimensions#
Choose Dimension, select a type, and follow this point order:
| Type | Point order |
|---|---|
| Aligned | First measured point, second measured point, dimension-line position |
| Linear / rotated | First measured point, second measured point, dimension-line position; set the direction or rotation first |
| Radius | Circle center, point on the circle |
| Diameter | One diameter endpoint, opposite endpoint |
The displayed measurement is calculated from the accepted geometry. In the Demo, Text height controls the annotation size.
Select, move and copy#
Click the edge of an object to select it. Shift adds to the selection; Ctrl (or Command on macOS) removes from it. The Properties panel shows the primary object and the selection count.
Drag from empty canvas to select several objects:
| Gesture | Result |
|---|---|
| Left to right · blue solid frame | Select objects entirely inside the window |
| Right to left · green dashed frame | Select objects inside or intersecting the frame |
| Shift + drag | Add the result to the existing selection |
| Ctrl / Command + drag | Remove the result from the existing selection |
| Ctrl / Command + A, with the editor focused | Select editable, visible objects in the current drawing space |
The frame tests the drawing geometry, not just overlapping object bounds. A small frame inside an empty circle does not select the circle. Esc cancels an unfinished frame without changing the selection.
To select objects along an open path, enter FENCE in the command line, pick two or more points, then press Enter. Backspace removes the last point; Esc cancels. The path is not automatically closed.
When one editable object is selected, its blue square grips appear. Drag a line endpoint, a circle quadrant, or a polyline vertex to reshape it. The highlighted preview is temporary; releasing the pointer commits one edit. Undo restores the previous geometry. Dragging a selected object away from its grips moves it as a whole.
Hidden and frozen layers are excluded from picking. Locked layers remain visible, but cannot be selected for editing or modified by editing commands. Unlock, thaw or show the layer before editing it. If the drawing, revision or view changes during a drag, the pending drag is cancelled.
Choose Move, click a base point, then click the destination. You can also choose Move before selecting an object. The blue preview is temporary; the destination creates one undoable edit. Copy uses the same two-point workflow, keeps the originals and selects the new objects.
For an exact displacement, select the objects and enter MOVE 10 0 or COPY 10 0. M or COPY without coordinates starts the interactive tool. You can also drag an already selected object to move the selection.
Modify geometry#
Select the objects first, then choose More editing tools. Enter the parameters and continue on the canvas when prompted. Until the command commits, the selected IDs, drawing and revision stay fixed; Esc cancels the pending operation.
Selection order matters for operations that pair a target with boundaries or two lines:
| Operation | Selection and point order |
|---|---|
| Rotate / Scale | Select one or more objects, enter angle or factor, then pick the center |
| Mirror | Select one or more objects, choose whether to erase the source, then pick two axis points |
| Rectangular array | Select one or more objects, then enter rows, columns and their spacing |
| Polar array | Select one or more objects, enter count and fill angle, then pick the center |
| Offset | Select exactly one LINE, RAY, XLINE, CIRCLE or ARC; enter distance, then pick the offset side |
| Break | Select exactly one LINE or ARC, then pick the break point |
| Explode | Select one polyline-compatible object; no canvas point is required |
| Trim · Single edit | Select a LINE, ARC or CIRCLE first, Shift-select the cutting boundaries, choose Single edit, then pick the portion to remove |
| Extend · Single edit | Select a LINE or ARC first, Shift-select the limiting boundaries, choose Single edit, then pick near the end to extend |
| Chamfer / Fillet | Select exactly two LINE objects in order, enter distances or radius, then pick the side to keep on the first line and the second line |
To control selection order, click the first object normally, then Shift-click each additional object. If the order is wrong, click empty canvas to clear the selection and select again.
Trim keeps both remaining sides when you remove an interior interval of a line or arc. Trimming a circle produces a native arc; Undo restores the original circle. Circular editing supports boundaries made from lines, rays, infinite lines, circles and arcs in the same XY plane. A circle needs two distinct cutting points. Pick inside the portion, not exactly at an intersection or at the circle center.
To extend an arc, pick near the endpoint you want to move. The arc reaches the nearest boundary along that end's continuation without crossing its opposite endpoint. Pick again if the prompt reports an ambiguous point, or press Esc to cancel.
Trim or extend several objects#
Use Continuous mode to reuse the same boundaries across several edits. This workflow is available in both the Live Demo and the embedded editor.
- Choose Trim or Extend, then choose continuous mode. Alternatively, enter
TRIMorEXTENDwithout arguments in the command bar. - Click the cutting boundaries. Further clicks add boundaries; Ctrl / Command + click removes one. You can also window-select them. A visible, locked boundary can be used without unlocking it.
- Press Enter or choose Confirm boundaries. The prompt now asks for targets.
- Hover over a line, arc or circle to preview the retained geometry, then click the portion to remove. For Extend, hover and click near the line or arc endpoint to extend. Hovering never changes the drawing or undo history.
- Continue clicking other targets. Each successful click is a separate undo step. Invalid or ambiguous picks show a prompt; pick another portion or end to retry.
- Press Enter or choose Finish to end the tool. Esc also ends the pending operation; it does not undo already completed edits.
The options bar shows the current phase and number of completed edits. Switching language keeps your boundaries. Switching drawings or layouts, undoing, or modifying the drawing through another tool ends the session so a pending pick cannot affect a different drawing state.
Single-edit mode remains available for target-first selection. When at least two objects are already selected, the tool dialog defaults to that mode; otherwise it defaults to continuous mode. Choose explicitly when the preselection is intended as boundaries rather than a target and boundaries.
For applications that supply their own UI or Agent, see geometric previews and reviewed edits. The same public session API drives both workbenches.
Undo, navigate and save#
Use Undo and Redo to step through committed drawing and modification commands. Removing an uncommitted draft point is different: use Backspace or Undo point before the object is created.
The canvas toolbar contains Select, Pan, Fit view, Zoom in and Zoom out. With Pan selected, drag using the left mouse button. Middle-button dragging also pans, and the mouse wheel zooms. Navigation does not modify geometry or add undo history.
In the Demo, Save KJP downloads the whole project and DXF exports the active drawing. In an embedded editor, Save KJD preserves native drawing data and Export DXF creates an exchange file. Reopen the saved file when you want to verify the result. Downloading a file does not configure background cloud storage.
Choose a layout#
Choose the layout that matches the task:
| Layout | Best for |
|---|---|
| Classic | Familiar Ribbon tools and visible panels |
| Compact | More canvas space with a shorter horizontal toolbar |
| Focus | Reviewing drawings or using commands, with Ribbon and side panels hidden |
The layout selector remains available in Focus. Switching layouts preserves the editor, drawing, selection and undo history. The Demo remembers the choice in this browser. Embedded instances keep their own layout; the host application decides whether to persist it.
const editor = createKJDrawEditor('#cad', { layout: 'classic' })
await editor.ready
editor.setLayout('compact')
If an operation does not work#
- Read the prompt above the command bar. The tool may still be waiting for an object, a base point or another vertex.
- If a relative coordinate is rejected, enter the first point as
x,ybefore using@dx,dyor@distance<angle. - For a variable-length tool, make sure the minimum number of points has been accepted before pressing Enter or C.
- For continuous Trim/Extend, confirm the boundaries before clicking targets. In single-edit mode, select the target first and the boundaries afterwards. For Chamfer and Fillet, select exactly two LINE objects.
- If a drawing tool rejects a point as degenerate, choose a different last point. Use Esc only when you want to discard the whole in-progress object.
- Check layer visibility and choose Fit view if a created or opened object is outside the current view.