Cargo: codec e023bc3 (acadrust sync), kernel abca4e8, graph c63556f

The codec now holds wide EntityType variants boxed (MText, Helix,
Dimension, Hatch, Viewport, MultiLeader, Surface, Table, Ole2Frame,
Light, Extended). Constructors box their entity; nested patterns reach
a dimension through entities::dimension::as_dimension(_mut). Also
follows BlockAction::action_ids, LineTypeComplexData::source_flags and
the decimal tab stop with an explicit character.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-16 09:17:01 +03:00
1 parent 218150c76a
commit e4d04ef132
87 files changed
+380 -269

No files matched your search

+1 -1
View File
@@ -1405,7 +1405,7 @@ mod paste_entities_kernel_tests {
fn remaps_leader_annotation_link_to_pasted_handles() {
let mut seed = codec::CadDocument::new();
let note = seed
.add_entity(codec::EntityType::MText(codec::entities::MText::new()))
.add_entity(codec::EntityType::MText(Box::new(codec::entities::MText::new())))
.unwrap();
let mut leader = codec::entities::Leader::default();
leader.annotation_handle = note;
+14 -8
View File
@@ -36,10 +36,12 @@ impl OpenCADStudio {
) {
let i = self.active_tab;
let valid = matches!(
self.tabs[i].scene.document.get_entity(dimension),
Some(codec::EntityType::Dimension(
codec::entities::Dimension::Linear(_) | codec::entities::Dimension::Aligned(_)
))
self.tabs[i]
.scene
.document
.get_entity(dimension)
.and_then(crate::entities::dimension::as_dimension),
Some(codec::entities::Dimension::Linear(_) | codec::entities::Dimension::Aligned(_))
);
if !valid {
self.command_line.push_error(
@@ -415,8 +417,12 @@ fn apply_dimspace(
requested_spacing: Option<f64>,
) -> bool {
use codec::entities::Dimension;
let (axis, normal, definition, auto_spacing) = match scene.document.get_entity(base_h) {
Some(codec::EntityType::Dimension(dimension @ Dimension::Linear(d))) => {
let base = scene
.document
.get_entity(base_h)
.and_then(crate::entities::dimension::as_dimension);
let (axis, normal, definition, auto_spacing) = match base {
Some(dimension @ Dimension::Linear(d)) => {
let spacing = dimension_auto_spacing(
&scene.document,
dimension,
@@ -433,7 +439,7 @@ fn apply_dimspace(
spacing,
)
}
Some(codec::EntityType::Dimension(dimension @ Dimension::Aligned(d))) => {
Some(dimension @ Dimension::Aligned(d)) => {
let spacing = dimension_auto_spacing(
&scene.document,
dimension,
@@ -471,7 +477,7 @@ fn apply_dimspace(
kernel::space::move_to_dimension_spacing([p.x, p.y, p.z], frame, target);
*p = codec::types::Vector3::new(point[0], point[1], point[2]);
};
match dim {
match &mut **dim {
Dimension::Linear(d) => {
slide(&mut d.definition_point);
d.base.definition_point = d.definition_point;
+6 -10
View File
@@ -39,10 +39,8 @@ impl OpenCADStudio {
let delta_safe = self.delta_add_safe(i, &entity);
let pending = self.begin_undo(i, label, 1, delta_safe);
let is_associative_dimension = matches!(
entity,
codec::EntityType::Dimension(
codec::entities::Dimension::Linear(_) | codec::entities::Dimension::Aligned(_)
)
crate::entities::dimension::as_dimension(&entity),
Some(codec::entities::Dimension::Linear(_) | codec::entities::Dimension::Aligned(_))
);
let association_enabled = self.tabs[i].scene.document.header.dimension_associativity == 2;
let committed = if preserve_commit_layer {
@@ -257,10 +255,8 @@ impl OpenCADStudio {
};
let pending = self.begin_undo(i, label, 1, delta_safe);
let is_associative_dimension = matches!(
entity,
codec::EntityType::Dimension(
codec::entities::Dimension::Linear(_) | codec::entities::Dimension::Aligned(_)
)
crate::entities::dimension::as_dimension(&entity),
Some(codec::entities::Dimension::Linear(_) | codec::entities::Dimension::Aligned(_))
);
let association_enabled = self.tabs[i].scene.document.header.dimension_associativity == 2;
let committed = if preserve_commit_layer {
@@ -324,8 +320,8 @@ impl OpenCADStudio {
let label = self.history_label_from_active_cmd(i, "DIMENSION");
let association_mode = self.tabs[i].scene.document.header.dimension_associativity;
let single_source_dimension = matches!(
&entity,
codec::EntityType::Dimension(codec::entities::Dimension::Ordinate(_))
crate::entities::dimension::as_dimension(&entity),
Some(codec::entities::Dimension::Ordinate(_))
);
// A dimension placed on the sheet but measuring model geometry
// through a viewport carries the compensation as a negative
+1 -1
View File
@@ -160,7 +160,7 @@ impl OpenCADStudio {
Operation::Rotate(degrees) => {
dimension.base_mut().text_rotation = degrees.to_radians();
}
Operation::Oblique(degrees) => match dimension {
Operation::Oblique(degrees) => match &mut **dimension {
codec::entities::Dimension::Linear(value) => {
value.ext_line_rotation = degrees.to_radians();
}
+1 -1
View File
@@ -463,7 +463,7 @@ impl OpenCADStudio {
false
}
};
match dim {
match &mut **dim {
Dimension::Linear(d) => {
stretched |= mv(&mut d.first_point);
stretched |= mv(&mut d.second_point);
+3 -2
View File
@@ -21,7 +21,7 @@ impl OpenCADStudio {
});
let label = self.history_label_from_active_cmd(i, "MVIEW");
let pending = self.begin_undo(i, label, 1, true);
let handle = self.commit_entity_handle(codec::EntityType::Viewport(viewport));
let handle = self.commit_entity_handle(codec::EntityType::Viewport(Box::new(viewport)));
if let (Some(handle), Some(saved)) = (handle, saved_view) {
if let Some(codec::EntityType::Viewport(viewport)) =
self.tabs[i].scene.document.get_entity_mut(handle)
@@ -244,7 +244,8 @@ impl OpenCADStudio {
viewport.id = 2;
viewport.clip_boundary_handle = clip_handle;
viewport.status.non_rectangular_clipping = !clip_handle.is_null();
let viewport_handle = self.commit_entity_handle(codec::EntityType::Viewport(viewport));
let viewport_handle =
self.commit_entity_handle(codec::EntityType::Viewport(Box::new(viewport)));
if let Some(viewport_handle) = viewport_handle {
if !created_boundary {
let before = self.tabs[i]