Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/usage-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ String: ImGui `.ini` text for window positions and docking saved with **SaveIniS
| `edge_dim_arrow_orientation` | integer | **0** automatic, **1** internal, **2** external. |
| `show_sketch_dimensions` | boolean | When false, hides length dimensions on all sketches. |
| `permanent_node_anno_scale` | number | Scale for permanent **+** markers: the sketch **Origin** and user-placed Add node points ([Sketch origin](usage-sketch.md#sketch-origin); **0.25** to **3.0**; default **1.0**). |
| `origin_marker_color` | array of 3 numbers | RGB color for the **active** sketch's Origin marker (+ with circle; **0** to **1** per channel; default cyan **0.0**, **0.75**, **1.0**). |
| `snap_guide_color_node` | array of 3 numbers | RGB for snap guides when both axes lock to the same node (float **0** to **1**; default lavender **0.82**, **0.55**, **0.95**). Legacy `snap_guide_color` loads here when `snap_guide_color_node` is absent. |
| `snap_guide_color_axis` | array of 3 numbers | RGB for snap guides when aligned on X or Y only (float **0** to **1**; default magenta **0.96**, **0.06**, **0.54**). Legacy `snap_guide_color` sets both node and axis colors. |
| `snap_guide_mode` | integer | **0** *Traditional* (local markers), **1** *Fullscreen* (view-spanning axis lines), **2** *Both* (default **2**). |
Expand Down
18 changes: 11 additions & 7 deletions docs/usage-sketch.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,25 @@ See [Sketch origin](#sketch-origin) — every sketch includes one permanent refe
(sketch-origin)=
## Sketch origin

**Every sketch has exactly one Origin** — a fixed reference point on the sketch plane, shown as a red **+** marker whenever the sketch is visible in sketch mode (and in tools such as **polar duplicate** that snap to sketch nodes).
**Every sketch has exactly one Origin** — a fixed reference point on the sketch plane, shown as a **+ inside a circle** on the **active sketch only** (a **permanent node**, not placed with a tool) whenever that sketch is visible in sketch mode (and in tools such as **polar duplicate** that snap to sketch nodes). User-placed [Add node](#add-node-tool) points use a red **+** without a circle on every visible sketch. Color is set in **Settings -> Sketch -> Origin marker color**.

| | |
| ---: | --- |
| **When created** | Added automatically when the sketch is created; you do not place it with a tool. |
| **Location (reference plane)** | Sketch plane coordinates **(0, 0)** — the plane's built-in reference origin (XY, XZ, YZ, or offset reference planes). |
| **Location (from face)** | **Center of the bounding box** of the face boundary wire when you use [Create sketch from planar face](#create-sketch-from-planar-face-tool). |
| **Sketch List** | Listed as **Origin** under **Nodes** when you expand a sketch row (see [Sketch List](usage.md#sketch-list)). |
| **Snapping** | Acts like any other sketch vertex: axis guides, vertex lock, and distance snap apply. Origins from **other visible sketches** are also snap targets on the current plane. |
| **Cannot delete** | Unlike [Add node](#add-node-tool) points, the Origin cannot be removed from the selection. |
| **Snapping** | Acts like any other sketch vertex when the marker is shown: axis guides, vertex lock, and distance snap apply. Origins from **other visible sketches** (with marker shown) are also snap targets on the current plane. When **Show origin marker** is off, the Origin is not a snap target. |
| **Cannot delete** | The Origin cannot be selected or deleted. Hide it with **Show origin marker** in **Sketch properties** instead. |
| **Marker size** | **Settings -> Sketch -> Permanent node annotation size** (`permanent_node_anno_scale`; see [usage-settings.md](usage-settings.md#settings-file-reference)). |
| **Marker color** | **Settings -> Sketch -> Origin marker color** (`origin_marker_color`; active sketch only). |
| **Sketch properties** | **Sketch List -> [P]** — **Show origin marker**, **Position** sliders (range follows the current view) with **Set** for typed values. |

**Tips**

- Use the Origin as a stable anchor when you need a known center (especially on [face-derived](#create-sketch-from-planar-face-tool) sketches).
- If the **+** is hard to see, increase **Permanent node annotation size** in Settings.
- Open **Sketch properties** (**[P]** on the sketch row) to drag **X** / **Y** sliders (view-relative range) or use **Set** beside each slider, type a value, and press **Enter**.
- While an **operational axis** is active in mirror/revolve phase, **+** markers (including Origin) are temporarily hidden so edge and face selection stays clear; they return when you **Clear axis** or leave that mode.

## Sketch snapping
Expand All @@ -70,9 +73,10 @@ While you draw or place points in sketch mode, EzyCad helps you align to existin
| **Snap distance** | Larger **Snap dist** values let snaps engage from farther away (screen pixels, converted to the sketch plane at the cursor). |
| **Snap guides** | **Snap guide mode**: *Traditional* (local markers at guide intersections), *Fullscreen* (view-spanning axis lines), or *Both*. **Snap guide color (node)** is used when both X and Y align to the same vertex; **Snap guide color (axis)** when only one axis aligns. A separate checkbox **All co-axial nodes** (in the sketch Options panel and in Settings) enables *global* mode: when on, full horizontal and vertical guide lines + markers are shown for *all* nodes in the current sketch and all other visible sketches (the complete set of co-axial alignments). When off (default), only the closest node per active axis is annotated (classic closest-relative behavior). |
| **Axis alignment** | Near a snap target, the pick can align to that point's **X** or **Y** on the sketch plane; guides show which axis is active. When **both** axes align to the **same** point, the cursor **locks to that vertex**. |
| **Sketch origin** | Each sketch's built-in **Origin** (see [Sketch origin](#sketch-origin)) is a snap target when its marker is shown. |
| **Mid-point snap (Add node)** | A click near a **straight** edge (not at its ends) snaps onto the segment and **splits** it at commit time (see [Add node tool](#add-node-tool)). Separate from vertex lock. |
| **Automatic splitting on edge intersections** | When you add a new straight (linear) edge using the Line Edge tool or Multi-Line Edge tool, if it crosses or touches the interior of any existing straight edge, the existing edge is automatically split at the intersection point. The new edge is also subdivided into atomic segments where needed. The same splitting occurs when an endpoint of the new edge snaps to the midpoint of an existing edge. When you add an **arc segment**, existing straight and arc edges are split at interior crossings, and the new arc is subdivided at intersection points on its interior. This produces correct T-junctions, crossings, and cleanly divided faces from a single sketch. |
| **Other visible sketches** | Nodes from **other visible sketches** are projected onto the current sketch plane and act as snap targets (same distance rules). Each of those sketches contributes its **Origin** as well as any user-placed nodes. Useful for multi-sketch layouts and tools such as **polar duplicate** that pick sketch points. |
| **Other visible sketches** | Nodes from **other visible sketches** are projected onto the current sketch plane and act as snap targets (same distance rules). Each visible sketch contributes its **Origin** when that sketch's marker is shown, plus any user-placed nodes. Useful for multi-sketch layouts and tools such as **polar duplicate** that pick sketch points. |
| **Operational axis mode** | While an operational axis is **defined** and **Operational axis** mode is active (mirror/revolve phase), sketch snap and permanent **+** node markers are **suppressed** so edge and face selection stays clear. Normal snapping applies again after **Clear axis** or when you leave the tool. Axis placement (before the axis exists) still uses snap. |

**Angle constraint:** When a line or add-node rubber band has an active angle constraint, vertex and axis snap may be disabled or relaxed so the typed angle stays exact (see each tool's section).
Expand Down Expand Up @@ -882,9 +886,9 @@ In both cases, Add node never leaves a **permanent edge** between two clicks the

### Permanent “+” markers

Each sketch includes a built-in **Origin** (see [Sketch origin](#sketch-origin)) — always shown as a permanent **+** when the sketch is visible.
Each sketch includes a built-in **Origin** (see [Sketch origin](#sketch-origin)) — shown as a permanent **+ inside a circle** on the **active sketch** when enabled in **Sketch properties**.

Nodes you place with **Add node** are treated as **user-placed** points. When the sketch is visible, eligible points can show the same small **+** marker in the 3D view so you can see and pick them; you can delete user-placed markers from the selection. Geometry that exists only as automatic **edge midpoints** for snapping is separate (those nodes are not shown the same way; controlled by the **Add midpoints to new linear edges** setting in Settings > Sketch, default off).
Nodes you place with **Add node** are treated as **user-placed** points. When the sketch is visible, eligible points can show a red **+** marker in the 3D view so you can see and pick them; you can delete user-placed markers from the selection. Geometry that exists only as automatic **edge midpoints** for snapping is separate (those nodes are not shown the same way; controlled by the **Add midpoints to new linear edges** setting in Settings > Sketch, default off).

### How to use

Expand Down Expand Up @@ -938,7 +942,7 @@ The create sketch from planar face tool allows you to extract the boundary of a
3. **Sketch Created**: A new sketch is automatically created with:
- The face boundary as the initial wire
- The sketch plane aligned with the face plane
- A permanent **Origin** **+** marker at the **center of the face boundary's bounding box** (a fixed reference on the sketch plane)
- A permanent **Origin** marker (**cyan + inside a circle**) at the **center of the face boundary's bounding box** (a fixed reference on the sketch plane)
- The sketch name set to "Sketch from face"
4. **Edit Sketch**: You can now edit the sketch using standard sketch tools (add edges, modify geometry, etc.)

Expand Down
23 changes: 20 additions & 3 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ EzyCad (Easy CAD) is an open-source CAD application for hobbyist machinists to d
- [View and manage 2D sketches](#sketch-list)
- [Select and edit sketch elements](#sketch-list)
- [Toggle sketch visibility](#sketch-list)
- [Sketch origin (permanent + reference point per sketch)](usage-sketch.md#sketch-origin)

4. **Shape List**
- [List 3D solids, materials, and display options](#shape-list)
Expand Down Expand Up @@ -92,7 +93,7 @@ Each row is laid out left to right:
- **Rename** - Click the name field and type a new name.
- **Visibility** - Checkbox to show or hide the sketch in the 3D view.
- **Underlay** - Checkbox to show or hide an [image underlay](usage-sketch.md#image-underlay) when one is imported (disabled until an underlay exists; tooltip *Display underlay*).
- **Sketch properties** - **`[P]`** opens **Sketch properties** (import/remove underlay, calibration, transform). See [Image underlay](usage-sketch.md#image-underlay).
- **Sketch properties** - **`[P]`** opens **Sketch properties** (sketch **Origin** X/Y, import/remove underlay, calibration, transform). See [Sketch origin](usage-sketch.md#sketch-origin) and [Image underlay](usage-sketch.md#image-underlay).
- **Delete** - Right-click the name and choose **Delete**.

When expanded, the row shows:
Expand Down Expand Up @@ -213,7 +214,7 @@ EzyCad uses a workflow-based approach to 3D modeling: start with 2D sketches, th

The typical modeling workflow in EzyCad follows these steps:

1. **Create a 2D Sketch**: Use the [2D Sketching tools](usage-sketch.md) to draw 2D geometry on a sketch plane. Sketches consist of edges (lines, arcs, circles) that form closed shapes called faces.
1. **Create a 2D Sketch**: Use the [2D Sketching tools](usage-sketch.md) to draw 2D geometry on a sketch plane. Sketches consist of edges (lines, arcs, circles) that form closed shapes called faces. Every new sketch also gets a built-in **[Origin](usage-sketch.md#sketch-origin)** — a permanent **+** reference point on the plane (at `(0, 0)` on a reference plane, or at the face center when created from a planar face).

2. **Extrude the Sketch**: Use the [Extrude tool](#extrude-sketch-face-tool-e) to convert 2D sketch faces into 3D solid shapes by extending them perpendicular to the sketch plane.

Expand All @@ -226,6 +227,7 @@ The typical modeling workflow in EzyCad follows these steps:
| | |
| ---: | --- |
| **Sketches** | 2D drawings on a plane that define the profile of your 3D shape |
| **Origin** | One permanent **+** reference node per sketch ([details](usage-sketch.md#sketch-origin)); snap target; listed as **Origin** in the Sketch List |
| **Faces** | Closed regions within a sketch that can be [extruded](#extrude-sketch-face-tool-e) into 3D |
| **Shapes** | 3D solid objects created from extruded sketch faces |
| **Feature Operations** | Transform sketches into 3D geometry or modify existing 3D shapes |
Expand Down Expand Up @@ -285,13 +287,28 @@ For detailed information on creating 2D geometry, see the [2D Sketching](usage-s

### 2D Sketching

#### Sketch origin (permanent reference point)

Every sketch has exactly one **Origin**: a fixed point on the sketch plane, shown as a **+ inside a circle** on the **active sketch only** in sketch mode (distinct from red **+** [Add node](usage-sketch.md#add-node-tool) markers on visible sketches; you cannot delete the Origin).

| | |
| ---: | --- |
| **Reference-plane sketch** | Origin at plane coordinates **(0, 0)**. |
| **Sketch from planar face** | Origin at the **bounding-box center** of the extracted face boundary. |
| **Sketch List** | Listed as **Origin** under **Nodes** when you expand a sketch row. |
| **Sketch properties** | **[P]** on the sketch row: **Show origin marker**, **Position** sliders with **Set**, for typed values. |
| **Snapping** | Full vertex and axis snap when the marker is shown; other visible sketches' origins snap when their marker is shown. |

Full details (marker size, operational-axis visibility, tips): **[Sketch origin](usage-sketch.md#sketch-origin)** in the 2D sketching guide.

See the **[2D Sketching guide](usage-sketch.md)** for full documentation of sketch tools: **[sketch origin](usage-sketch.md#sketch-origin)** (one permanent **+** reference point per sketch), **add node** (points and edge splits), line and multi-line edges, circles, arcs, rectangles, squares, slots, **operation axis** (with Mirror and Revolve actions in the Options panel), edge dimensions, and creating a sketch from a planar face. Revolve (via an operation axis) is one way to generate 3D solids directly from sketch geometry.

**Sketch snap (overview):** While drawing or using **Add node**, picks can snap to existing geometry within **Snap dist** (Options panel). The main behaviors:

| | |
| ---: | --- |
| **Vertex snap** | Lock to an existing corner when horizontal and vertical axis guides both align to the same point. |
| **Sketch origin** | Every sketch's built-in **Origin** is a snap target when its marker is shown (see [Sketch origin](usage-sketch.md#sketch-origin)). |
| **Mid-point snap** | With **Add node**, a click near a **straight** edge (but not at its ends) snaps onto the segment; EzyCad places a new vertex there and **splits** the edge into two. You do not need to hit the line exactly. |
| **Edge midpoint** | Straight edges often expose a geometric **midpoint** as a snap target while drawing; that is separate from mid-point snap and from user-placed **+** nodes. |

Expand Down Expand Up @@ -732,7 +749,7 @@ More context on the 3D viewer stack: **[3D viewer (Open CASCADE)](usage-occt-vie
- [This usage guide](#ezycad-usage-guide) (source: [usage.md](usage.md))
- [Settings](usage-settings.md) (Settings pane, View menu, JSON settings file, startup project)
- [3D viewer (Open CASCADE)](usage-occt-view.md)
- [2D Sketching](usage-sketch.md) (including [add node](usage-sketch.md#add-node-tool) and [image underlay](usage-sketch.md#image-underlay))
- [2D Sketching](usage-sketch.md) (including [sketch origin](usage-sketch.md#sketch-origin), [add node](usage-sketch.md#add-node-tool), and [image underlay](usage-sketch.md#image-underlay))
- [Scripting (Lua / Python)](scripting.md)

The markdown files in the repository remain the canonical source; Read the Docs publishes them on each update. Video tutorials are not published yet.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/sketch.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Typical uses:
- A `Sketch` is owned by `Occt_view` (`Sketch_list m_sketches`, current sketch `m_cur_sketch`). Use `Sketch_ptr` (`std::shared_ptr<Sketch>`) when sharing.
- The constructor **`Occt_view& view` must outlive the sketch**. The sketch holds references to `m_view` and `m_ctx` (the OCCT interactive context).
- Each sketch receives a stable **`m_id`** from `Occt_view::allocate_sketch_id()`. Display names (`m_name`) may duplicate; undo deltas and file I/O key off `get_id()`.
- Each sketch has an **origin node** (permanent "+" marker): plane origin `(0,0)` for new sketches, or the bounding-box center of the originating face wire when created from a face.
- `set_origin_pt(gp_Pnt2d)` / `reset_origin_pt()` / `origin_pt()` — user-editable origin marker (also **Sketch properties** UI).
- `show_origin_marker()` / `set_show_origin_marker(bool)` — per-sketch visibility of the origin annotation (active sketch only); when off, origin is excluded from snap.
- Node indices are **never compacted**. Deleted nodes become tombstones (`Node::deleted`) so undo/redo and JSON round-trips stay stable.

### Plane and coordinates
Expand Down Expand Up @@ -61,7 +62,7 @@ Snap distance, guide mode, and guide colors live on `Sketch_nodes` (static sette
Sketch (coordinator: sketch.cpp, sketch.h)
|
+-- Sketch_nodes vertices, snapping, outside-sketch snap points
+-- Sketch_node_marks permanent "+" markers for user-placed nodes
+-- Sketch_node_marks permanent "+" markers for user-placed nodes; origin uses cyan + with circle
+-- Sketch_edges persistent edge list; add, split, remove, pick
+-- Sketch_topo planar graph -> closed faces, edge splitting
+-- Sketch_dims length dimensions, typed distance/angle input
Expand Down
Loading
Loading