fix(extrude): store the fallback profile in place under group 295; kernel f051138, graph fbee68b

#1666 sets group 295 on extrusion history records, which makes the kernel
read the embedded profile and path where they stand and ignore the
matrices. The planar fallback profile (a region-derived LWPOLYLINE) was
stored in its plane's local frame with the frame as matrix, so with the
flag it rebuilt at the origin. Re-express it in its own OCS (normal and
elevation) when the record is built.

Pins the kernel and graph at upstream (opencadkernel#84 merged as f051138)
instead of the ramox81/cadkernel [patch].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-11 23:22:55 +03:00
1 parent eb2b2b5f3d
commit 656f0cead6
3 files changed
+34 -6

No files matched your search

Generated
+3 -3
View File
@@ -4228,7 +4228,7 @@ dependencies = [
[[package]]
name = "opencadgraph"
version = "0.1.0"
source = "git+https://github.com/HakanSeven12/opencadgraph.git?rev=f4fdb80#f4fdb800292f53a1454466b638ae0610a2b5b7f0"
source = "git+https://github.com/HakanSeven12/opencadgraph.git?rev=fbee68b#fbee68bf9e81932c07681a43d391eef194e9d484"
dependencies = [
"opencadkernel",
"serde_json",
@@ -4237,7 +4237,7 @@ dependencies = [
[[package]]
name = "opencadkernel"
version = "0.1.0"
source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=71770e1#71770e10687f2f5b96745502315f83ca90c5c83f"
source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=f051138#f0511383be10c7e515e10fd12489ff76ae7abc46"
dependencies = [
"cavalier_contours",
"opencadcodec",
@@ -4248,7 +4248,7 @@ dependencies = [
[[package]]
name = "opencadkernel-constraints"
version = "0.1.0"
source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=71770e1#71770e10687f2f5b96745502315f83ca90c5c83f"
source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=f051138#f0511383be10c7e515e10fd12489ff76ae7abc46"
dependencies = [
"nalgebra",
]
+3 -3
View File
@@ -35,9 +35,9 @@ clap = { version = "4", features = ["derive", "string"] }
env_logger = "0.11"
log = "0.4"
codec = { package = "opencadcodec", git = "https://github.com/HakanSeven12/opencadcodec.git", rev = "8189f83", features = ["serde"] }
kernel = { package = "opencadkernel", git = "https://github.com/HakanSeven12/opencadkernel.git", rev = "71770e1", features = ["acis", "offset"] }
kernel-constraints = { package = "opencadkernel-constraints", git = "https://github.com/HakanSeven12/opencadkernel.git", rev = "71770e1" }
graph = { package = "opencadgraph", git = "https://github.com/HakanSeven12/opencadgraph.git", rev = "f4fdb80" }
kernel = { package = "opencadkernel", git = "https://github.com/HakanSeven12/opencadkernel.git", rev = "f051138", features = ["acis", "offset"] }
kernel-constraints = { package = "opencadkernel-constraints", git = "https://github.com/HakanSeven12/opencadkernel.git", rev = "f051138" }
graph = { package = "opencadgraph", git = "https://github.com/HakanSeven12/opencadgraph.git", rev = "fbee68b" }
dwg-thumbnailer = { path = "crates/dwg-thumbnailer" }
flate2 = "1"
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "bmp", "tiff"] }
+28
View File
@@ -685,6 +685,32 @@ pub fn embedded_revolve_profile(entity: &EntityType) -> Option<(EmbeddedEntity,
embedded_planar_entity(entity)
}
/// Extrusion records set group 295 (see `extrusion_history`): their embedded
/// entities stand where they are and the matrices only name their frames. A
/// planar fallback profile stored in its plane's local frame is therefore
/// re-expressed in its own OCS.
fn embedded_in_place(entity: EmbeddedEntity, transform: &[f64; 16]) -> EmbeddedEntity {
let frame = glam::DMat4::from_cols_array(transform);
let EmbeddedEntity::LwPolyline(mut polyline) = entity else {
return entity;
};
if frame == glam::DMat4::IDENTITY {
return EmbeddedEntity::LwPolyline(polyline);
}
let normal = frame.z_axis.truncate().normalize();
let (x, y) = crate::scene::view::transform::ocs_axes((normal.x, normal.y, normal.z));
let x_axis = glam::DVec3::new(x.0, x.1, x.2);
let y_axis = glam::DVec3::new(y.0, y.1, y.2);
for vertex in &mut polyline.vertices {
let local = glam::DVec3::new(vertex.location.x, vertex.location.y, 0.0);
let world = frame.transform_point3(local);
vertex.location = Vector2::new(world.dot(x_axis), world.dot(y_axis));
polyline.elevation = world.dot(normal);
}
polyline.normal = Vector3::new(normal.x, normal.y, normal.z);
EmbeddedEntity::LwPolyline(polyline)
}
pub fn extrusion_history(
profile: &EntityType,
path: Option<&EntityType>,
@@ -703,6 +729,8 @@ pub fn extrusion_history(
}
None => (None, glam::DMat4::IDENTITY.to_cols_array()),
};
let sweep_entity = embedded_in_place(sweep_entity, &sweep_entity_transform);
let path_entity = path_entity.map(|entity| embedded_in_place(entity, &path_entity_transform));
Some(SolidHistoryOperation::Extrusion(SolidHistorySweep {
base,
operation_major: 1,