forked from 1b-agent/opencadstudio-upstream
fix(sweep): store the sweep profile placed on the path with flag 295, as the reference reads it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eb90b68129
commit
d7a19e5d8e
3 files changed
+44
-6
No files matched your search
Generated
+3
-3
@@ -4206,7 +4206,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "opencadcodec"
|
||||
version = "0.5.5"
|
||||
source = "git+https://github.com/ramox81/cadcodec.git?rev=25227f5#25227f504006d62373c44d5064116607865b813a"
|
||||
source = "git+https://github.com/ramox81/cadcodec.git?rev=3ffd8aa#3ffd8aad6b675da103a7feb586816dfc387686f5"
|
||||
dependencies = [
|
||||
"ahash 0.8.12",
|
||||
"anyhow",
|
||||
@@ -4238,7 +4238,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "opencadkernel"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=a03e4f0#a03e4f094331949c8b27fb659e6891b84eeaa813"
|
||||
source = "git+https://github.com/ramox81/cadkernel.git?rev=04843b5#04843b583afb06d427d3ebdeab09e7e34bce77f0"
|
||||
dependencies = [
|
||||
"cavalier_contours",
|
||||
"opencadcodec",
|
||||
@@ -4249,7 +4249,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "opencadkernel-constraints"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=a03e4f0#a03e4f094331949c8b27fb659e6891b84eeaa813"
|
||||
source = "git+https://github.com/ramox81/cadkernel.git?rev=04843b5#04843b583afb06d427d3ebdeab09e7e34bce77f0"
|
||||
dependencies = [
|
||||
"nalgebra",
|
||||
]
|
||||
|
||||
+6
-1
@@ -92,7 +92,12 @@ objc2-foundation = { version = "0.2", features = ["NSArray", "NSURL", "NSString"
|
||||
|
||||
# Solid history evaluation graphs and history node layouts (opencadcodec PR pending).
|
||||
[patch."https://github.com/HakanSeven12/opencadcodec.git"]
|
||||
opencadcodec = { git = "https://github.com/ramox81/cadcodec.git", rev = "25227f5" }
|
||||
opencadcodec = { git = "https://github.com/ramox81/cadcodec.git", rev = "3ffd8aa" }
|
||||
|
||||
# Sweep history with a placed profile (opencadkernel PR pending).
|
||||
[patch."https://github.com/HakanSeven12/opencadkernel.git"]
|
||||
opencadkernel = { git = "https://github.com/ramox81/cadkernel.git", rev = "04843b5" }
|
||||
opencadkernel-constraints = { git = "https://github.com/ramox81/cadkernel.git", rev = "04843b5" }
|
||||
|
||||
[patch.crates-io]
|
||||
iced_core = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" }
|
||||
|
||||
@@ -60,7 +60,7 @@ pub fn sweep_record(profile: &EntityType, path: &EntityType, options: SweepOptio
|
||||
};
|
||||
let mut base = SolidHistoryNodeBase::new(1);
|
||||
base.transform = glam::DMat4::IDENTITY.to_cols_array();
|
||||
Some(SolidHistorySweep {
|
||||
let record = SolidHistorySweep {
|
||||
base,
|
||||
operation_major: 1,
|
||||
sweep_entity: Some(sweep_entity),
|
||||
@@ -74,7 +74,40 @@ pub fn sweep_record(profile: &EntityType, path: &EntityType, options: SweepOptio
|
||||
path_entity_transform: glam::DMat4::IDENTITY.to_cols_array(),
|
||||
reference_point: Vector3::new(base_point[0], base_point[1], base_point[2]),
|
||||
..SolidHistorySweep::default()
|
||||
})
|
||||
};
|
||||
placed_sweep_record(profile, record)
|
||||
}
|
||||
|
||||
/// The record the reference reads: the profile stored already placed at the
|
||||
/// path start (base point, alignment and profile rotation applied) with flag
|
||||
/// 295 set, and no reference point.
|
||||
fn placed_sweep_record(profile: &EntityType, mut record: SolidHistorySweep) -> Option<SolidHistorySweep> {
|
||||
let (placed, _) = kernel::acis::sweep_history_placements(&record).ok()?;
|
||||
let embedded_to_world = glam::DMat4::from_cols(
|
||||
glam::DVec4::new(placed.x_axis[0], placed.x_axis[1], placed.x_axis[2], 0.0),
|
||||
glam::DVec4::new(placed.y_axis[0], placed.y_axis[1], placed.y_axis[2], 0.0),
|
||||
glam::DVec4::new(placed.z_axis[0], placed.z_axis[1], placed.z_axis[2], 0.0),
|
||||
glam::DVec4::new(placed.origin[0], placed.origin[1], placed.origin[2], 1.0),
|
||||
);
|
||||
// Source world geometry -> placed world geometry.
|
||||
let map = embedded_to_world * glam::DMat4::from_cols_array(&record.sweep_entity_transform).inverse();
|
||||
let m = map.to_cols_array_2d();
|
||||
let transform = codec::types::Transform::from_matrix(codec::types::Matrix4 {
|
||||
m: [
|
||||
[m[0][0], m[1][0], m[2][0], m[3][0]],
|
||||
[m[0][1], m[1][1], m[2][1], m[3][1]],
|
||||
[m[0][2], m[1][2], m[2][2], m[3][2]],
|
||||
[0.0, 0.0, 0.0, 1.0],
|
||||
],
|
||||
});
|
||||
let mut moved = profile.clone();
|
||||
crate::scene::view::dispatch::apply_transform(&mut moved, &crate::command::EntityTransform::Affine(transform));
|
||||
let (sweep_entity, sweep_entity_transform) = embedded_sweep_profile(&moved)?;
|
||||
record.sweep_entity = Some(sweep_entity);
|
||||
record.sweep_entity_transform = sweep_entity_transform;
|
||||
record.flags_294_296 = [false, true, true];
|
||||
record.reference_point = Vector3::new(0.0, 0.0, 0.0);
|
||||
Some(record)
|
||||
}
|
||||
|
||||
pub fn swept_with_options(profile: &EntityType, path: &EntityType, mode: ExtrudeMode, options: SweepOptions) -> Option<Body> {
|
||||
|
||||
Reference in new issue
Block a user