Repository navigation
3D solids on solidcore (replaces #20) - #22
Merged
Merged
Conversation
…ture kernel) SolidCraft's kernel and geom crates as git dependencies pinned to withshalom/solidcraft d11d268 (v0.27.0), with its truck patches repeated in the root manifest. Only draftcraft-solid names them; cargo xtask layers enforces it. Without its kernel feature the crate is empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…DE, REVOLVE, booleans, SLICE, FILLETEDGE, CHAMFEREDGE, SOLIDEDIT shell, INTERFERE, MASSPROP, FLATSHOT, SECTION) Behind the engine feature `solids`; without it nothing changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…extension dictionary record, reopened as solids DXF and DWG keep a DraftCraft solid as a polyface mesh every program can see, and an XRECORD DRAFTCRAFT_SOLID in its extension dictionary with the body, placement and counts. With the io feature `solids` the reader turns the mesh back into the solid (the engine redraws it from the body); without it the mesh and its record are kept as they are. The save says so on the command line. The `solids` feature reaches ui-egui, mcp and the three apps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…labels Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…with wireframe, hidden and shaded styles The engine keeps a 3D view per drawing (direction, framing, visual style); the commands change the view, never the drawing. The drawing area paints it with egui's painter: faces back to front, edges and silhouettes tested against the faces in front of them. The wheel zooms, the middle button pans, Shift+middle (or the left button in 3DORBIT) orbits; clicks pick solids and points on the XY plane. A View panel on the 3D Modeling tab. Without the solids feature 3DORBIT still says not available yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… Windows The kernel is now solidcore (tangency-labs/solidcore ce5c6e9, Apache-2.0), replacing SolidCraft's truck-based kernel at the owner's request. The facade's API is unchanged: - draftcraft-solid names solidcore-ops, -record and -tess; bodies are solidcore .smb behind the DCSMB001 magic, canonical so a reopened solid keeps its bytes. - Hidden-line projection (FLATSHOT, views) is DraftCraft's own: exact edges projected, silhouettes from the mesh, visibility sampled against binned triangles. - SOLIDEDIT shell passes solidcore's outward thickness negated; MASSPROP reports moments and products of inertia and radii of gyration. - NOTICE and ATTRIBUTION carry solidcore's row and NVIDIA's SMLib notice. The 3D UI follows the structure of AutoCAD's 3D Modeling workspace (structure only; every icon drawn in code): - Built-in workspaces 2D Drafting and 3D Modeling, switched from the Quick Access Toolbar, the status bar's Workspace Switching menu or WSCURRENT. In 3D Modeling the ribbon has its own Home (Modeling, Solid Editing, Draw, Modify, Section, View, Layers), Solid (Primitive, Solid, Boolean, Solid Editing, Section) and Visualize (Views, Visual Styles) tabs. - Preset commands vpoint.top … vpoint.nwiso and vscurrent.2dwireframe … vscurrent.xray. - In the 3D view: viewport controls [-][view][style], each a menu, and a 3D ViewCube that turns with the view, with 26 clickable spots, drag to orbit, Home, compass ring and a right-click menu; and a navigation bar (Zoom Extents, In, Out, Orbit). - Italian and Chinese labels for the new strings. xtask: `cargo xtask ci --solids` runs clippy and tests with the feature on, plus a wasm32 check of the kernel. docs/solids.md keeps the status, measurements and the advisory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd solids save as 3DSOLIDs - crates/solid/src/acis: reads ACIS SAT/SAB in any dialect AutoCAD writes (through cadmpeg-asm) and writes ACIS 700 SAT and SAB, both by way of STEP with solidcore. - crates/io/src/solid_acis: adopts 3DSOLIDs on open and writes them for every version (SAT in groups 1/3 up to 2010, a data store record of SAB from 2013); AutoCAD reference drawings in crates/io/tests/data/acad-solids with tests that compare against AutoCAD's MASSPROP. Fixes from opening DraftCraft's files in AutoCAD 2027: - DXF: a 3DSOLID (and any unknown entity read from DWG) now carries 100 AcDbEntity before its layer; without it AutoCAD refused the whole file. - A cone's apex is written as a loop of one point edge, as AutoCAD does; without it AutoCAD called the cone an invalid solid with no volume. - DWG 2000-2010: the SAT lines end with a line feed alone, as in AutoCAD's own files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The state of the AutoCAD check (SAT in DWG 2000/2010 still rejected with 75003), the gaps in file compatibility, commands, 3D interaction, visualization and the web build, and the order to take them in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…DWG 2000 AutoCAD 2027 discarded every solid DraftCraft wrote into a DWG 2000 or 2010 file (error 75003, eCannotRestoreFromAcisFile), though it took the same SAT 700 text from DXF. AutoCAD's own DWG 2000 holds SAT 400, and its 3DSOLID container matches ours. SAT is now save format 400: no history fields after an entity's attribute, no parameters or convexity on an edge, and a header that counts the records. SAB stays 700 for the data store of 2013 and later. Tests: sat_text_looks_like_acis_400, a_cone_apex_is_a_point_edge_loop (400 layout), and a check in solids_save_as_autocad_3dsolids_in_every_version that every SAT for 2000 to 2010 is version 400. Not yet checked in AutoCAD; handoff.md lists the check files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ACIS's own pcurves go to the kernel on spline faces, resampled onto the kernel's edge parameter where it differs; a procedural helix becomes a cubic spline; a closed circle edge starts exactly at its circle's angle 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The side face of a sweep closes on itself through a seam edge, whose two coedges carry ACIS pcurves a period apart. The kernel's closed-form pcurve of the seam, worked out once for the edge, put both uses on one side, and the face kept a sliver of its domain: the solid read with the inner half of its tube only (volume 887). ACIS's own pcurves now come first. The free-form test checks both solids against AutoCAD's MASSPROP: the loft 175685.13 about z 36.27, the sweep 44855.46 about (150, 0, 40), read 44851.57 (the helix as a spline). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m solids read - Writer: spline-surface (exactsur), intcurve (exactcur) and an exppc pcurve on every coedge of a spline face, laid out as AutoCAD 2000 writes its LOFT and SWEEP in SAT 400; SAB stays save format 700 with full subtype names and the later formats' tails. - Reader: SAT 400's exppc pcurves and parameterless circle edges; parcur rails, ASM-text procedural surfaces (loft_spl_sur, sweep_sur) and helices filled in from the records where cadmpeg-asm only reads them word by word. - Tests: AutoCAD's loft and sweep from DXF 2000, DXF 2010 and DWG 2018 against MASSPROP; both written back as SAT and SAB and read again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…27 check passes A SAT whose header gives no record count needs its end-of-data line. With SAT 700 and the line dropped, AutoCAD 2027 discarded every solid of a DWG 2000 or 2010 file (error 75003). Checked in AutoCAD 2027 with SAT 400 and the line kept. DraftCraft's DWG and DXF files in versions 2000, 2010, 2013 and 2018 open, and so do AutoCAD's own solids saved again by DraftCraft (DWG 2018, DXF 2000). AUDIT finds 0 errors, SOLIDEDIT calls every solid valid, and MASSPROP matches to four decimals: 8/8 per file, 6/6 for the resaved ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The interim form records each mesh's fingerprint (MARK "DraftCraft solid 2"): a mesh edited elsewhere stays a mesh, a missing part takes no other mesh, a mirrored solid's mesh faces out; interim solids open with their body's exact look. - SLICE, SECTION and picking go along the line of sight and take typed Z. - SLICE, SHELL, SWEEP, FLATSHOT and region booleans are all-or-nothing. - INTERFERE skips far-apart solids and scales volumes by the placement. - 3D view: solids in blocks, mirrored solids, off-screen occluders, paint cache. - Workspaces: a saved "3D Modeling" is not hidden; greyed out without solids. - CI: a gate job with solids; the web app no longer takes the solids feature. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- REGION: ACIS sheet bodies read into regions (XY plane, lines and arcs) and regions written as REGION (SAT 400 / SAB 700, double-sided plane faces, one lump per outer loop with its holes). AutoCAD 2027's own regions open with its MASSPROP; DraftCraft's open in AutoCAD as REGIONs, AUDIT clean, EXTRUDE works. - BODY: a BODY holding a solid opens as a solid and is saved as a BODY again. - Region MASSPROP is exact on arcs (circular segments), equal to AutoCAD's. - AutoCAD REGION test drawings (DXF 2000/2010/2018, DWG 2000/2013/2018). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…not $CTABLESTYLE AutoCAD's DXF has no $CTABLESTYLE header variable (AutoCAD reports it as unknown): it keeps the current table style as a DICTIONARYVAR of the AcDbVariableDictionary. DraftCraft's DXF now writes that dictionary (and its DICTIONARYVAR class) as its DWG already did, and no longer writes $CTABLESTYLE; $HANDSEED is raised above the dictionary's handles. The dictionary is now modelled rather than kept raw: the DXF and DWG readers take it into Drawing::variables (with the current table style), and both writers save it again with the drawing's own current table style, so a style made current after opening is not lost to a stale kept copy. $CTABLESTYLE in older files' headers is still read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…compared with AutoCAD Checked against the code at afccf04: what already works, how to work (gates, the command checklist, AutoCAD checks), and every missing piece by area (file compatibility, modelling commands, 3D transforms, sub-objects, UCS and the 3D environment, sections and drawing views, visualization, surfaces and meshes, platform), with the kernel functions that exist for each and the order to do them in. docs/solids.md points to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With solids, a region is saved as AutoCAD's REGION (ACIS): an arc is a circle and its two ends, and its bulge comes back through the arc's angles (tan of a quarter of the sweep), so 0.5 may read as 0.4999999999999999. The comparator already allows converted angles their roundoff; a region's loops are now compared field by field with the bulges as such, the points and loops exact. This was the one failure of the gate with solids (roundtrip::dwg::extended::regions). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n save Saving wrote every solid and region as a new ACIS description, so a drawing from AutoCAD lost what DraftCraft doesn't model (the solid's history, face colours and attributes, the ACIS version) on any save, edited or not. Opening now moves AutoCAD's entity groups and SAB to Foreign::acis (an AcisSource by handle, with the entity as read), and saving writes them back while the entity is unchanged and the file holds them as they are: same form (SAT to 2010, SAB from 2013), a version no older than the source. An edited, copied or down-saved solid gets a new description, as before. A 3DSOLID, BODY or REGION is written from its groups, and those held only the modeler data: colour, linetype, lineweight, linetype scale, visibility and transparency were lost in DXF and DWG, every version. The property groups now come from the entity, through the writer's own code (entity_props, shared with every other entity). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
withshalom
pushed a commit
that referenced
this pull request
Nov 18, 2026
…(3D solids on solidcore)" The 3D branch gets main after PR #26 with the 3D work put back, so that later merges of main into 3D keep it. This reverts commit ee840fe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F67RssNr67uM2HRS3vdet4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
3D solids on solidcore (replaces #20)
This PR replaces #20. It carries SkryxDev's 18 commits from #20 unchanged (head
724a289) and adds the fixes and pieces that #20 was still missing. It merges cleanly intomain(3b6e91c). Everything stays behind the cargo featuresolids; without it the build, the tests and the wasm check are exactly what they are onmain.Why a replacement
3D solids with solidcore, and a 3D Modeling workspace laid out as on Windows #20's CI fails in
gate-solids:roundtrip::dwg::extended::regions. Commitb387fa9saves regions as AutoCAD REGIONs (ACIS), and reading them back recomputes each arc's bulge from angles: a bulge of0.5comes back as0.4999999999999999. The round-trip comparator compared regions with exact equality, even though its own rule elsewhere says converted angles allow floating-point roundoff.The failure hid the rest of the suite. nextest stops at the first failure, so CI ran 2,861 of 3,842 tests. DIMSCALE / DIMSTYLE #21 was checked with the whole suite (results under Gates below).
Two gaps the review didn't catch:
Both are fixed here.
What this PR adds on top of #20
1. CI fix: regions compare their bulges as converted angles (
d03de31)The round-trip comparator gets a
Regionarm. It compares loop count, outer/island flags, sources, vertex count, positions and widths exactly, and bulges with the same angle tolerance (8 ε) it already uses for every other converted angle. This applies the comparator's existing rule to regions rather than loosening it. All 348 round-trip tests pass withsolids.2. AutoCAD's own ACIS is kept for unedited solids, bodies and regions (
6b92c47)The problem. #20 turns every AutoCAD 3DSOLID, BODY and REGION into a DraftCraft solid or region on open, and drops the original. On save it writes DraftCraft's translation instead (SAT 400 or SAB 700). A drawing opened and saved without any edit therefore lost everything ACIS describes and DraftCraft doesn't model:
That works against the handoff's own goals (A5, A8, A9, A14).
The fix.
On open: the entity's groups and its SAB record move into
Foreign::acis, anAcisSourcekeyed by handle that also records what the entity was read as.Foreignis the codebase's existing home for "everything of a file DraftCraft keeps without modelling it", and it already holds the data store.On save: AutoCAD's description is written back when all of these hold:
Otherwise DraftCraft's translation is written, as before.
2000/2004 into 2007+: a 2000/2004 solid saved into a 2007+ file gets the
AcDb3dSolidmarker thatas_3dsolidwrites.Why this design: no change to
Solid3dorRegion(they're built in 20+ places), no flag that every editing command would have to clear, and no way for a stale description to be written for an edited solid. Edits are detected, not trusted.Result, measured on the AutoCAD 2027 drawings in
crates/io/tests/data/acad-solids/:350) survives, pointing at the kept history object under its new handle. The DWG reader doesn't read that link yet.3. Solids and regions keep their properties on save (
6b92c47)The bug in #20. A 3DSOLID, BODY or REGION is written from its own groups, and
for_savinggave them only the modeler data. In DXF and DWG, every version, a solid or region lost its:A red 0.50 mm solid came back ByLayer/ByLayer. This affected solids made in DraftCraft and solids read from AutoCAD.
The fix. The property groups come from the entity, through the same writer code every other entity uses:
entity_props, pulled out ofcommon_fulland exposed asdxf_write::property_groups.Tests added
an_unedited_autocad_solid_or_region_saves_as_autocad_wrote_itan_edited_copied_or_down_saved_solid_gets_a_new_descriptionsolids_and_regions_keep_their_propertiesDecisions: whose method where
We had our own fixes for the #20 review on a local branch. Where #20's fix does the same job as well, #20's stays, because swapping equivalent code would be churn. Ours goes in only where #20 had nothing, or where ours tested better.
Session::all_or_nothingCommandSpec::atomicflagSession::point_z,prompt::typed_zInput::Point3,Prompt::point3gate-solidsCI jobHow well solidcore handles the 3D
Judged on what the tests and AutoCAD's drawings show, not on claims.
Strong
unsafe:ce5c6e95).Weak, and handled around it
Verdict: a sound base for 3D on the desktop today. The browser needs the worker before solids are turned on there.
Web (handoff I1): a future PR
Our answer to I1 is not a panic-free kernel. It's the kernel behind a message boundary: on the web, solidcore runs in a Web Worker, a kernel panic takes down only that worker, and the host replaces it for the next call.
solidcore side: written, not yet published. The
solidcore-workercrate in our solidcore checkout (branchwasm-worker-host, about 1,100 lines) has:.smbbytes checked on reading;WorkerDiedand replaces the worker;It belongs in a solidcore PR, not here.
DraftCraft side: not written yet. On the web, solid commands would have to send their kernel calls through that host instead of calling solidcore directly.
That work is a PR of its own after this one, so it isn't in #21.
handoff.md against this PR
Still to check in AutoCAD
Open in AutoCAD 2027 the DXF and DWG files DIMSCALE / DIMSTYLE #21 writes from
acad-solidswith unedited solids:AcDb3dSolidmarker.The ACIS is AutoCAD's own, so the risk is low, but it hasn't been seen in AutoCAD.
A coloured solid and region saved by DraftCraft: check that colour, lineweight and transparency show in AutoCAD.
From 3D solids with solidcore, and a 3D Modeling workspace laid out as on Windows #20, still open: NURBS faces written to ACIS (handoff A1).
write_files_for_autocad(ignored test) writes the files for that check.Gates
cargo xtask ciandcargo xtask ci --solids: running in GitHub Actions on this PR (local runs were cut short to push).🤖 Generated with Claude Code