forked from 1b-agent/opencadstudio-upstream
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
56c04408d6
commit
f537aff75c
430 files changed
+9925
-8540
No files matched your search
+19
-19
@@ -28,17 +28,17 @@
|
||||
//! curves. They keep their own paths and this returns `None` for them, which
|
||||
//! is what lets a caller ask about any entity without checking first.
|
||||
|
||||
use acadrust::entities::{
|
||||
use codec::entities::{
|
||||
Arc as ArcEnt, Circle as CircleEnt, Ellipse as EllipseEnt, LwPolyline as LwPolylineEnt,
|
||||
Polyline2D, Spline as SplineEnt,
|
||||
};
|
||||
use acadrust::types::Vector3;
|
||||
use acadrust::EntityType;
|
||||
use cadkernel::geom2d::{
|
||||
use codec::types::Vector3;
|
||||
use codec::EntityType;
|
||||
use kernel::geom2d::{
|
||||
characteristic_points, Arc, Circle, Curve, Ellipse, EllipseArc, Line, Polyline, PolylineVertex,
|
||||
Ray, SnapKind, Transform, XLine,
|
||||
};
|
||||
use cadkernel::space::{are_coplanar, coplanarity_tolerance, PlanarCurve, Plane, Vec3};
|
||||
use kernel::space::{are_coplanar, coplanarity_tolerance, PlanarCurve, Plane, Vec3};
|
||||
|
||||
use crate::modules::draw::modify::spline_ops::spline_to_nurbs_on;
|
||||
use crate::scene::model::wire_model::SnapHint;
|
||||
@@ -109,12 +109,12 @@ pub fn entity_curve(entity: &EntityType) -> Option<PlanarCurve> {
|
||||
|
||||
/// Exact spatial source geometry for commands that traverse nonplanar curves.
|
||||
/// Curve construction and arc-length calculations remain in the kernel.
|
||||
pub fn entity_spatial_measurement(entity: &EntityType) -> Option<cadkernel::space::ArcLengthCurve3> {
|
||||
use cadkernel::space::{ArcLengthCurve3, NurbsCurve3};
|
||||
pub fn entity_spatial_measurement(entity: &EntityType) -> Option<kernel::space::ArcLengthCurve3> {
|
||||
use kernel::space::{ArcLengthCurve3, NurbsCurve3};
|
||||
let curve = match entity {
|
||||
EntityType::Polyline3D(polyline) => {
|
||||
if polyline.flags.spline_fit {
|
||||
use acadrust::entities::polyline3d::SmoothSurfaceType;
|
||||
use codec::entities::polyline3d::SmoothSurfaceType;
|
||||
let degree = match polyline.smooth_type {
|
||||
SmoothSurfaceType::QuadraticBSpline => 2,
|
||||
SmoothSurfaceType::CubicBSpline | SmoothSurfaceType::Bezier => 3,
|
||||
@@ -463,7 +463,7 @@ pub fn entity_with_lwpolyline_world_xy(entity: &EntityType) -> EntityType {
|
||||
|
||||
/// World-space wire points sampled by the kernel's angular policy.
|
||||
pub fn curve_points(curve: &PlanarCurve) -> Vec<[f64; 3]> {
|
||||
curve.tessellate_angle(cadkernel::tessellation::DEFAULT_ANGLE)
|
||||
curve.tessellate_angle(kernel::tessellation::DEFAULT_ANGLE)
|
||||
}
|
||||
|
||||
/// The snap candidates an entity's curve offers, in the two channels the
|
||||
@@ -530,9 +530,9 @@ fn normalized(normal: Vector3) -> Vector3 {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use acadrust::entities::lwpolyline::LwVertex;
|
||||
use acadrust::entities::{Line as LineEnt, Ray as RayEnt, XLine as XLineEnt};
|
||||
use acadrust::types::Vector2;
|
||||
use codec::entities::lwpolyline::LwVertex;
|
||||
use codec::entities::{Line as LineEnt, Ray as RayEnt, XLine as XLineEnt};
|
||||
use codec::types::Vector2;
|
||||
use std::f64::consts::{FRAC_PI_2, PI, TAU};
|
||||
|
||||
fn v3(x: f64, y: f64, z: f64) -> Vector3 {
|
||||
@@ -726,8 +726,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn spatial_polyline_measurement_uses_unflagged_fit_controls() {
|
||||
use acadrust::entities::polyline3d::SmoothSurfaceType;
|
||||
use acadrust::entities::{Polyline3D, Vertex3DPolyline};
|
||||
use codec::entities::polyline3d::SmoothSurfaceType;
|
||||
use codec::entities::{Polyline3D, Vertex3DPolyline};
|
||||
|
||||
let mut polyline = Polyline3D::new();
|
||||
polyline.flags.spline_fit = true;
|
||||
@@ -849,12 +849,12 @@ mod tests {
|
||||
/// where it happens rather than the next time somebody reaches for it.
|
||||
#[test]
|
||||
fn the_solid_layer_and_the_acis_bridge_are_reachable() {
|
||||
let solid = cadkernel::brep::make::cuboid([0.0; 3], [1.0; 3])
|
||||
let solid = kernel::brep::make::cuboid([0.0; 3], [1.0; 3])
|
||||
.expect("the kernel builds its own primitives");
|
||||
assert!(solid.validate().is_empty());
|
||||
assert_eq!(solid.euler_characteristic(), 2);
|
||||
let document = acadrust::entities::acis::types::SatDocument::new();
|
||||
let (bodies, loss) = cadkernel::acis::lift(&document);
|
||||
let document = codec::entities::acis::types::SatDocument::new();
|
||||
let (bodies, loss) = kernel::acis::lift(&document);
|
||||
assert!(bodies.is_empty() && loss.is_empty(), "an empty document lifts to nothing");
|
||||
}
|
||||
|
||||
@@ -886,14 +886,14 @@ mod tests {
|
||||
ray.base_point = v3(1.0, 1.0, 0.0);
|
||||
ray.direction = v3(2.0, 0.0, 0.0);
|
||||
let curve = entity_curve(&EntityType::Ray(ray)).unwrap();
|
||||
assert_eq!(curve.extent(), cadkernel::geom2d::Extent::Forward);
|
||||
assert_eq!(curve.extent(), kernel::geom2d::Extent::Forward);
|
||||
assert_eq!(curve.point_at(1.0), [3.0, 1.0, 0.0]);
|
||||
|
||||
let mut line = XLineEnt::default();
|
||||
line.base_point = v3(0.0, 0.0, 0.0);
|
||||
line.direction = v3(0.0, 3.0, 0.0);
|
||||
let curve = entity_curve(&EntityType::XLine(line)).unwrap();
|
||||
assert_eq!(curve.extent(), cadkernel::geom2d::Extent::Infinite);
|
||||
assert_eq!(curve.extent(), kernel::geom2d::Extent::Infinite);
|
||||
assert_eq!(curve.point_at(-1.0), [0.0, -3.0, 0.0]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user