2026-08-23 22:53:27 +03:00
|
|
|
// Profile-based kernel solid commands stored as exact ACIS data.
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
|
|
|
|
|
use acadrust::{entities::Solid3D, EntityType};
|
fix(precision): keep typed coordinates exact in f64 (#311)
Typed values were quantized to the f32 grid before reaching the
entity (e.g. a length of 2000.8 committed as 2000.8020), worsening
with magnitude. The interaction point layer was all glam::Vec3 (f32).
Two-layer fix:
1. Coordinate backbone -> f64. last_point, last_cursor_world,
dyn_anchor, dyn_ref become DVec3; UcsXform transforms, parse_coord,
the ucs helper fns, dyn_resolve_point, the OTRACK typed-distance
paths, command-line coordinate entry and the coordinate readout all
compute in f64. Screen/GPU/alignment stays f32 (snap engine, render
geometry, projection, UCS-icon/viewcube drawing) with casts only at
those boundaries.
2. Per-command committed storage -> DVec3. on_point already received a
DVec3, but many command impls narrowed it back to f32 (let pt =
pt.as_vec3(); Vec<Vec3> fields) and re-widened at build, quantizing
the committed coordinate. Migrated PLINE, SPLINE, MLINE, LENGTHEN,
INSERT, 3D primitives, every dimension/leader/mleader, ray, revcloud,
wipeout, attdef, table, tolerance, array center, mview, plot_window,
plus the QDIM_PLACE handler and qdim_collect_points. Preview,
hit-test and rubber-band paths keep f32 at the boundary.
Hatch manual boundaries are left for a follow-up: HatchModel.boundary
is structurally Arc<Vec<[f32;2]>> and needs a model-level widen.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 21:26:40 +03:00
|
|
|
use glam::DVec3;
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
|
|
|
|
|
use crate::command::{CadCommand, CmdResult};
|
2026-08-23 22:53:27 +03:00
|
|
|
use crate::t;
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
|
|
|
|
|
// ── EXTRUDE command ────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
pub struct ExtrudeCommand {
|
2026-08-23 22:53:27 +03:00
|
|
|
command_name: &'static str,
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
step: ExtrudeStep,
|
|
|
|
|
pub target_handle: acadrust::Handle,
|
2026-08-23 22:53:27 +03:00
|
|
|
anchor: DVec3,
|
|
|
|
|
direction: Option<DVec3>,
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
color: [f32; 4],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(PartialEq)]
|
2026-05-12 10:36:15 +03:00
|
|
|
enum ExtrudeStep {
|
|
|
|
|
Pick,
|
|
|
|
|
Height,
|
|
|
|
|
}
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
|
|
|
|
|
impl ExtrudeCommand {
|
2026-08-23 22:53:27 +03:00
|
|
|
pub fn new_named(name: &str, color: [f32; 4]) -> Self {
|
2026-05-12 10:36:15 +03:00
|
|
|
Self {
|
2026-08-23 22:53:27 +03:00
|
|
|
command_name: match name {
|
|
|
|
|
"THICKEN" => "THICKEN",
|
|
|
|
|
_ => "EXTRUDE",
|
|
|
|
|
},
|
2026-05-12 10:36:15 +03:00
|
|
|
step: ExtrudeStep::Pick,
|
|
|
|
|
target_handle: acadrust::Handle::NULL,
|
2026-08-23 22:53:27 +03:00
|
|
|
anchor: DVec3::ZERO,
|
|
|
|
|
direction: None,
|
2026-05-12 10:36:15 +03:00
|
|
|
color,
|
|
|
|
|
}
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl CadCommand for ExtrudeCommand {
|
2026-05-12 10:36:15 +03:00
|
|
|
fn name(&self) -> &'static str {
|
2026-08-23 22:53:27 +03:00
|
|
|
self.command_name
|
2026-05-12 10:36:15 +03:00
|
|
|
}
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
fn prompt(&self) -> String {
|
|
|
|
|
match self.step {
|
2026-08-02 22:09:25 +03:00
|
|
|
ExtrudeStep::Pick => t!("EXTRUDE Select closed profile (Circle, LwPolyline…):")
|
|
|
|
|
.into_owned(),
|
|
|
|
|
ExtrudeStep::Height => t!("EXTRUDE Height:").into_owned(),
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
}
|
|
|
|
|
}
|
2026-05-12 10:36:15 +03:00
|
|
|
fn needs_entity_pick(&self) -> bool {
|
|
|
|
|
self.step == ExtrudeStep::Pick
|
|
|
|
|
}
|
2026-08-23 22:53:27 +03:00
|
|
|
fn entity_pick_uses_surface_point(&self) -> bool {
|
|
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
fn set_entity_pick_direction(&mut self, direction: Option<DVec3>) {
|
|
|
|
|
self.direction = direction.and_then(DVec3::try_normalize);
|
|
|
|
|
}
|
|
|
|
|
fn on_entity_pick(&mut self, handle: acadrust::Handle, point: DVec3) -> CmdResult {
|
2026-05-12 10:36:15 +03:00
|
|
|
if handle.is_null() {
|
|
|
|
|
return CmdResult::NeedPoint;
|
|
|
|
|
}
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
self.target_handle = handle;
|
2026-08-23 22:53:27 +03:00
|
|
|
self.anchor = point;
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
self.step = ExtrudeStep::Height;
|
|
|
|
|
CmdResult::NeedPoint
|
|
|
|
|
}
|
2026-07-12 00:34:38 +03:00
|
|
|
fn on_point(&mut self, pt: DVec3) -> CmdResult {
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
if self.step == ExtrudeStep::Height {
|
2026-08-23 22:53:27 +03:00
|
|
|
let height = self
|
|
|
|
|
.direction
|
|
|
|
|
.map(|direction| (pt - self.anchor).dot(direction))
|
|
|
|
|
.unwrap_or_else(|| pt.distance(self.anchor));
|
|
|
|
|
if !height.is_finite() || height.abs() <= 1e-6 {
|
|
|
|
|
return CmdResult::NeedPoint;
|
|
|
|
|
}
|
2026-05-12 10:36:15 +03:00
|
|
|
return CmdResult::ExtrudeEntity {
|
|
|
|
|
handle: self.target_handle,
|
2026-08-23 22:53:27 +03:00
|
|
|
height,
|
2026-05-12 10:36:15 +03:00
|
|
|
color: self.color,
|
|
|
|
|
};
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
}
|
|
|
|
|
CmdResult::NeedPoint
|
|
|
|
|
}
|
2026-05-12 10:36:15 +03:00
|
|
|
fn wants_text_input(&self) -> bool {
|
|
|
|
|
self.step == ExtrudeStep::Height
|
|
|
|
|
}
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
fn on_text_input(&mut self, text: &str) -> Option<CmdResult> {
|
feat(units): read back every form the drawing writes
The readout learned to write lengths as 5'-6 1/2" and angles as
N 45d0'0" E, but typed input was still a bare parse::<f64>() — a
coordinate could be displayed and not entered. Give the formatters
their inverses.
parse_length takes feet and inches separated by a dash, a space, or
nothing, with the closing quote optional, and whole-plus-fraction in
any of those forms: 5', 60", 5'-9", 5'9-1/2, 9-1/2, 1/2. A leading
minus is a sign; the one inside 5'-9" is a separator, since after feet
there is nothing left to subtract from.
parse_angle reads the mark that says which convention an angle is in —
g for grads, r for radians, d/'/" for degrees-minutes-seconds, compass
letters for a surveyor's bearing — and reads a bare number in whichever
convention the drawing is set to.
ANGBASE and ANGDIR now apply, but only where they mean something. Which
way a thing points is measured from the drawing's zero and runs the way
it says; how wide an arc opens is the same number whatever zero is
counted from. format_direction and parse_direction are the pair for
directions, and the polar readout and polar input both go through them,
so the bearing shown is the bearing accepted. format_angle stays for
sizes, where applying a base angle would corrupt the value.
The command prompts follow the same rule, each classified rather than
swept: OFFSET distance, FILLET radius, CHAMFER distances, ARRAY and
MINSERT spacing, TRACE width, HELIX, and EXTRUDE height read lengths;
the four dimension text-rotation prompts, ARRAY's total angle and
INSERT's rotation read angles. MLINE's scale and INSERT's scale factor
are left alone — a multiplier has no unit to be written in. INSERT read
both through one parse; they are now separate.
The typed variants also take a decimal comma, which a single-value
prompt has no other use for. parse_length itself does not: inside a
coordinate the comma separates the axes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 23:46:49 +03:00
|
|
|
crate::entities::common::parse_typed_length(text)
|
2026-05-12 10:36:15 +03:00
|
|
|
.filter(|&h| h.abs() > 1e-6)
|
|
|
|
|
.map(|h| CmdResult::ExtrudeEntity {
|
|
|
|
|
handle: self.target_handle,
|
2026-08-23 22:53:27 +03:00
|
|
|
height: h,
|
2026-05-12 10:36:15 +03:00
|
|
|
color: self.color,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
fn on_enter(&mut self) -> CmdResult {
|
|
|
|
|
CmdResult::Cancel
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
}
|
2026-08-23 22:53:27 +03:00
|
|
|
fn cursor_axis(&self) -> Option<(DVec3, DVec3)> {
|
|
|
|
|
(self.step == ExtrudeStep::Height).then_some((self.anchor, self.direction?))
|
|
|
|
|
}
|
|
|
|
|
fn dyn_spec(&self) -> Option<crate::command::DynSpec> {
|
|
|
|
|
(self.step == ExtrudeStep::Height).then_some(crate::command::DynSpec {
|
|
|
|
|
anchor: crate::command::DynAnchor::Point(self.anchor),
|
|
|
|
|
fields: vec![crate::command::DynFieldSpec::new(
|
|
|
|
|
crate::command::DynRole::Distance,
|
|
|
|
|
)],
|
|
|
|
|
guide: crate::command::DynGuide::Radius,
|
|
|
|
|
ref_point: None,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
fn dyn_live_value(&self, cursor: DVec3) -> Option<f64> {
|
|
|
|
|
Some((cursor - self.anchor).dot(self.direction?))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-03 11:38:16 +10:00
|
|
|
// ── EXTRUDE REGION command ────────────────────────────────────────────────
|
|
|
|
|
//
|
|
|
|
|
// Pick a closed outline, then any number of closed hole loops, Enter, then a
|
|
|
|
|
// height. One kernel op (sweep_model::extruded_region) instead of the
|
|
|
|
|
// extrude-each-then-SUBTRACT dance.
|
|
|
|
|
|
|
|
|
|
pub struct ExtrudeRegionCommand {
|
|
|
|
|
step: ExtrudeRegionStep,
|
|
|
|
|
outline: acadrust::Handle,
|
|
|
|
|
holes: Vec<acadrust::Handle>,
|
|
|
|
|
anchor: DVec3,
|
|
|
|
|
direction: Option<DVec3>,
|
|
|
|
|
color: [f32; 4],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(PartialEq)]
|
|
|
|
|
enum ExtrudeRegionStep {
|
|
|
|
|
PickOutline,
|
|
|
|
|
PickHoles,
|
|
|
|
|
Height,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl ExtrudeRegionCommand {
|
|
|
|
|
pub fn new(color: [f32; 4]) -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
step: ExtrudeRegionStep::PickOutline,
|
|
|
|
|
outline: acadrust::Handle::NULL,
|
|
|
|
|
holes: Vec::new(),
|
|
|
|
|
anchor: DVec3::ZERO,
|
|
|
|
|
direction: None,
|
|
|
|
|
color,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn emit(&self, height: f64) -> CmdResult {
|
|
|
|
|
CmdResult::ExtrudeRegion {
|
|
|
|
|
outline: self.outline,
|
|
|
|
|
holes: self.holes.clone(),
|
|
|
|
|
height,
|
|
|
|
|
color: self.color,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl CadCommand for ExtrudeRegionCommand {
|
|
|
|
|
fn name(&self) -> &'static str {
|
|
|
|
|
"EXTRUDEREGION"
|
|
|
|
|
}
|
|
|
|
|
fn prompt(&self) -> String {
|
|
|
|
|
match self.step {
|
|
|
|
|
ExtrudeRegionStep::PickOutline => {
|
|
|
|
|
t!("EXTRUDE REGION Select outline profile:").into_owned()
|
|
|
|
|
}
|
|
|
|
|
ExtrudeRegionStep::PickHoles => t!(
|
|
|
|
|
"EXTRUDE REGION Select hole loop (%{count} picked, Enter when done):",
|
|
|
|
|
count = self.holes.len()
|
|
|
|
|
)
|
|
|
|
|
.into_owned(),
|
|
|
|
|
ExtrudeRegionStep::Height => t!("EXTRUDE REGION Height:").into_owned(),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fn needs_entity_pick(&self) -> bool {
|
|
|
|
|
matches!(
|
|
|
|
|
self.step,
|
|
|
|
|
ExtrudeRegionStep::PickOutline | ExtrudeRegionStep::PickHoles
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
fn entity_pick_uses_surface_point(&self) -> bool {
|
|
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
fn set_entity_pick_direction(&mut self, direction: Option<DVec3>) {
|
|
|
|
|
if self.step == ExtrudeRegionStep::PickOutline {
|
|
|
|
|
self.direction = direction.and_then(DVec3::try_normalize);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fn on_entity_pick(&mut self, handle: acadrust::Handle, point: DVec3) -> CmdResult {
|
|
|
|
|
if handle.is_null() {
|
|
|
|
|
return CmdResult::NeedPoint;
|
|
|
|
|
}
|
|
|
|
|
match self.step {
|
|
|
|
|
ExtrudeRegionStep::PickOutline => {
|
|
|
|
|
self.outline = handle;
|
|
|
|
|
self.anchor = point;
|
|
|
|
|
self.step = ExtrudeRegionStep::PickHoles;
|
|
|
|
|
}
|
|
|
|
|
ExtrudeRegionStep::PickHoles => {
|
|
|
|
|
if handle != self.outline && !self.holes.contains(&handle) {
|
|
|
|
|
self.holes.push(handle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ExtrudeRegionStep::Height => {}
|
|
|
|
|
}
|
|
|
|
|
CmdResult::NeedPoint
|
|
|
|
|
}
|
|
|
|
|
fn on_point(&mut self, pt: DVec3) -> CmdResult {
|
|
|
|
|
if self.step == ExtrudeRegionStep::Height {
|
|
|
|
|
let height = self
|
|
|
|
|
.direction
|
|
|
|
|
.map(|direction| (pt - self.anchor).dot(direction))
|
|
|
|
|
.unwrap_or_else(|| pt.distance(self.anchor));
|
|
|
|
|
if !height.is_finite() || height.abs() <= 1e-6 {
|
|
|
|
|
return CmdResult::NeedPoint;
|
|
|
|
|
}
|
|
|
|
|
return self.emit(height);
|
|
|
|
|
}
|
|
|
|
|
CmdResult::NeedPoint
|
|
|
|
|
}
|
|
|
|
|
fn wants_text_input(&self) -> bool {
|
|
|
|
|
self.step == ExtrudeRegionStep::Height
|
|
|
|
|
}
|
|
|
|
|
fn on_text_input(&mut self, text: &str) -> Option<CmdResult> {
|
|
|
|
|
crate::entities::common::parse_typed_length(text)
|
|
|
|
|
.filter(|&h| h.abs() > 1e-6)
|
|
|
|
|
.map(|h| self.emit(h))
|
|
|
|
|
}
|
|
|
|
|
fn on_enter(&mut self) -> CmdResult {
|
|
|
|
|
if self.step == ExtrudeRegionStep::PickHoles {
|
|
|
|
|
if self.outline.is_null() {
|
|
|
|
|
return CmdResult::Cancel;
|
|
|
|
|
}
|
|
|
|
|
self.step = ExtrudeRegionStep::Height;
|
|
|
|
|
return CmdResult::NeedPoint;
|
|
|
|
|
}
|
|
|
|
|
CmdResult::Cancel
|
|
|
|
|
}
|
|
|
|
|
fn cursor_axis(&self) -> Option<(DVec3, DVec3)> {
|
|
|
|
|
(self.step == ExtrudeRegionStep::Height).then_some((self.anchor, self.direction?))
|
|
|
|
|
}
|
|
|
|
|
fn dyn_spec(&self) -> Option<crate::command::DynSpec> {
|
|
|
|
|
(self.step == ExtrudeRegionStep::Height).then_some(crate::command::DynSpec {
|
|
|
|
|
anchor: crate::command::DynAnchor::Point(self.anchor),
|
|
|
|
|
fields: vec![crate::command::DynFieldSpec::new(
|
|
|
|
|
crate::command::DynRole::Distance,
|
|
|
|
|
)],
|
|
|
|
|
guide: crate::command::DynGuide::Radius,
|
|
|
|
|
ref_point: None,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
fn dyn_live_value(&self, cursor: DVec3) -> Option<f64> {
|
|
|
|
|
Some((cursor - self.anchor).dot(self.direction?))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-23 22:53:27 +03:00
|
|
|
// ── PRESSPULL command ─────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
pub struct PresspullCommand {
|
|
|
|
|
picked: Option<(acadrust::Handle, DVec3)>,
|
|
|
|
|
direction: Option<DVec3>,
|
|
|
|
|
color: [f32; 4],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl PresspullCommand {
|
|
|
|
|
pub fn new(color: [f32; 4]) -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
picked: None,
|
|
|
|
|
direction: None,
|
|
|
|
|
color,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl CadCommand for PresspullCommand {
|
|
|
|
|
fn name(&self) -> &'static str {
|
|
|
|
|
"PRESSPULL"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn prompt(&self) -> String {
|
|
|
|
|
if self.picked.is_none() {
|
|
|
|
|
t!("PRESSPULL Select a closed profile or planar solid face:").into_owned()
|
|
|
|
|
} else {
|
|
|
|
|
t!("PRESSPULL Signed distance:").into_owned()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn needs_entity_pick(&self) -> bool {
|
|
|
|
|
self.picked.is_none()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn entity_pick_includes_fills(&self) -> bool {
|
|
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn entity_pick_uses_surface_point(&self) -> bool {
|
|
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn set_entity_pick_direction(&mut self, direction: Option<DVec3>) {
|
|
|
|
|
self.direction = direction.and_then(|value| value.try_normalize());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn entity_pick_highlights_hover(&self) -> bool {
|
|
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn on_entity_pick(&mut self, handle: acadrust::Handle, point: DVec3) -> CmdResult {
|
|
|
|
|
if handle.is_null() {
|
|
|
|
|
return CmdResult::NeedPoint;
|
|
|
|
|
}
|
|
|
|
|
self.picked = Some((handle, point));
|
|
|
|
|
CmdResult::NeedPoint
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn on_point(&mut self, point: DVec3) -> CmdResult {
|
|
|
|
|
let Some((handle, pick)) = self.picked else {
|
|
|
|
|
return CmdResult::NeedPoint;
|
|
|
|
|
};
|
|
|
|
|
let distance = self
|
|
|
|
|
.direction
|
|
|
|
|
.map(|direction| (point - pick).dot(direction))
|
|
|
|
|
.unwrap_or_else(|| point.distance(pick));
|
|
|
|
|
if !distance.is_finite() || distance.abs() <= 1e-6 {
|
|
|
|
|
return CmdResult::NeedPoint;
|
|
|
|
|
}
|
|
|
|
|
CmdResult::PresspullEntity {
|
|
|
|
|
handle,
|
|
|
|
|
pick,
|
|
|
|
|
distance,
|
|
|
|
|
drag: Some(point),
|
|
|
|
|
color: self.color,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn wants_text_input(&self) -> bool {
|
|
|
|
|
self.picked.is_some()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn on_text_input(&mut self, text: &str) -> Option<CmdResult> {
|
|
|
|
|
let (handle, pick) = self.picked?;
|
|
|
|
|
crate::entities::common::parse_typed_length(text)
|
|
|
|
|
.filter(|distance| distance.abs() > 1e-6)
|
|
|
|
|
.map(|distance| CmdResult::PresspullEntity {
|
|
|
|
|
handle,
|
|
|
|
|
pick,
|
|
|
|
|
distance,
|
|
|
|
|
drag: None,
|
|
|
|
|
color: self.color,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn on_enter(&mut self) -> CmdResult {
|
|
|
|
|
CmdResult::Cancel
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn cursor_axis(&self) -> Option<(DVec3, DVec3)> {
|
|
|
|
|
Some((self.picked?.1, self.direction?))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn dyn_spec(&self) -> Option<crate::command::DynSpec> {
|
|
|
|
|
let (_, anchor) = self.picked?;
|
|
|
|
|
Some(crate::command::DynSpec {
|
|
|
|
|
anchor: crate::command::DynAnchor::Point(anchor),
|
|
|
|
|
fields: vec![crate::command::DynFieldSpec::new(
|
|
|
|
|
crate::command::DynRole::Distance,
|
|
|
|
|
)],
|
|
|
|
|
guide: crate::command::DynGuide::Radius,
|
|
|
|
|
ref_point: None,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn dyn_live_value(&self, cursor: DVec3) -> Option<f64> {
|
|
|
|
|
let (_, anchor) = self.picked?;
|
|
|
|
|
Some((cursor - anchor).dot(self.direction?))
|
|
|
|
|
}
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ── REVOLVE command ────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
pub struct RevolveCommand {
|
|
|
|
|
step: RevolveStep,
|
|
|
|
|
target_handle: acadrust::Handle,
|
fix(precision): keep typed coordinates exact in f64 (#311)
Typed values were quantized to the f32 grid before reaching the
entity (e.g. a length of 2000.8 committed as 2000.8020), worsening
with magnitude. The interaction point layer was all glam::Vec3 (f32).
Two-layer fix:
1. Coordinate backbone -> f64. last_point, last_cursor_world,
dyn_anchor, dyn_ref become DVec3; UcsXform transforms, parse_coord,
the ucs helper fns, dyn_resolve_point, the OTRACK typed-distance
paths, command-line coordinate entry and the coordinate readout all
compute in f64. Screen/GPU/alignment stays f32 (snap engine, render
geometry, projection, UCS-icon/viewcube drawing) with casts only at
those boundaries.
2. Per-command committed storage -> DVec3. on_point already received a
DVec3, but many command impls narrowed it back to f32 (let pt =
pt.as_vec3(); Vec<Vec3> fields) and re-widened at build, quantizing
the committed coordinate. Migrated PLINE, SPLINE, MLINE, LENGTHEN,
INSERT, 3D primitives, every dimension/leader/mleader, ray, revcloud,
wipeout, attdef, table, tolerance, array center, mview, plot_window,
plus the QDIM_PLACE handler and qdim_collect_points. Preview,
hit-test and rubber-band paths keep f32 at the boundary.
Hatch manual boundaries are left for a follow-up: HatchModel.boundary
is structurally Arc<Vec<[f32;2]>> and needs a model-level widen.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 21:26:40 +03:00
|
|
|
axis_start: DVec3,
|
|
|
|
|
axis_end: DVec3,
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
color: [f32; 4],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(PartialEq)]
|
2026-05-12 10:36:15 +03:00
|
|
|
enum RevolveStep {
|
|
|
|
|
Pick,
|
|
|
|
|
AxisStart,
|
|
|
|
|
AxisEnd,
|
|
|
|
|
Angle,
|
|
|
|
|
}
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
|
|
|
|
|
impl RevolveCommand {
|
|
|
|
|
pub fn new(color: [f32; 4]) -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
step: RevolveStep::Pick,
|
|
|
|
|
target_handle: acadrust::Handle::NULL,
|
fix(precision): keep typed coordinates exact in f64 (#311)
Typed values were quantized to the f32 grid before reaching the
entity (e.g. a length of 2000.8 committed as 2000.8020), worsening
with magnitude. The interaction point layer was all glam::Vec3 (f32).
Two-layer fix:
1. Coordinate backbone -> f64. last_point, last_cursor_world,
dyn_anchor, dyn_ref become DVec3; UcsXform transforms, parse_coord,
the ucs helper fns, dyn_resolve_point, the OTRACK typed-distance
paths, command-line coordinate entry and the coordinate readout all
compute in f64. Screen/GPU/alignment stays f32 (snap engine, render
geometry, projection, UCS-icon/viewcube drawing) with casts only at
those boundaries.
2. Per-command committed storage -> DVec3. on_point already received a
DVec3, but many command impls narrowed it back to f32 (let pt =
pt.as_vec3(); Vec<Vec3> fields) and re-widened at build, quantizing
the committed coordinate. Migrated PLINE, SPLINE, MLINE, LENGTHEN,
INSERT, 3D primitives, every dimension/leader/mleader, ray, revcloud,
wipeout, attdef, table, tolerance, array center, mview, plot_window,
plus the QDIM_PLACE handler and qdim_collect_points. Preview,
hit-test and rubber-band paths keep f32 at the boundary.
Hatch manual boundaries are left for a follow-up: HatchModel.boundary
is structurally Arc<Vec<[f32;2]>> and needs a model-level widen.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 21:26:40 +03:00
|
|
|
axis_start: DVec3::ZERO,
|
|
|
|
|
axis_end: DVec3::new(0.0, 0.0, 1.0),
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
color,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl CadCommand for RevolveCommand {
|
2026-05-12 10:36:15 +03:00
|
|
|
fn name(&self) -> &'static str {
|
|
|
|
|
"REVOLVE"
|
|
|
|
|
}
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
fn prompt(&self) -> String {
|
|
|
|
|
match self.step {
|
2026-08-02 22:09:25 +03:00
|
|
|
RevolveStep::Pick => t!("REVOLVE Select profile:").into_owned(),
|
|
|
|
|
RevolveStep::AxisStart => t!("REVOLVE Axis start point:").into_owned(),
|
|
|
|
|
RevolveStep::AxisEnd => t!("REVOLVE Axis end point:").into_owned(),
|
|
|
|
|
RevolveStep::Angle => t!("REVOLVE Angle of revolution <360>:").into_owned(),
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
}
|
|
|
|
|
}
|
2026-05-12 10:36:15 +03:00
|
|
|
fn needs_entity_pick(&self) -> bool {
|
|
|
|
|
self.step == RevolveStep::Pick
|
|
|
|
|
}
|
feat(f64): command layer compiles on DVec3
Whole command/snap/grip/cursor chain now builds on f64 DVec3 end to end,
so picked points, snaps and grip drags stay precise at UTM-scale
coordinates instead of quantizing to ~0.5 m through f32.
- All ~80 command files migrated: draw (line/circle/arc/ellipse/shapes
in full f64; others via point methods), modify, annotate, insert, view,
inquiry, layers, groups, clipboard, layout.
- Entity apply_grip impls updated for GripApply::{Absolute,Translate}(DVec3).
- Construction sites (EntityTransform/CmdResult/DynAnchor) emit DVec3;
wire-preview boundaries cast to f32 only at the GPU edge.
- Modify/annotate commands keep internal Vec3 geometry where precision is
non-critical, casting at the DVec3 boundary; key draw commands store f64.
Builds clean (no warnings). Visual verification of crosshair/snap/grip at
extreme UTM zoom pending.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 03:51:50 +03:00
|
|
|
fn on_entity_pick(&mut self, handle: acadrust::Handle, _pt: DVec3) -> CmdResult {
|
2026-05-12 10:36:15 +03:00
|
|
|
if handle.is_null() {
|
|
|
|
|
return CmdResult::NeedPoint;
|
|
|
|
|
}
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
self.target_handle = handle;
|
|
|
|
|
self.step = RevolveStep::AxisStart;
|
|
|
|
|
CmdResult::NeedPoint
|
|
|
|
|
}
|
fix(precision): keep typed coordinates exact in f64 (#311)
Typed values were quantized to the f32 grid before reaching the
entity (e.g. a length of 2000.8 committed as 2000.8020), worsening
with magnitude. The interaction point layer was all glam::Vec3 (f32).
Two-layer fix:
1. Coordinate backbone -> f64. last_point, last_cursor_world,
dyn_anchor, dyn_ref become DVec3; UcsXform transforms, parse_coord,
the ucs helper fns, dyn_resolve_point, the OTRACK typed-distance
paths, command-line coordinate entry and the coordinate readout all
compute in f64. Screen/GPU/alignment stays f32 (snap engine, render
geometry, projection, UCS-icon/viewcube drawing) with casts only at
those boundaries.
2. Per-command committed storage -> DVec3. on_point already received a
DVec3, but many command impls narrowed it back to f32 (let pt =
pt.as_vec3(); Vec<Vec3> fields) and re-widened at build, quantizing
the committed coordinate. Migrated PLINE, SPLINE, MLINE, LENGTHEN,
INSERT, 3D primitives, every dimension/leader/mleader, ray, revcloud,
wipeout, attdef, table, tolerance, array center, mview, plot_window,
plus the QDIM_PLACE handler and qdim_collect_points. Preview,
hit-test and rubber-band paths keep f32 at the boundary.
Hatch manual boundaries are left for a follow-up: HatchModel.boundary
is structurally Arc<Vec<[f32;2]>> and needs a model-level widen.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 21:26:40 +03:00
|
|
|
fn on_point(&mut self, pt: DVec3) -> CmdResult {
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
match self.step {
|
2026-05-12 10:36:15 +03:00
|
|
|
RevolveStep::AxisStart => {
|
|
|
|
|
self.axis_start = pt;
|
|
|
|
|
self.step = RevolveStep::AxisEnd;
|
|
|
|
|
CmdResult::NeedPoint
|
|
|
|
|
}
|
|
|
|
|
RevolveStep::AxisEnd => {
|
|
|
|
|
self.axis_end = pt;
|
|
|
|
|
self.step = RevolveStep::Angle;
|
|
|
|
|
CmdResult::NeedPoint
|
|
|
|
|
}
|
|
|
|
|
RevolveStep::Angle => self.make_revolve(360.0),
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
_ => CmdResult::NeedPoint,
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-05-12 10:36:15 +03:00
|
|
|
fn wants_text_input(&self) -> bool {
|
|
|
|
|
self.step == RevolveStep::Angle
|
|
|
|
|
}
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
fn on_text_input(&mut self, text: &str) -> Option<CmdResult> {
|
2026-05-12 10:36:15 +03:00
|
|
|
let angle = if text.trim().is_empty() {
|
|
|
|
|
360.0f32
|
|
|
|
|
} else {
|
|
|
|
|
text.trim()
|
|
|
|
|
.parse::<f32>()
|
|
|
|
|
.ok()
|
|
|
|
|
.filter(|&a| a.abs() > 1e-3)?
|
|
|
|
|
};
|
2026-08-23 22:53:27 +03:00
|
|
|
Some(self.make_revolve(angle))
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
}
|
|
|
|
|
fn on_enter(&mut self) -> CmdResult {
|
2026-05-12 10:36:15 +03:00
|
|
|
if self.step == RevolveStep::Angle {
|
|
|
|
|
self.make_revolve(360.0)
|
|
|
|
|
} else {
|
|
|
|
|
CmdResult::Cancel
|
|
|
|
|
}
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl RevolveCommand {
|
|
|
|
|
fn make_revolve(&self, angle_deg: f32) -> CmdResult {
|
|
|
|
|
CmdResult::RevolveEntity {
|
|
|
|
|
handle: self.target_handle,
|
fix(precision): keep typed coordinates exact in f64 (#311)
Typed values were quantized to the f32 grid before reaching the
entity (e.g. a length of 2000.8 committed as 2000.8020), worsening
with magnitude. The interaction point layer was all glam::Vec3 (f32).
Two-layer fix:
1. Coordinate backbone -> f64. last_point, last_cursor_world,
dyn_anchor, dyn_ref become DVec3; UcsXform transforms, parse_coord,
the ucs helper fns, dyn_resolve_point, the OTRACK typed-distance
paths, command-line coordinate entry and the coordinate readout all
compute in f64. Screen/GPU/alignment stays f32 (snap engine, render
geometry, projection, UCS-icon/viewcube drawing) with casts only at
those boundaries.
2. Per-command committed storage -> DVec3. on_point already received a
DVec3, but many command impls narrowed it back to f32 (let pt =
pt.as_vec3(); Vec<Vec3> fields) and re-widened at build, quantizing
the committed coordinate. Migrated PLINE, SPLINE, MLINE, LENGTHEN,
INSERT, 3D primitives, every dimension/leader/mleader, ray, revcloud,
wipeout, attdef, table, tolerance, array center, mview, plot_window,
plus the QDIM_PLACE handler and qdim_collect_points. Preview,
hit-test and rubber-band paths keep f32 at the boundary.
Hatch manual boundaries are left for a follow-up: HatchModel.boundary
is structurally Arc<Vec<[f32;2]>> and needs a model-level widen.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 21:26:40 +03:00
|
|
|
axis_start: self.axis_start,
|
|
|
|
|
axis_end: self.axis_end,
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
angle_deg,
|
|
|
|
|
color: self.color,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-08 18:07:00 +03:00
|
|
|
// ── SWEEP command ──────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
pub struct SweepCommand {
|
|
|
|
|
step: SweepStep,
|
|
|
|
|
profile_handle: acadrust::Handle,
|
|
|
|
|
color: [f32; 4],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(PartialEq)]
|
2026-05-12 10:36:15 +03:00
|
|
|
enum SweepStep {
|
|
|
|
|
PickProfile,
|
|
|
|
|
PickPath,
|
|
|
|
|
}
|
2026-04-08 18:07:00 +03:00
|
|
|
|
|
|
|
|
impl SweepCommand {
|
|
|
|
|
pub fn new(color: [f32; 4]) -> Self {
|
2026-05-12 10:36:15 +03:00
|
|
|
Self {
|
|
|
|
|
step: SweepStep::PickProfile,
|
|
|
|
|
profile_handle: acadrust::Handle::NULL,
|
|
|
|
|
color,
|
|
|
|
|
}
|
2026-04-08 18:07:00 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl CadCommand for SweepCommand {
|
2026-05-12 10:36:15 +03:00
|
|
|
fn name(&self) -> &'static str {
|
|
|
|
|
"SWEEP"
|
|
|
|
|
}
|
2026-04-08 18:07:00 +03:00
|
|
|
fn prompt(&self) -> String {
|
|
|
|
|
match self.step {
|
2026-08-02 22:09:25 +03:00
|
|
|
SweepStep::PickProfile => t!("SWEEP Select profile to sweep:").into_owned(),
|
|
|
|
|
SweepStep::PickPath => {
|
|
|
|
|
t!("SWEEP Select path (Line, Arc, LwPolyline):").into_owned()
|
|
|
|
|
}
|
2026-04-08 18:07:00 +03:00
|
|
|
}
|
|
|
|
|
}
|
2026-05-12 10:36:15 +03:00
|
|
|
fn needs_entity_pick(&self) -> bool {
|
|
|
|
|
true
|
|
|
|
|
}
|
feat(f64): command layer compiles on DVec3
Whole command/snap/grip/cursor chain now builds on f64 DVec3 end to end,
so picked points, snaps and grip drags stay precise at UTM-scale
coordinates instead of quantizing to ~0.5 m through f32.
- All ~80 command files migrated: draw (line/circle/arc/ellipse/shapes
in full f64; others via point methods), modify, annotate, insert, view,
inquiry, layers, groups, clipboard, layout.
- Entity apply_grip impls updated for GripApply::{Absolute,Translate}(DVec3).
- Construction sites (EntityTransform/CmdResult/DynAnchor) emit DVec3;
wire-preview boundaries cast to f32 only at the GPU edge.
- Modify/annotate commands keep internal Vec3 geometry where precision is
non-critical, casting at the DVec3 boundary; key draw commands store f64.
Builds clean (no warnings). Visual verification of crosshair/snap/grip at
extreme UTM zoom pending.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 03:51:50 +03:00
|
|
|
fn on_entity_pick(&mut self, handle: acadrust::Handle, _pt: DVec3) -> CmdResult {
|
2026-05-12 10:36:15 +03:00
|
|
|
if handle.is_null() {
|
|
|
|
|
return CmdResult::NeedPoint;
|
|
|
|
|
}
|
2026-04-08 18:07:00 +03:00
|
|
|
match self.step {
|
|
|
|
|
SweepStep::PickProfile => {
|
|
|
|
|
self.profile_handle = handle;
|
|
|
|
|
self.step = SweepStep::PickPath;
|
|
|
|
|
CmdResult::NeedPoint
|
|
|
|
|
}
|
2026-05-12 10:36:15 +03:00
|
|
|
SweepStep::PickPath => CmdResult::SweepEntity {
|
|
|
|
|
profile_handle: self.profile_handle,
|
|
|
|
|
path_handle: handle,
|
|
|
|
|
color: self.color,
|
|
|
|
|
},
|
2026-04-08 18:07:00 +03:00
|
|
|
}
|
|
|
|
|
}
|
feat(f64): command layer compiles on DVec3
Whole command/snap/grip/cursor chain now builds on f64 DVec3 end to end,
so picked points, snaps and grip drags stay precise at UTM-scale
coordinates instead of quantizing to ~0.5 m through f32.
- All ~80 command files migrated: draw (line/circle/arc/ellipse/shapes
in full f64; others via point methods), modify, annotate, insert, view,
inquiry, layers, groups, clipboard, layout.
- Entity apply_grip impls updated for GripApply::{Absolute,Translate}(DVec3).
- Construction sites (EntityTransform/CmdResult/DynAnchor) emit DVec3;
wire-preview boundaries cast to f32 only at the GPU edge.
- Modify/annotate commands keep internal Vec3 geometry where precision is
non-critical, casting at the DVec3 boundary; key draw commands store f64.
Builds clean (no warnings). Visual verification of crosshair/snap/grip at
extreme UTM zoom pending.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 03:51:50 +03:00
|
|
|
fn on_point(&mut self, _pt: DVec3) -> CmdResult {
|
2026-05-12 10:36:15 +03:00
|
|
|
CmdResult::NeedPoint
|
|
|
|
|
}
|
|
|
|
|
fn on_enter(&mut self) -> CmdResult {
|
|
|
|
|
CmdResult::Cancel
|
|
|
|
|
}
|
2026-04-08 18:07:00 +03:00
|
|
|
}
|
|
|
|
|
|
2026-04-08 18:08:53 +03:00
|
|
|
// ── LOFT command ───────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
pub struct LoftCommand {
|
|
|
|
|
profiles: Vec<acadrust::Handle>,
|
|
|
|
|
color: [f32; 4],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl LoftCommand {
|
|
|
|
|
pub fn new(color: [f32; 4]) -> Self {
|
2026-05-12 10:36:15 +03:00
|
|
|
Self {
|
|
|
|
|
profiles: Vec::new(),
|
|
|
|
|
color,
|
|
|
|
|
}
|
2026-04-08 18:08:53 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl CadCommand for LoftCommand {
|
2026-05-12 10:36:15 +03:00
|
|
|
fn name(&self) -> &'static str {
|
|
|
|
|
"LOFT"
|
|
|
|
|
}
|
2026-04-08 18:08:53 +03:00
|
|
|
fn prompt(&self) -> String {
|
|
|
|
|
if self.profiles.is_empty() {
|
2026-08-02 22:09:25 +03:00
|
|
|
t!("LOFT Select first cross-section:").into_owned()
|
2026-04-08 18:08:53 +03:00
|
|
|
} else {
|
2026-08-02 22:09:25 +03:00
|
|
|
t!(
|
|
|
|
|
"LOFT Select next cross-section (%{count} selected, Enter to finish):",
|
|
|
|
|
count = self.profiles.len()
|
2026-05-12 10:36:15 +03:00
|
|
|
)
|
2026-08-02 22:09:25 +03:00
|
|
|
.into_owned()
|
2026-04-08 18:08:53 +03:00
|
|
|
}
|
|
|
|
|
}
|
2026-05-12 10:36:15 +03:00
|
|
|
fn needs_entity_pick(&self) -> bool {
|
|
|
|
|
true
|
|
|
|
|
}
|
feat(f64): command layer compiles on DVec3
Whole command/snap/grip/cursor chain now builds on f64 DVec3 end to end,
so picked points, snaps and grip drags stay precise at UTM-scale
coordinates instead of quantizing to ~0.5 m through f32.
- All ~80 command files migrated: draw (line/circle/arc/ellipse/shapes
in full f64; others via point methods), modify, annotate, insert, view,
inquiry, layers, groups, clipboard, layout.
- Entity apply_grip impls updated for GripApply::{Absolute,Translate}(DVec3).
- Construction sites (EntityTransform/CmdResult/DynAnchor) emit DVec3;
wire-preview boundaries cast to f32 only at the GPU edge.
- Modify/annotate commands keep internal Vec3 geometry where precision is
non-critical, casting at the DVec3 boundary; key draw commands store f64.
Builds clean (no warnings). Visual verification of crosshair/snap/grip at
extreme UTM zoom pending.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 03:51:50 +03:00
|
|
|
fn on_entity_pick(&mut self, handle: acadrust::Handle, _pt: DVec3) -> CmdResult {
|
2026-05-12 10:36:15 +03:00
|
|
|
if handle.is_null() {
|
|
|
|
|
return CmdResult::NeedPoint;
|
|
|
|
|
}
|
2026-04-08 18:08:53 +03:00
|
|
|
// Avoid duplicate picks.
|
|
|
|
|
if !self.profiles.contains(&handle) {
|
|
|
|
|
self.profiles.push(handle);
|
|
|
|
|
}
|
|
|
|
|
CmdResult::NeedPoint
|
|
|
|
|
}
|
feat(f64): command layer compiles on DVec3
Whole command/snap/grip/cursor chain now builds on f64 DVec3 end to end,
so picked points, snaps and grip drags stay precise at UTM-scale
coordinates instead of quantizing to ~0.5 m through f32.
- All ~80 command files migrated: draw (line/circle/arc/ellipse/shapes
in full f64; others via point methods), modify, annotate, insert, view,
inquiry, layers, groups, clipboard, layout.
- Entity apply_grip impls updated for GripApply::{Absolute,Translate}(DVec3).
- Construction sites (EntityTransform/CmdResult/DynAnchor) emit DVec3;
wire-preview boundaries cast to f32 only at the GPU edge.
- Modify/annotate commands keep internal Vec3 geometry where precision is
non-critical, casting at the DVec3 boundary; key draw commands store f64.
Builds clean (no warnings). Visual verification of crosshair/snap/grip at
extreme UTM zoom pending.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 03:51:50 +03:00
|
|
|
fn on_point(&mut self, _pt: DVec3) -> CmdResult {
|
2026-05-12 10:36:15 +03:00
|
|
|
CmdResult::NeedPoint
|
|
|
|
|
}
|
|
|
|
|
fn wants_text_input(&self) -> bool {
|
|
|
|
|
self.profiles.len() >= 2
|
|
|
|
|
}
|
|
|
|
|
fn on_text_input(&mut self, _text: &str) -> Option<CmdResult> {
|
|
|
|
|
None
|
|
|
|
|
}
|
2026-04-08 18:08:53 +03:00
|
|
|
fn on_enter(&mut self) -> CmdResult {
|
|
|
|
|
if self.profiles.len() < 2 {
|
|
|
|
|
CmdResult::Cancel
|
|
|
|
|
} else {
|
2026-05-12 10:36:15 +03:00
|
|
|
CmdResult::LoftEntities {
|
|
|
|
|
handles: self.profiles.clone(),
|
|
|
|
|
color: self.color,
|
|
|
|
|
}
|
2026-04-08 18:08:53 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-23 22:53:27 +03:00
|
|
|
// ── Solid3D entity construction ────────────────────────────────────────────
|
feat: BOX, SPHERE, CYLINDER primitives + EXTRUDE / REVOLVE commands
BOX, SPHERE, and CYLINDER build truck topology solids and tessellate
them into MeshModels stored alongside a Solid3D placeholder entity so
the GPU mesh pipeline renders them immediately.
EXTRUDE picks any closed 2D profile (Circle, LwPolyline, etc.),
attaches a planar face via try_attach_plane, and translational-sweeps
it (tsweep Face → Solid) along Z by the given height.
REVOLVE picks a profile, two axis points, and an angle (default 360°),
then rotational-sweeps the wire (rsweep) around the axis.
Three new CmdResult variants drive the operations:
CommitSolid3D, ExtrudeEntity, RevolveEntity.
Scene::layer_color() added to retrieve the active layer's RGBA color.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:55:28 +03:00
|
|
|
|
|
|
|
|
pub fn empty_solid3d() -> EntityType {
|
|
|
|
|
EntityType::Solid3D(Solid3D::new())
|
|
|
|
|
}
|
2026-05-26 22:45:54 +03:00
|
|
|
|
|
|
|
|
// ── Autocomplete registry ─────────────────────────────────
|
2026-08-23 22:53:27 +03:00
|
|
|
inventory::submit!(crate::command::CommandRegistration {
|
|
|
|
|
names: &["EXTRUDE", "THICKEN", "PRESSPULL"]
|
|
|
|
|
});
|
2026-09-03 11:38:16 +10:00
|
|
|
inventory::submit!(crate::command::CommandRegistration {
|
|
|
|
|
names: &["EXTRUDEREGION"]
|
|
|
|
|
});
|
2026-08-23 22:53:27 +03:00
|
|
|
inventory::submit!(crate::command::CommandRegistration { names: &["LOFT"] });
|
|
|
|
|
inventory::submit!(crate::command::CommandRegistration { names: &["REVOLVE"] });
|
|
|
|
|
inventory::submit!(crate::command::CommandRegistration { names: &["SWEEP"] });
|