feat: node graph overlay; move to opencadcodec/opencadkernel/opencadgraph

The codec and kernel repositories and crates are renamed opencadcodec and
opencadkernel. Inside OCS they are depended on under short keys, so code
reads `codec::`, `kernel::` and the new `graph::` (opencadgraph, the node
graph engine). File-format and protocol spellings stay as they were: the
ACIS product id `acadrust`, the ACADRUST_* switches and the plugin
version keys `acadrust_version` / `acadrust_source`.

A button left of MCP on the command line opens a translucent node graph
over the viewport, with a palette of object, input, math, logic, list,
text and geometry nodes added by click or drag. An object node owns
drawing entities and its rows are the Properties panel's own rows for
them: the single-object page is extracted from refresh_properties as
entity_property_sections, values use the control protocol's
property_json, and writes go through set_property_value with a property
target override, so the panel, MCP and the graph share one read/write
path. A list reaching an object row makes one entity per element. Each
graph action is one undo step; the canvas pans and zooms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-09-25 07:34:23 +03:00
1 parent 56c04408d6
commit f537aff75c
430 files changed
+9925 -8540

No files matched your search

+3 -3
View File
@@ -1,8 +1,8 @@
// DIMALIGNED command — aligned dimension (measures true distance between two points).
use acadrust::entities::{Dimension, DimensionAligned};
use acadrust::types::{Handle, Vector3};
use acadrust::EntityType;
use codec::entities::{Dimension, DimensionAligned};
use codec::types::{Handle, Vector3};
use codec::EntityType;
use glam::DVec3;
use crate::command::{
+6 -6
View File
@@ -1,7 +1,7 @@
use acadrust::entities::{Dimension, DimensionAngular2Ln, DimensionAngular3Pt};
use acadrust::types::{Handle, Vector3};
use acadrust::EntityType;
use cadkernel::geom2d::{
use codec::entities::{Dimension, DimensionAngular2Ln, DimensionAngular3Pt};
use codec::types::{Handle, Vector3};
use codec::EntityType;
use kernel::geom2d::{
closest_point, line_line, Arc as KernelArc, BulgeArc, Curve as KernelCurve,
Line as KernelLine,
};
@@ -1172,13 +1172,13 @@ fn angular_preview_with_frame(
let second_end = vertex + DVec3::new(end.cos(), end.sin(), 0.0) * radius;
let mut points = vec![first, first_end, nan(), second, second_end, nan()];
points.extend(
cadkernel::geom2d::tessellate::arc(
kernel::geom2d::tessellate::arc(
[vertex.x, vertex.y],
radius,
start,
end,
vertex.z,
cadkernel::geom2d::tessellate::DEFAULT_SEGMENTS_PER_RADIAN,
kernel::geom2d::tessellate::DEFAULT_SEGMENTS_PER_RADIAN,
)
.into_iter()
.map(DVec3::from_array),
+1 -1
View File
@@ -1,4 +1,4 @@
use acadrust::Handle;
use codec::Handle;
use glam::DVec3;
use crate::command::{CadCommand, CmdResult};
+4 -4
View File
@@ -1,7 +1,7 @@
use acadrust::entities::{Dimension, DimensionArc};
use acadrust::types::{Handle, Vector3};
use acadrust::EntityType;
use cadkernel::geom2d::tessellate::{arc, DEFAULT_SEGMENTS_PER_RADIAN};
use codec::entities::{Dimension, DimensionArc};
use codec::types::{Handle, Vector3};
use codec::EntityType;
use kernel::geom2d::tessellate::{arc, DEFAULT_SEGMENTS_PER_RADIAN};
use glam::DVec3;
use crate::command::{
+5 -5
View File
@@ -4,8 +4,8 @@ use crate::command::{CadCommand, CmdResult, WorkingPlane};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::model::wire_model::WireModel;
use crate::t;
use acadrust::entities::Table;
use acadrust::EntityType;
use codec::entities::Table;
use codec::EntityType;
use glam::DVec3;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/data_link.svg"));
@@ -38,8 +38,8 @@ impl DataLinkPlaceCommand {
/// Place a table that references a data-link object already stored in the
/// drawing. Every populated cell is locked and points at the same link so
/// update and save/reopen keep one stable relationship.
pub fn existing(mut table: Table, link: acadrust::Handle) -> Self {
use acadrust::entities::table::CellStateFlags;
pub fn existing(mut table: Table, link: codec::Handle) -> Self {
use codec::entities::table::CellStateFlags;
let rows = table.row_count() as i32;
let columns = table.column_count() as i32;
for row in &mut table.rows {
@@ -156,7 +156,7 @@ impl CadCommand for DataLinkPlaceCommand {
fn on_point(&mut self, point: DVec3) -> CmdResult {
let point = self.plane.to_local(point);
self.table.insertion_point = acadrust::types::Vector3::new(point.x, point.y, point.z);
self.table.insertion_point = codec::types::Vector3::new(point.x, point.y, point.z);
CmdResult::CommitAndExit(
self.plane
.place_entity(EntityType::Table(self.table.clone())),
+1 -1
View File
@@ -7,7 +7,7 @@
// the rich MText editor for MText / MultiLeader. A Leader resolves to the
// entity it annotates.
use acadrust::Handle;
use codec::Handle;
use glam::DVec3;
use crate::command::{CadCommand, CmdResult};
+3 -3
View File
@@ -1,6 +1,6 @@
use acadrust::entities::{Dimension, DimensionDiameter};
use acadrust::types::{Handle, Vector3};
use acadrust::EntityType;
use codec::entities::{Dimension, DimensionDiameter};
use codec::types::{Handle, Vector3};
use codec::EntityType;
use glam::{DVec3, Vec3};
use crate::command::{
+5 -5
View File
@@ -1,16 +1,16 @@
use std::collections::HashMap;
use std::f64::consts::PI;
use acadrust::entities::{
use codec::entities::{
Dimension, DimensionAligned, DimensionAngular2Ln, DimensionAngular3Pt, DimensionBase,
DimensionLinear, DimensionOrdinate,
};
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle};
use cadkernel::geom2d::{
use codec::types::Vector3;
use codec::{EntityType, Handle};
use kernel::geom2d::{
arc_span, intersect, nearest_of, Arc, Curve, Line, Tolerance, Transform, Vec2, XLine,
};
use cadkernel::space::Plane;
use kernel::space::Plane;
use glam::DVec3;
use crate::command::{
+5 -5
View File
@@ -1,14 +1,14 @@
use acadrust::entities::{
use codec::entities::{
Dimension, DimensionAngular2Ln, DimensionAngular3Pt, DimensionBase, DimensionLinear,
DimensionOrdinate,
};
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle};
use cadkernel::geom2d::{
use codec::types::Vector3;
use codec::{EntityType, Handle};
use kernel::geom2d::{
arc_span, closest_point, intersect, nearest_of, Arc, Curve, Ray, Tolerance, Transform, Vec2,
XLine,
};
use cadkernel::space::Plane;
use kernel::space::Plane;
use glam::DVec3;
use crate::command::{
+1 -1
View File
@@ -1,6 +1,6 @@
// DIMBREAK — create automatic, object-driven or manual gaps in dimensions.
use acadrust::{EntityType, Handle};
use codec::{EntityType, Handle};
use glam::DVec3;
use crate::command::{CadCommand, CmdOption, CmdResult, InputKind};
+1 -1
View File
@@ -1,6 +1,6 @@
// DIMEDIT — edit dimension text, rotation, extension-line obliquing or home position.
use acadrust::Handle;
use codec::Handle;
use glam::DVec3;
use crate::command::{
+4 -4
View File
@@ -1,7 +1,7 @@
// DIMJOGLINE — add or remove a jog on a linear/aligned dimension.
use acadrust::entities::Dimension;
use acadrust::{EntityType, Handle};
use codec::entities::Dimension;
use codec::{EntityType, Handle};
use glam::DVec3;
use crate::command::{CadCommand, CmdOption, CmdResult, InputKind};
@@ -77,7 +77,7 @@ impl DimJogLineCommand {
} else {
[f64::NAN; 3]
};
cadkernel::space::default_dimension_jog_position(
kernel::space::default_dimension_jog_position(
[first.x, first.y, first.z],
[second.x, second.y, second.z],
[definition.x, definition.y, definition.z],
@@ -204,7 +204,7 @@ impl CadCommand for DimJogLineCommand {
),
_ => return None,
};
let points = cadkernel::space::dimension_jog_points(
let points = kernel::space::dimension_jog_points(
segment,
point.to_array(),
normal,
+5 -5
View File
@@ -5,7 +5,7 @@
// 2. Select the other dimensions to space (click each, Enter to finish)
// 3. Enter a non-negative spacing value, or choose Auto
use acadrust::{EntityType, Handle};
use codec::{EntityType, Handle};
use glam::DVec3;
use crate::command::{CadCommand, CmdOption, CmdResult, InputKind, SelectionEntity};
@@ -107,8 +107,8 @@ impl CadCommand for DimSpaceCommand {
&& matches!(
selected.entity,
EntityType::Dimension(
acadrust::entities::Dimension::Linear(_)
| acadrust::entities::Dimension::Aligned(_)
codec::entities::Dimension::Linear(_)
| codec::entities::Dimension::Aligned(_)
)
)
&& !others.contains(&selected.handle)
@@ -127,8 +127,8 @@ impl CadCommand for DimSpaceCommand {
if !matches!(
self.picked_entity.take(),
Some(EntityType::Dimension(
acadrust::entities::Dimension::Linear(_)
| acadrust::entities::Dimension::Aligned(_)
codec::entities::Dimension::Linear(_)
| codec::entities::Dimension::Aligned(_)
))
) {
return CmdResult::ReportError(
+6 -6
View File
@@ -1,7 +1,7 @@
// DIMTEDIT — reposition, justify, home or rotate existing dimension text.
use acadrust::entities::{AttachmentPointType, Dimension};
use acadrust::{EntityType, Handle};
use codec::entities::{AttachmentPointType, Dimension};
use codec::{EntityType, Handle};
use glam::DVec3;
use crate::command::{CadCommand, CmdOption, CmdResult, InputKind};
@@ -184,7 +184,7 @@ impl CadCommand for DimTeditCommand {
let EntityType::Dimension(dimension) = &mut entity else {
return CmdResult::Cancel;
};
let point = acadrust::types::Vector3::new(point.x, point.y, point.z);
let point = codec::types::Vector3::new(point.x, point.y, point.z);
let base = dimension.base_mut();
base.text_middle_point = point;
base.insertion_point = point;
@@ -274,8 +274,8 @@ fn dimension_line_endpoints(dimension: &Dimension) -> Option<(DVec3, DVec3)> {
fn apply_placement(dimension: &mut Dimension, placement: Placement) {
if matches!(placement, Placement::Home) {
let base = dimension.base_mut();
base.text_middle_point = acadrust::types::Vector3::ZERO;
base.insertion_point = acadrust::types::Vector3::ZERO;
base.text_middle_point = codec::types::Vector3::ZERO;
base.insertion_point = codec::types::Vector3::ZERO;
base.text_user_positioned = false;
base.attachment_point = AttachmentPointType::MiddleCenter;
return;
@@ -289,7 +289,7 @@ fn apply_placement(dimension: &mut Dimension, placement: Placement) {
Placement::Center => ((left + right) * 0.5, AttachmentPointType::MiddleCenter),
Placement::Home => unreachable!(),
};
let point = acadrust::types::Vector3::new(point.x, point.y, point.z);
let point = codec::types::Vector3::new(point.x, point.y, point.z);
let base = dimension.base_mut();
base.text_middle_point = point;
base.insertion_point = point;
+3 -3
View File
@@ -1,6 +1,6 @@
use acadrust::entities::{Dimension, DimensionLargeRadial};
use acadrust::types::{Handle, Vector3};
use acadrust::EntityType;
use codec::entities::{Dimension, DimensionLargeRadial};
use codec::types::{Handle, Vector3};
use codec::EntityType;
use glam::{DVec3, Vec3};
use crate::command::{
+4 -4
View File
@@ -9,10 +9,10 @@
// The MText is a separate entity referenced by the leader's annotation_handle
// (DXF group 340); editing/erasing them stays in sync via that link.
use acadrust::entities::mtext::AttachmentPoint;
use acadrust::entities::{Leader, LeaderCreationType, LeaderPathType, MText};
use acadrust::types::Vector3;
use acadrust::EntityType;
use codec::entities::mtext::AttachmentPoint;
use codec::entities::{Leader, LeaderCreationType, LeaderPathType, MText};
use codec::types::Vector3;
use codec::EntityType;
use glam::{DVec3, Mat4, Vec3};
use crate::command::{CadCommand, CmdOption, CmdResult, InputKind, WorkingPlane};
+6 -6
View File
@@ -1,7 +1,7 @@
use acadrust::entities::{Dimension, DimensionLinear};
use acadrust::types::Vector3;
use acadrust::EntityType;
use cadkernel::geom2d::{
use codec::entities::{Dimension, DimensionLinear};
use codec::types::Vector3;
use codec::EntityType;
use kernel::geom2d::{
closest_point, Circle as KernelCircle, Curve, Line as KernelLine,
};
@@ -87,7 +87,7 @@ pub struct LinearDimensionCommand {
axis_mode: AxisMode,
selecting_object: bool,
picked_entity: Option<EntityType>,
source_handle: Option<acadrust::Handle>,
source_handle: Option<codec::Handle>,
mtext_override: bool,
}
@@ -368,7 +368,7 @@ impl CadCommand for LinearDimensionCommand {
self.picked_entity = Some(entity);
}
fn on_entity_pick(&mut self, handle: acadrust::Handle, point: DVec3) -> CmdResult {
fn on_entity_pick(&mut self, handle: codec::Handle, point: DVec3) -> CmdResult {
let Some(entity) = self.picked_entity.take() else {
return CmdResult::NeedPoint;
};
+33 -33
View File
@@ -1,8 +1,8 @@
// MLEADER: pick the arrow and elbow, then edit the text.
use acadrust::entities::{LeaderContentType, MultiLeader, MultiLeaderPathType};
use acadrust::types::Vector3;
use acadrust::EntityType;
use codec::entities::{LeaderContentType, MultiLeader, MultiLeaderPathType};
use codec::types::Vector3;
use codec::EntityType;
use glam::{DVec3, Mat4, Vec3};
use crate::command::{CadCommand, CmdOption, CmdResult, InputKind, WorkingPlane};
@@ -24,7 +24,7 @@ pub fn tool() -> ToolDef {
pub struct MLeaderCommand {
verts: Vec<DVec3>,
plane: WorkingPlane,
style: Option<acadrust::objects::MultiLeaderStyle>,
style: Option<codec::objects::MultiLeaderStyle>,
display_scale: f64,
order: CreationOrder,
step: Step,
@@ -38,11 +38,11 @@ pub struct MLeaderCommand {
layer: String,
text: String,
picked_entity: Option<EntityType>,
selected_mtext: Option<acadrust::entities::MText>,
block_sources: Vec<(String, acadrust::Handle)>,
block_handle: Option<acadrust::Handle>,
selected_mtext: Option<codec::entities::MText>,
block_sources: Vec<(String, codec::Handle)>,
block_handle: Option<codec::Handle>,
layers: Vec<String>,
text_styles: Vec<(String, acadrust::Handle)>,
text_styles: Vec<(String, codec::Handle)>,
}
#[derive(Clone, Copy, PartialEq, Eq)]
@@ -97,7 +97,7 @@ impl MLeaderCommand {
}
pub fn with_style(
style: acadrust::objects::MultiLeaderStyle,
style: codec::objects::MultiLeaderStyle,
annotation_multiplier: f64,
) -> Self {
let display_scale = if style.is_annotative {
@@ -134,9 +134,9 @@ impl MLeaderCommand {
pub fn with_drawing_resources(
mut self,
block_sources: Vec<(String, acadrust::Handle)>,
block_sources: Vec<(String, codec::Handle)>,
layers: Vec<String>,
text_styles: Vec<(String, acadrust::Handle)>,
text_styles: Vec<(String, codec::Handle)>,
) -> Self {
self.block_sources = block_sources;
self.layers = layers;
@@ -226,36 +226,36 @@ impl MLeaderCommand {
ml.context.background_fill_color = source.background_color;
ml.context.background_transparency = source.background_transparency;
ml.context.text_flow_direction = match source.drawing_direction {
acadrust::entities::mtext::DrawingDirection::LeftToRight => {
acadrust::entities::multileader::FlowDirectionType::Horizontal
codec::entities::mtext::DrawingDirection::LeftToRight => {
codec::entities::multileader::FlowDirectionType::Horizontal
}
acadrust::entities::mtext::DrawingDirection::TopToBottom => {
acadrust::entities::multileader::FlowDirectionType::Vertical
codec::entities::mtext::DrawingDirection::TopToBottom => {
codec::entities::multileader::FlowDirectionType::Vertical
}
acadrust::entities::mtext::DrawingDirection::ByStyle => {
acadrust::entities::multileader::FlowDirectionType::ByStyle
codec::entities::mtext::DrawingDirection::ByStyle => {
codec::entities::multileader::FlowDirectionType::ByStyle
}
};
let (attachment, alignment) = match source.attachment_point {
acadrust::entities::mtext::AttachmentPoint::TopCenter
| acadrust::entities::mtext::AttachmentPoint::MiddleCenter
| acadrust::entities::mtext::AttachmentPoint::BottomCenter => {
codec::entities::mtext::AttachmentPoint::TopCenter
| codec::entities::mtext::AttachmentPoint::MiddleCenter
| codec::entities::mtext::AttachmentPoint::BottomCenter => {
(
acadrust::entities::multileader::TextAttachmentPointType::Center,
acadrust::entities::TextAlignmentType::Center,
codec::entities::multileader::TextAttachmentPointType::Center,
codec::entities::TextAlignmentType::Center,
)
}
acadrust::entities::mtext::AttachmentPoint::TopRight
| acadrust::entities::mtext::AttachmentPoint::MiddleRight
| acadrust::entities::mtext::AttachmentPoint::BottomRight => {
codec::entities::mtext::AttachmentPoint::TopRight
| codec::entities::mtext::AttachmentPoint::MiddleRight
| codec::entities::mtext::AttachmentPoint::BottomRight => {
(
acadrust::entities::multileader::TextAttachmentPointType::Right,
acadrust::entities::TextAlignmentType::Right,
codec::entities::multileader::TextAttachmentPointType::Right,
codec::entities::TextAlignmentType::Right,
)
}
_ => (
acadrust::entities::multileader::TextAttachmentPointType::Left,
acadrust::entities::TextAlignmentType::Left,
codec::entities::multileader::TextAttachmentPointType::Left,
codec::entities::TextAlignmentType::Left,
),
};
ml.context.text_attachment_point = attachment;
@@ -625,7 +625,7 @@ impl CadCommand for MLeaderCommand {
self.picked_entity = Some(entity);
}
fn on_entity_pick(&mut self, _handle: acadrust::Handle, _point: DVec3) -> CmdResult {
fn on_entity_pick(&mut self, _handle: codec::Handle, _point: DVec3) -> CmdResult {
let Some(EntityType::MText(text)) = self.picked_entity.take() else {
return CmdResult::NeedPoint;
};
@@ -655,7 +655,7 @@ fn build_mleader(
verts: &[DVec3],
content_point: Option<DVec3>,
ucs: Mat4,
style: Option<&acadrust::objects::MultiLeaderStyle>,
style: Option<&codec::objects::MultiLeaderStyle>,
display_scale: f64,
) -> MultiLeader {
// First point is the arrow, last point is the elbow. Intermediate points
@@ -695,9 +695,9 @@ fn build_mleader(
let landing = ux * (sign as f32);
ml.context.text_attachment_point =
if to_right {
acadrust::entities::multileader::TextAttachmentPointType::Left
codec::entities::multileader::TextAttachmentPointType::Left
} else {
acadrust::entities::multileader::TextAttachmentPointType::Right
codec::entities::multileader::TextAttachmentPointType::Right
};
ml.context.text_rotation = (ux.y as f64).atan2(ux.x as f64);
+4 -4
View File
@@ -5,10 +5,10 @@
// MLEADERALIGN: select multileaders → pick base alignment direction
// MLEADERCOLLECT: select block-content multileaders → pick collection point
use acadrust::entities::{LeaderLine, MultiLeader};
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle};
use cadkernel::geom2d::{closest_point, Curve, Line};
use codec::entities::{LeaderLine, MultiLeader};
use codec::types::Vector3;
use codec::{EntityType, Handle};
use kernel::geom2d::{closest_point, Curve, Line};
use glam::{DVec3, Vec3};
use crate::command::{CadCommand, CmdResult};
+3 -3
View File
@@ -1,6 +1,6 @@
use acadrust::entities::mtext::AttachmentPoint;
use acadrust::types::Vector3;
use acadrust::MText;
use codec::entities::mtext::AttachmentPoint;
use codec::types::Vector3;
use codec::MText;
use glam::DVec3;
use crate::command::{CadCommand, CmdOption, CmdResult, DynField, InputKind, WorkingPlane};
+3 -3
View File
@@ -1,6 +1,6 @@
use acadrust::entities::{Dimension, DimensionOrdinate};
use acadrust::types::Vector3;
use acadrust::EntityType;
use codec::entities::{Dimension, DimensionOrdinate};
use codec::types::Vector3;
use codec::EntityType;
use glam::{DVec3, Vec3};
use crate::command::{
+4 -4
View File
@@ -1,9 +1,9 @@
//! Quick dimension creation from a selected set of drawing entities.
use acadrust::entities::{Dimension, DimensionDiameter, DimensionLinear, DimensionOrdinate, DimensionRadius};
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle};
use cadkernel::geom2d::{characteristic_points, intersect, Curve, SnapKind, Tolerance};
use codec::entities::{Dimension, DimensionDiameter, DimensionLinear, DimensionOrdinate, DimensionRadius};
use codec::types::Vector3;
use codec::{EntityType, Handle};
use kernel::geom2d::{characteristic_points, intersect, Curve, SnapKind, Tolerance};
use glam::DVec3;
use crate::command::{
+3 -3
View File
@@ -1,6 +1,6 @@
use acadrust::entities::{Dimension, DimensionRadius};
use acadrust::types::{Handle, Vector3};
use acadrust::EntityType;
use codec::entities::{Dimension, DimensionRadius};
use codec::types::{Handle, Vector3};
use codec::EntityType;
use crate::command::{
CadCommand, CmdOption, CmdResult, DimensionAssociationInput, DimensionPreview, InputKind,
+27 -27
View File
@@ -4,10 +4,10 @@
// data rows. The command remembers its previous settings and supports either a
// fixed insertion point or a two-corner sizing window.
use acadrust::entities::table::{CellStyle, CellStylePropertyFlags};
use acadrust::entities::TableBuilder;
use acadrust::types::Vector3;
use acadrust::EntityType;
use codec::entities::table::{CellStyle, CellStylePropertyFlags};
use codec::entities::TableBuilder;
use codec::types::Vector3;
use codec::EntityType;
use glam::DVec3;
use std::sync::{Mutex, OnceLock};
@@ -96,7 +96,7 @@ enum Step {
pub struct TableCommand {
step: Step,
style_handle: Option<acadrust::Handle>,
style_handle: Option<codec::Handle>,
suggested_column_width: f64,
suggested_row_height: f64,
preview_scale: f64,
@@ -107,7 +107,7 @@ pub struct TableCommand {
plane: WorkingPlane,
}
fn cell_style_from_row(style: &acadrust::objects::RowCellStyle) -> CellStyle {
fn cell_style_from_row(style: &codec::objects::RowCellStyle) -> CellStyle {
let mut result = CellStyle::new();
result.property_flags = CellStylePropertyFlags::DATA_TYPE
| CellStylePropertyFlags::DATA_FORMAT
@@ -130,7 +130,7 @@ fn cell_style_from_row(style: &acadrust::objects::RowCellStyle) -> CellStyle {
}
fn selected_row_style(
table_style: &acadrust::objects::TableStyle,
table_style: &codec::objects::TableStyle,
name: &str,
) -> CellStyle {
let style = if name.eq_ignore_ascii_case("Title") {
@@ -160,8 +160,8 @@ impl TableCommand {
}
pub fn with_style(
style_handle: acadrust::Handle,
style: &acadrust::objects::TableStyle,
style_handle: codec::Handle,
style: &codec::objects::TableStyle,
annotation_multiplier: f64,
) -> Self {
let text_height = style
@@ -192,7 +192,7 @@ impl TableCommand {
/// Table dialog. The dialog owns validation, so the command starts at the
/// point/window placement step instead of asking for the same values again.
pub fn configured(
style: Option<(acadrust::Handle, &acadrust::objects::TableStyle)>,
style: Option<(codec::Handle, &codec::objects::TableStyle)>,
annotation_multiplier: f64,
columns: usize,
data_rows: usize,
@@ -609,7 +609,7 @@ pub(crate) enum TableCellEditStart {
impl TableCellHit {
/// Flat cell index, matching the Properties palette ordering.
pub fn index(&self, table: &acadrust::entities::Table) -> usize {
pub fn index(&self, table: &codec::entities::Table) -> usize {
self.row * table.column_count() + self.column
}
}
@@ -620,8 +620,8 @@ impl TableCellHit {
/// object the table references, when the caller has the document at hand;
/// the table's embedded base style covers the common fallbacks.
pub(crate) fn table_cell_at(
table: &acadrust::entities::Table,
table_style: Option<&acadrust::objects::TableStyle>,
table: &codec::entities::Table,
table_style: Option<&codec::objects::TableStyle>,
click_world: DVec3,
) -> Option<TableCellHit> {
let horizontal = glam::DVec3::new(
@@ -671,8 +671,8 @@ pub(crate) fn table_cell_at(
}
/// True when the cell's content may not be edited (locked or read-only).
pub(crate) fn cell_locked(table: &acadrust::entities::Table, row: usize, column: usize) -> bool {
use acadrust::entities::table::CellStateFlags;
pub(crate) fn cell_locked(table: &codec::entities::Table, row: usize, column: usize) -> bool {
use codec::entities::table::CellStateFlags;
table.cell(row, column).is_some_and(|cell| {
cell.state
.intersects(CellStateFlags::CONTENT_LOCKED | CellStateFlags::CONTENT_READ_ONLY)
@@ -708,7 +708,7 @@ impl CadCommand for TableditCommand {
fn on_point(&mut self, point: DVec3) -> CmdResult {
CmdResult::EditTableCell {
handle: acadrust::Handle::NULL,
handle: codec::Handle::NULL,
point,
}
}
@@ -725,16 +725,16 @@ inventory::submit!(crate::command::CommandRegistration {
});
pub struct TableCellEditCommand {
handle: acadrust::Handle,
table: acadrust::entities::Table,
handle: codec::Handle,
table: codec::entities::Table,
row: usize,
column: usize,
}
impl TableCellEditCommand {
pub fn new(
handle: acadrust::Handle,
table: &acadrust::entities::Table,
handle: codec::Handle,
table: &codec::entities::Table,
row: usize,
column: usize,
) -> Self {
@@ -779,7 +779,7 @@ impl CadCommand for TableCellEditCommand {
}
fn on_text_input(&mut self, text: &str) -> Option<CmdResult> {
use acadrust::entities::table::CellStateFlags;
use codec::entities::table::CellStateFlags;
let cell = self.table.cell_mut(self.row, self.column)?;
if cell
.state
@@ -815,9 +815,9 @@ mod tabledit_tests {
//! default orientation (horizontal +X, flow down).
use super::{table_cell_at, TableCellEditCommand, TableCellHit, TableditCommand};
use crate::command::{CadCommand, CmdResult};
use acadrust::entities::Table;
use acadrust::entities::table::CellStateFlags;
use acadrust::types::Vector3;
use codec::entities::Table;
use codec::entities::table::CellStateFlags;
use codec::types::Vector3;
use glam::DVec3;
fn table_2x2() -> Table {
@@ -892,7 +892,7 @@ mod tabledit_tests {
handle,
point,
} => {
assert_eq!(handle, acadrust::Handle::NULL);
assert_eq!(handle, codec::Handle::NULL);
assert_eq!(point, DVec3::new(1.0, 2.0, 0.0));
}
_ => panic!("expected EditTableCell"),
@@ -904,7 +904,7 @@ mod tabledit_tests {
#[test]
fn table_cell_edit_formats_newlines() {
let table = table_2x2();
let handle = acadrust::Handle::new(42);
let handle = codec::Handle::new(42);
let mut edit_cmd = TableCellEditCommand::new(handle, &table, 0, 0);
let result = edit_cmd
.on_text_input("Line1/nLine2\\nLine3\nLine4")
@@ -912,7 +912,7 @@ mod tabledit_tests {
match result {
CmdResult::ReplaceMany(repl, _) => {
assert_eq!(repl.len(), 1);
if let acadrust::EntityType::Table(t) = &repl[0].1[0] {
if let codec::EntityType::Table(t) = &repl[0].1[0] {
assert_eq!(t.cell_text(0, 0).unwrap(), "Line1\\PLine2\\PLine3\\PLine4");
} else {
panic!("expected Table entity");
+3 -3
View File
@@ -1,8 +1,8 @@
use acadrust::entities::{
use codec::entities::{
Text, TextHorizontalAlignment as HA, TextVerticalAlignment as VA,
};
use acadrust::tables::TextStyle;
use acadrust::types::Vector3;
use codec::tables::TextStyle;
use codec::types::Vector3;
use glam::DVec3;
use crate::command::{CadCommand, CmdOption, CmdResult, WorkingPlane};
+1 -1
View File
@@ -7,7 +7,7 @@
// and when closed, resumes the command loop.
// 4. In Single mode, editing an object exits the command immediately.
use acadrust::Handle;
use codec::Handle;
use glam::DVec3;
use crate::command::{CadCommand, CmdResult};
+3 -3
View File
@@ -2,9 +2,9 @@
//
// The structured editor prepares the frame; this command places it.
use acadrust::entities::Tolerance;
use acadrust::types::Vector3;
use acadrust::EntityType;
use codec::entities::Tolerance;
use codec::types::Vector3;
use codec::EntityType;
use glam::DVec3;
use crate::command::{CadCommand, CmdResult, WorkingPlane};