Skip to content

3D views: VPOINT, PLAN, 3DORBIT, ViewCube orbit - #1005

Open
Adiakys wants to merge 31 commits into
storytold:mainfrom
Adiakys:autocad-3d
Open

Adiakys wants to merge 31 commits into
storytold:mainfrom
Adiakys:autocad-3d

Conversation

@Adiakys

@Adiakys Adiakys commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
  • VPOINT, PLAN, View > 3D Views presets, 3DORBIT (drag or azimuth/elevation).
  • ViewCube: drag to orbit, compass ring, back to plan.
  • 3D views are drawn as wireframe (polyface meshes from Polyface meshes stay one object through DXF and DWG #2600 too), on screen and in PNG/SVG/PDF exports and display plots of the current view.
  • 3D view direction and target saved in VIEWPORT/VPORT (groups 16, 17) and named views (VIEW 11, 12); a drawing saved in a 3D view opens in it.
  • View twist (group 51) is left to View twist: DVIEW, twisted model views, tiles and layout viewports #1230: the two combine without overlap (a 3D viewport gets its direction here and its twist there).

Kept small on purpose: shaded visual styles (VSCURRENT) are not in this PR, and layout viewports and tiled model viewports are drawn in plan, centred on their target as on main (their 3D view is kept in the file). These can follow as separate PRs.

Not done yet: UCS, solids, surfaces. Picking and snaps off the XY plane are approximate. Full list in gaps.md F24.

Closes #7
Refs #612

Rows to update: gaps.md F24 and U12, roadmap.md M11, target-app-parity.md 3D, file-format-parity.md VIEWPORT/VPORT/VIEW; parity-checklist.md via cargo xtask parity.

…lyface mesh instead of loose 3D faces; DWG keeps them
…t and twist) and Mat4::plane (its 2D map on a plane)
…objects draw through their plane's 2D map, 3D lines, faces and meshes are projected, blocks carry their z
…e canvas draws the projected list, with points, grid and axes on the XY plane
…e view, goes back to plan and turns the view with its compass ring
…yface meshes and solids filled, lit and drawn back to front, with or without their edges
…t and twist (groups 16, 17, 51); layouts draw 3D viewports
@nnehila

nnehila commented Oct 16, 2026

Copy link
Copy Markdown

+1

@aldozar

aldozar commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Field test of this branch on a real topographic drawing (a DWG in UTM coordinates: survey points, contour polylines at their elevation, a 278-face TIN, utility lines with complex linetypes):

  • Works: a SW iso (VPOINT -1,-1,0.6) draws the points, contours and utility lines at their levels with their linetypes, and the terrain's relief reads clearly. With the TIN's layer turned on, shaded draws the surface with the contours on it. A low view (1,-1,0.35) shows the relief well.
  • PNG export doesn't use the 3D view: cadcraft-cli run file.dwg --cmd 'vpoint {"preset":"swiso"}' --cmd 'zoom {"extents":true}' --export iso.png --view current writes an empty image. io::png builds its list without Options::projection, so it draws the plan through the 3D view's window. Rendering through cadcraft_render::build with projection: Some(Mat4::view(dir, ZERO, 0)) gives the right picture.
  • Shading is one flat grey: every face had the same tone whatever its slope, so the relief shows only through the edges. Fine for a first step, just noting it in case light-dependent shading was intended.
  • Drawings with stray Z values look stretched: this one has its title block at z ≈ 6,500 to 8,200 (a common leftover in drawings that come from AutoCAD), so extents in a 3D view are thousands of units tall and the terrain is a thin strip. The Z values are in the file, so AutoCAD would draw it the same way. Mentioning it only because ZOOM E in 3D will often land there on real files.

(Written by Claude Code, an AI agent, on behalf of @aldozar.)

Exporting the current view of a 3D model space (`run --export --view current`, or the default
after `vpoint`) drew the plan through the 3D view's window, which is in view coordinates, so
the image came out empty. PNG, SVG and PDF exports now draw model space in the current view's
projection and visual style (`cadcraft_io::View3d`, `write_view`), as the screen does. A
`plot` of `plotArea: display` in a 3D view passes the view to the plotter the same way.
`--view extents` and `--window` still draw the plan.

Reported by @aldozar on storytold#1005.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Adiakys

