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
+13
-13
@@ -8,8 +8,8 @@ use glam::{DVec3, Mat4, Vec3};
|
||||
use iced::time::Instant;
|
||||
use iced::{Point, Rectangle};
|
||||
|
||||
use cadkernel::geom2d::Curve;
|
||||
use acadrust::types::Handle;
|
||||
use kernel::geom2d::Curve;
|
||||
use codec::types::Handle;
|
||||
|
||||
use crate::command::{DimensionAssociationSource, TangentObject};
|
||||
use crate::scene::model::wire_model::{SnapHint, TangentGeom, WireModel};
|
||||
@@ -2868,7 +2868,7 @@ fn tangent_line_endpoints(
|
||||
}
|
||||
|
||||
fn curves_in_frame(wire: &WireModel, frame: &WirePlane, tol: f64) -> Option<Vec<Curve>> {
|
||||
use cadkernel::geom2d::{Arc as KArc, Circle as KCircle, Ellipse as KEllipse, EllipseArc as KEllipseArc, Line as KLine};
|
||||
use kernel::geom2d::{Arc as KArc, Circle as KCircle, Ellipse as KEllipse, EllipseArc as KEllipseArc, Line as KLine};
|
||||
|
||||
let mut curves = Vec::new();
|
||||
|
||||
@@ -2986,11 +2986,11 @@ pub(crate) fn exact_curve_intersections(
|
||||
return None;
|
||||
}
|
||||
|
||||
let tolerance = cadkernel::geom2d::Tolerance::new(1e-9_f64.max(PLANE_TOL));
|
||||
let tolerance = kernel::geom2d::Tolerance::new(1e-9_f64.max(PLANE_TOL));
|
||||
let mut points: Vec<DVec3> = Vec::new();
|
||||
for ca in &curves_a {
|
||||
for cb in &curves_b {
|
||||
let crossings = cadkernel::geom2d::intersect(ca, cb, tolerance);
|
||||
let crossings = kernel::geom2d::intersect(ca, cb, tolerance);
|
||||
for c in crossings {
|
||||
let pt = frame.to_3d(c.point);
|
||||
if !points.iter().any(|existing| existing.distance_squared(pt) <= 1e-12) {
|
||||
@@ -3081,11 +3081,11 @@ fn seg_intersect_2d(a0: Point, a1: Point, b0: Point, b1: Point) -> Option<(f32,
|
||||
|
||||
/// Returns the two external tangent points on an XY circle.
|
||||
fn circle_tangent_points(p: Vec3, center: Vec3, radius: f32) -> Option<(Vec3, Vec3)> {
|
||||
let curve = cadkernel::geom2d::Curve::Circle(cadkernel::geom2d::Circle {
|
||||
let curve = kernel::geom2d::Curve::Circle(kernel::geom2d::Circle {
|
||||
centre: [center.x as f64, center.y as f64],
|
||||
radius: radius as f64,
|
||||
});
|
||||
let points = cadkernel::geom2d::tangent_from(&curve, [p.x as f64, p.y as f64]);
|
||||
let points = kernel::geom2d::tangent_from(&curve, [p.x as f64, p.y as f64]);
|
||||
let [first, second] = points.as_slice() else {
|
||||
return None;
|
||||
};
|
||||
@@ -3102,15 +3102,15 @@ fn planar_circle_tangent_points(
|
||||
axis_y: [f64; 3],
|
||||
radius: f64,
|
||||
) -> Vec<DVec3> {
|
||||
let plane = cadkernel::space::Plane::from_axes(center, axis_x, axis_y);
|
||||
let plane = kernel::space::Plane::from_axes(center, axis_x, axis_y);
|
||||
let Some(from) = plane.project(from.to_array()) else {
|
||||
return Vec::new();
|
||||
};
|
||||
let curve = cadkernel::geom2d::Curve::Circle(cadkernel::geom2d::Circle {
|
||||
let curve = kernel::geom2d::Curve::Circle(kernel::geom2d::Circle {
|
||||
centre: [0.0, 0.0],
|
||||
radius,
|
||||
});
|
||||
cadkernel::geom2d::tangent_from(&curve, from)
|
||||
kernel::geom2d::tangent_from(&curve, from)
|
||||
.into_iter()
|
||||
.map(|point| DVec3::from_array(plane.point_at(point.point)))
|
||||
.collect()
|
||||
@@ -3125,17 +3125,17 @@ fn arc_tangent_points(
|
||||
start_angle: f64,
|
||||
end_angle: f64,
|
||||
) -> Vec<DVec3> {
|
||||
let plane = cadkernel::space::Plane::from_axes(center, axis_x, axis_y);
|
||||
let plane = kernel::space::Plane::from_axes(center, axis_x, axis_y);
|
||||
let Some(from) = plane.project(from.to_array()) else {
|
||||
return Vec::new();
|
||||
};
|
||||
let curve = cadkernel::geom2d::Curve::Arc(cadkernel::geom2d::Arc {
|
||||
let curve = kernel::geom2d::Curve::Arc(kernel::geom2d::Arc {
|
||||
centre: [0.0, 0.0],
|
||||
radius,
|
||||
start_angle,
|
||||
end_angle,
|
||||
});
|
||||
cadkernel::geom2d::tangent_from(&curve, from)
|
||||
kernel::geom2d::tangent_from(&curve, from)
|
||||
.into_iter()
|
||||
.map(|point| DVec3::from_array(plane.point_at(point.point)))
|
||||
.collect()
|
||||
|
||||
Reference in new issue
Block a user