Adiakys commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the field test! Fixed in 64b7c74: PNG, SVG and PDF exports of the current view (--view current, or the default after vpoint) now draw the 3D view in its visual style, like the screen, and so does plot with plotArea: display. --view extents and --window still draw the plan. Shading and the stray-Z extents are left as they are for now.

# Conflicts:
#	apps/cadcraft-cli/src/main.rs
#	crates/render/src/lib.rs
#	crates/ui-egui/src/i18n/cs.tsv
#	crates/ui-egui/src/i18n/es.tsv
#	crates/ui-egui/src/i18n/fr.tsv
#	crates/ui-egui/src/i18n/it.tsv
#	crates/ui-egui/src/i18n/pt_br.tsv
#	crates/ui-egui/src/i18n/ru.tsv
#	crates/ui-egui/src/i18n/sv.tsv
#	crates/ui-egui/src/i18n/uk.tsv
#	crates/ui-egui/src/i18n/zh.tsv
#	docs/file-format-parity.md
#	docs/gaps.md
#	docs/parity-checklist.md
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Walkthrough
Walkthrough
Walkthrough
Walkthrough
Walkthrough
Walkthrough
Walkthrough
Walkthrough
Walkthrough
📝 Walkthrough

Adds model-space 3D views, orbit controls, shaded visual styles, view-aware image exports, and polyface mesh support. The changes cover view persistence, rendering, export framing, mesh editing, and DXF/DWG round trips.

Changes: Model-Space Views and Polyface Meshes

Layer / File(s) Summary
3D view and mesh data
crates/doc/src/entity.rs, crates/doc/src/tables.rs, crates/geom/src/mat.rs
Adds view direction data, view transforms, polyface meshes, and hidden-edge filtering.
Commands, interaction, and persistence
crates/engine/src/cmd/view/*, crates/engine/src/lib.rs, crates/ui-egui/src/viewcube.rs, crates/ui-egui/src/canvas.rs
Adds view commands, orbit and compass rotation, named-view persistence, projected canvas interaction, and shaded visual-style labels.
Rendering and exports
crates/render/src/*, crates/io/src/*, apps/cadcraft-cli/src/main.rs, crates/engine/src/cmd/layout.rs
Adds projected and shaded rendering, optional view-aware export APIs, and CLI framing rules for current 3D views.
Polyface editing and file formats
crates/io/src/dxf_read.rs, crates/io/src/dxf_write.rs, crates/engine/src/cmd/modify.rs, crates/engine/src/cmd/modify2.rs, crates/engine/src/grips.rs, crates/io/tests/*, docs/file-format-parity.md
Preserves polyface meshes through supported DXF/DWG paths, writes oversized meshes as 3D faces, and adds mesh editing and round-trip coverage.
Validation and documentation
crates/engine/tests/*, crates/render/tests/*, crates/ui-egui/src/viewcube.rs, README.md, docs/*
Adds coverage for view commands, rendering, exports, mesh behavior, ViewCube dragging, and documented feature status.

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant ViewCube
  participant Session
  participant Canvas
  participant Renderer
  ViewCube->>Session: update view direction or rotation
  Session->>Canvas: expose current projection and visual style
  Canvas->>Renderer: build projected display list
Loading

</details>

</details>

</details>

</details>

</details>

</details>

</details>

</details>

</details>

</details>

<!-- walkthrough_end -->
<details>
<summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-normal-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Moderate</strong> · previous review <code>a0c55</code></summary>

<!-- final_review_risk_start -->
<!-- final_review_risk_label
**Merge Risk:** **🟡 Moderate** · up to `a0c55`
-->
<!-- final_review_risk_coverage:{"sourceCommitId":"a0c55eabb6e319e161b93f87acc2f4d7b0a216be","coveredCommitId":"a0c55eabb6e319e161b93f87acc2f4d7b0a216be","kind":"reviewed"} -->

Polyface validation is corrected, but a saved 3D view can still omit elevated model geometry. Resolve the viewport fitting issue before merging unless that limitation is explicitly accepted.
<!-- final_review_risk_end -->

</details>

<details>
<summary><strong>Security architecture risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-low-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Low</strong> · up to <code>d2eef</code></summary>

<!-- architecture_review_start -->
<!-- architecture_review_label
### Security Architecture Review

**Security architecture risk:** **🔵 Low** · up to `d2eef`
-->

Imported drawings reach new 3D rendering and export behavior, but the inspected paths preserve geometry validation and visibility controls. No introduced security issue was established. Incomplete file-format and recovery coverage prevents a minimal-risk assessment.

**Retained concerns**
No architecture-level concerns identified.


<details>
<summary><strong>Security review details</strong></summary>
<dl>
<dd>

**Security Blast Radius**
- _inferred_ — The inspected attack-relevant scope is supplied drawing content reaching document geometry, projected rendering, and generated images within the processing application. New shaded rendering expands data consumption, but that feature expansion alone does not establish a security boundary violation.

**Security Findings and Attack Paths**
- _observed_ — The inspected malformed-face path does not substantiate weakened vertex-index validation. Both base and head reject faces with insufficient corners or out-of-range indices, and the head geometry consumer independently skips invalid faces.

**Trust Boundaries and Controls**
- _observed_ — Projected shading retains existing display controls: hidden objects and cancellation are checked before projection, while queued faces use the common visibility resolver for entity visibility, layer visibility, frozen layers, and plot eligibility.
- _observed_ — DXF view ingestion checks direction and target finiteness and rejects zero-length directions. Target adjustment for plan views avoids storing an overflowing center sum. Image export windows retain explicit magnitude and minimum-size validation.

**Resilience and Maintainability Implications**
- _observed_ — Meshes exceeding DXF’s signed 16-bit record limits fall back to separate 3D faces rather than truncated indices. The writer allocates replacement handles, and added round-trip assertions cover retained geometry, hidden edges, and handle distinction.

</dd>
</dl>
</details>
<!-- architecture_review_end -->

</details>
<!-- pre_merge_checks_walkthrough_start -->

<details>
<summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 3 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary>

<strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 warning</strong>

|         Check name         |                                              Status                                              | Explanation                                                                                                                                                                                               | Resolution                                                                                                                                                                                                                                        |
| :------------------------: | :----------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Out of Scope Changes check | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Issue #7 is the only active directly linked issue. ViewCube orbit support and its required 3D view plumbing are in scope. The pull request also adds VPOINT and PLAN commands, visual styles and shaded … | Split the unrelated polyface, rendering and visual-style, export and plot, and persistence changes into pull requests with matching active issues. Keep this pull request limited to the ViewCube interaction, required 3D view plumbing, and fo… |

<details>
<summary><strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> Passed checks: 3 passed</strong></summary>

|      Check name     |                                             Status                                             | Explanation                                                                                                                                                                                               |
| :-----------------: | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|  Description Check  | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped - CodeRabbit’s high-level summary is enabled.                                                                                                                                               |
| Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Issue #7 requires ViewCube interaction to change the project viewing angle. `crates/ui-egui/src/viewcube.rs` now sends face drags to `Session::drag_view` and ring drags to `Session::rotate_view`. The … |
|     Title check     | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly summarizes the main changes: 3D view controls, VPOINT, PLAN, orbit behavior, and ViewCube interaction. It is concise and specific.                                                      |

<details>
<summary>Full details: Linked Issues check</summary>

**Explanation**

Issue #7 requires ViewCube interaction to change the project viewing angle. `crates/ui-egui/src/viewcube.rs` now sends face drags to `Session::drag_view` and ring drags to `Session::rotate_view`. The same file and `crates/engine/tests/view3d.rs` test that a face drag changes the view direction without starting a selection window. The implementation meets the linked issue requirement.

</details>

</details>

<details>
<summary>Full details: Out of Scope Changes check</summary>

**Explanation**

Issue #7 is the only active directly linked issue. ViewCube orbit support and its required 3D view plumbing are in scope. The pull request also adds VPOINT and PLAN commands, visual styles and shaded rendering, polyface mesh IO and editing, viewport and named-view persistence, and 3D PNG, SVG, PDF, and plot exports. These feature groups are not required by #7. Supporting tests and documentation for those groups do not make them in scope.

**Resolution**

Split the unrelated polyface, rendering and visual-style, export and plot, and persistence changes into pull requests with matching active issues. Keep this pull request limited to the ViewCube interaction, required 3D view plumbing, and focused tests, or link active issues that explicitly require the additional feature groups.

</details>

</details>

<!-- pre_merge_checks_walkthrough_end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>Finishing Touches</summary>

<details open>
<summary>🧪 Generate unit tests (beta)</summary>

- [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create a new PR

</details>

</details>

<!-- finishing_touch_checkbox_end -->

<!-- autopilot:start -->
- [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
<!-- autopilot:end -->
<!-- announcements_start -->

> [!TIP]
> <details>
> <summary>🎯 Customize your risk assessments</summary>
> 
> Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using **Merge Risk Instructions** and **Security Risk Instructions** in your review settings. Security architecture risk assessments require the **Advanced plan or above**.
> 
> </details>
> 
> <details>
> <summary>✅ Automatic approvals, with your rules</summary>
> 
> Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable **Automatic approvals** in review settings, with overrides for teams or file paths.
> 
> </details>

<!-- announcements_end -->
<!-- tips_start -->

---

Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=storytold/cadcraft&utm_content=1005)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<!-- tips_end -->
<!-- verify_invitation_start -->
### CodeRabbit Verify

- [ ] <!-- {"checkboxId":"run-qa-agent"} --> Run CodeRabbit Verify to test the changes in this pull request.
<!-- verify_invitation_end -->
<!-- recent_review_start -->

<h6>
<details>
<summary>ℹ️ Recent review info</summary>
<dl>
<dd>

<details>
<summary><strong>⚙️ Run configuration</strong></summary>
<dl>
<dd>

- **Configuration used**: defaults
- **Review profile**: CHILL
- **Plan**: Advanced
- **Run ID**: `bafd3d2a-2740-4800-9192-ece611c9bd72`

</dd>
</dl>
</details>

<details>
<summary><strong>📥 Commits</strong></summary>
<dl>
<dd>

Reviewing files that changed from the base of the PR and between d2eefc84e8723731c26eea9d8933ac4df36a565f and a0c55eabb6e319e161b93f87acc2f4d7b0a216be.

</dd>
</dl>
</details>

<details>
<summary><strong>📒 Files selected for processing: 1</strong></summary>
<dl>
<dd>

* `crates/io/src/dxf_read.rs`

</dd>
</dl>
</details>

<details>
<summary><strong>🚧 Files skipped from review as they are similar to previous changes: 1</strong></summary>
<dl>
<dd>

* crates/io/src/dxf_read.rs

</dd>
</dl>
</details>

**Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

</dd>
</dl>
</details>
</h6>

<!-- recent_review_end -->

Adiakys and others added 2 commits October 19, 2026 23:46
…itching; drop broken polyface faces

- A drawing saved in a 3D view writes its *Active VPORT framed on what the view draws, objects
  off the XY plane included, instead of the footprint projected at z = 0.
- Restoring a 3D named view while model space is tiled is refused before the tab or the
  selection change.
- Polyface face records that name missing vertices (or fewer than three) are dropped on read,
  so they are not written back.

Reported by CodeRabbit on storytold#1005.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	apps/cadcraft-cli/src/main.rs
#	crates/io/src/dxf_read.rs
#	crates/io/tests/it/dwg_roundtrip_losses.rs
#	crates/io/tests/pdf_layers.rs
#	docs/file-format-parity.md
#	docs/gaps.md
#	docs/parity-checklist.md
#	docs/target-app-parity.md
@a4jp-com

a4jp-com commented Oct 25, 2026 •

Copy link
Copy Markdown

Any fixes for the conflict yet?


2 workflows awaiting approval
This workflow requires approval from a maintainer.

successful checks
CodeRabbit
CodeRabbit — Review paused
This branch has conflicts that must be resolved
Changes can be cleanly merged.

@SnotacusNexus

Copy link
Copy Markdown

Three open PRs implement the same 3D-view surface against main, and they all rewrite the same core files, so at most one can land as-is.

PR author scope size updated
#1005 Adiakys VPOINT, PLAN, 3DORBIT, ViewCube orbit, shaded visual styles, polyface meshes, 3D view round-trip in DXF +2371/−238, 74 files 10-25
#2091 Torentje interactive 3D projected ViewCube + 3D Orbit +2926/−217, 17 files 10-25
#1954 Torentje 3DORBIT plus AutoLISP IDE (VBAIDE/NETLOAD) and bare LISP prefix eval +2577/−150, 23 files 10-23

Files touched by all three: crates/engine/src/cmd/view.rs, engine/src/lib.rs, engine/src/cmd/exchange.rs, engine/src/cmd/modify.rs, render/src/lib.rs, ui-egui/src/canvas.rs, ui-egui/src/viewcube.rs, io/src/pdf.rs, ui-egui/src/i18n/uk.tsv. #2091 and #1954 also overlap engine/src/snap.rs, snap/tracking.rs, select.rs and pointmod.rs, i.e. the three aren't just adjacent — they conflict on nearly every line that matters.

What I could verify locally (only #1005 was checked out and built):

Separately on solids: #2259 (mesh kernel + RENDER/STL/3MF, currently CONFLICTING), #1784 (BOX/CYLINDER/EXTRUDE as groups of 3DFACE) and #1801 (WEDGE/CONE/PYRAMID/SPHERE/TORUS). #1784 and #1801 are by the same author and share the 3DFACE representation, so they compose; #2259 is a different representation (a mesh kernel) and is a design decision to make before any of them merge, not a rebase.

None of this is a criticism of any individual PR — it's just that there are three concurrent implementations of the same feature and the cheapest outcome is to pick one and close/retarget the others before more work goes in.

@SnotacusNexus SnotacusNexus mentioned this pull request Oct 29, 2026
main split the large modules (dxf_read, dxf_write, modify, canvas, render, the engine session)
into module directories and moved the CLI to clap: the 3D views' changes are ported to the new
files, and the clippy limits main tightened are met (the VIEW record and the polyface mesh
writer are their own functions).
@Adiakys

Adiakys commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

@a4jp-com Conflicts resolved: the branch is merged with current main (0.14), with the 3D work ported to main's new module layout and the CLI's move to clap; cargo xtask ci passes locally (fmt, clippy, tests, i18n, assets, layers, wasm). The CI workflows are waiting for a maintainer's approval.

…eview issues

Scope reduced so the feature is small and solid:
- Removed VSCURRENT and the Shaded / Shaded with Edges visual styles
  (render, PDF layers, UI, translations).
- Layout viewports and tiled model viewports are drawn in plan; a
  viewport's 3D view (groups 16, 17) is still kept in DXF/DWG.
- Render: one projection path (3D objects projected point by point, flat
  objects drawn through their plane), helices and rays/xlines projected,
  2D solids/traces at their elevation, block z scale kept.
- Engine: VisualStyle and View3d types removed; one DocState::to_view for
  picks in a 3D view; VPOINT/PLAN/3DORBIT share one refusal message;
  saving and exporting use the drawing as the view frames it.
- UI: ViewCube drag, orbit and zoom about the cursor go through the same
  view mapping; the plane grid skips edge-on and huge views.
- Docs: F24/M11/3D rows updated, one dated revision row per doc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Adiakys Adiakys changed the title 3D views: VPOINT, PLAN, 3DORBIT, ViewCube orbit, shaded visual styles, polyface meshes 3D views: VPOINT, PLAN, 3DORBIT, ViewCube orbit, polyface meshes Oct 30, 2026
@Adiakys

Adiakys commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

I reworked this PR to make it smaller and easier to review (7758459):

  • Taken out: shaded visual styles (VSCURRENT Shaded / Shaded with Edges). Layout viewports and tiled model viewports are now drawn in plan; their 3D view direction is still kept in DXF/DWG, so nothing is lost on save. Both can come back later as separate PRs.
  • Simplified: one projection path in the renderer (3D objects projected point by point, flat objects drawn through their plane), one mapping for picks, zoom and orbit in a 3D view, and a few helper types removed. The commit removes more lines than it adds.
  • Fixed: helices, rays and xlines are now projected; 2D solids and traces sit at their elevation; a block's Z scale is kept. The plane grid is skipped when the plane is seen edge-on. VPOINT, PLAN and 3DORBIT give the same message when a 3D view isn't allowed. Save and export use the drawing as the view frames it.

@aldozar your field test used shaded on the TIN: with this change the 3D view and its exports are wireframe. Shading can follow in its own PR.

cargo xtask ci passes locally (fmt, clippy, tests, i18n, assets, layers, wasm). The CI workflows are still waiting for a maintainer's approval.

Adiakys and others added 3 commits October 31, 2026 18:18
…d-3d

# Conflicts:
#	crates/ui-egui/src/canvas.rs
#	docs/file-format-parity.md
#	docs/gaps.md
SCALE now scales a polyface mesh's vertex heights like other objects
(test scale_scales_a_polyface_meshs_vertex_heights); the selection
window's crossing outline is clipped like main's dashed rectangle, as a
parallelogram in a 3D view; main's new tests get the 3D fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CLAUDE.md: PRs don't edit the parity docs; the affected rows are named in
the PR description instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: 3D views, with VPOINT, PLAN, 3DORBIT, the ViewCube orbit and polyface meshes. The README and the CLI documentation now say that the current view of a 3D model space (vpoint, 3dorbit, …) is drawn as the screen shows it, in its visual style, while the other framings draw the plan, and that the default framing does too when the steps changed the view. Making the command line renderer honour the current 3D view is a coherent rule that the text states. A change of this size (a view system, a ViewCube, and polyface mesh support) is several features, and polyface meshes are a different entity type that should be its own PR with its own reader and writer tests. 3D view commands change a set of system variables (view direction, target, lens length) that must be saved with the drawing, and the ViewCube is user interface art that needs provenance if it is an image. AutoCAD's ViewCube is a trademarked Autodesk interface element; the PR should show that the widget is an original design. I read documentation hunks only. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Adiakys Adiakys changed the title 3D views: VPOINT, PLAN, 3DORBIT, ViewCube orbit, polyface meshes 3D views: VPOINT, PLAN, 3DORBIT, ViewCube orbit Nov 1, 2026
@Adiakys

Adiakys commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. Two of these are already covered:

  • The view is saved with the drawing: the *Active VPORT and layout VIEWPORTs write and read the view direction (16/26/36) and target (17/27/37). crates/io/tests/it/view3d_roundtrip.rs checks DXF and DWG. Views are parallel projections, so there is no lens length to save.
  • The ViewCube isn't new and isn't an image: it's already on main, drawn with egui shapes in crates/ui-egui/src/viewcube.rs. This PR changes its label and tooltips and makes the face and the compass ring work.

Polyface meshes: fair point, they're now in #2600 with their reader and writer tests.

echelon added a commit that referenced this pull request Nov 1, 2026
* Polyface meshes stay one object through DXF and DWG

A polyface mesh (POLYLINE flag 64) was read as loose 3D faces. It is now
read, drawn, exploded into its 3D faces and written back as a POLYLINE.
Hidden edges aren't drawn. A mesh too large for the 16-bit groups 71-74
is saved as 3D faces.

Split from #1005.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* A polyface face ends at its first zero index

A face record with a gap ([1, 2, 0, 3]) has two corners and is dropped,
not read as a triangle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Polyface meshes: write only faces that name their vertices; ID gives their Z

The writer drops the faces the reader would drop, so no record names a
missing vertex, and the 16-bit check only needs the counts. ID and DIST
give a mesh the Z of its nearest visible edge, as they do for 3D faces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
@aldozar

aldozar commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Tested this PR (head e96f911) headless with a real topographic survey DWG: about 1,460 objects, including a 278-face TIN (3DFACE), contour polylines with elevations around 1,880 m, and survey points.

  • VPOINT 1,-1,1 and VPOINT -1,-2,0.35 draw the TIN, contours and points as a correct wireframe at their real elevations. The relief reads clearly in the low view.
  • PLAN brings the view back; the image is pixel-identical to the plan export.
  • Saved in a 3D view to DXF and to DWG, then reopened: the export of the current view is pixel-identical to the one before saving.
  • One note for users, not a bug: in a survey sheet whose title block and texts sit at very different Z (here −7,362 to 8,198), ZOOM E in 3D fits that whole height and the drawing shows as a thin vertical line. AutoCAD does the same; isolating the terrain layers gives a good view.

Not tested: the ViewCube and 3DORBIT dragging in the GUI. The PR currently conflicts with main.

(Written by Claude Code, an AI agent, on behalf of @aldozar.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Adiakys

Adiakys commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for testing it on a real survey. I merged main, so the conflicts are gone, and 3D views now draw polyface meshes too, now that #2600 is in.

@Adiakys

Adiakys commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

If smaller PRs are easier to review, I can split this one (about 1,300 lines of code and 500 of tests) into three, opened one after another:

  1. The view model, VPOINT, PLAN and the presets, and saving the view in DXF/DWG.
  2. 3DORBIT and dragging the ViewCube (closes Dragging ViewCube does nothing. #7).
  3. PNG/SVG/PDF exports and plots of a 3D view.

Happy to keep it as one if that's simpler.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dragging ViewCube does nothing.

6 participants