Holes on round faces from the app, and Flip for holes at sketch points (#980)
* Holes on round faces from the app, one hole per pick, and Flip for holes at sketch points (#967) The Hole dialog takes any face: a hole on a round face drills against the face's normal where it was picked, and its arrow shows that. A round face split at its seam is picked whole, but makes one hole where it was clicked. Holes at sketch points get Flip (saved as flip in the hole's points, under format 18), in the command and in the dialog. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Holes at sketch points show their arrow: into the part, or away with Flip (#967) Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
47a7f29485
commit
b34d45233d
11 files changed
+247
-10
No files matched your search
@@ -1131,6 +1131,9 @@ pub struct MeshData {
|
||||
pub struct SketchPoints {
|
||||
pub sketch: u64,
|
||||
pub ids: Vec<String>,
|
||||
/// Drill the other way: away from the side the holes would go into by themselves.
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub flip: bool,
|
||||
}
|
||||
|
||||
/// A component: a node of the design tree that owns sketches, features and bodies. The root
|
||||
|
||||
@@ -2050,6 +2050,16 @@ fn hole_reaches(st: &ModelState, p: Vec3, d: Vec3, ahead: bool) -> bool {
|
||||
/// from the plane's normal) if any spot touches material that way, else `+n` if any spot touches
|
||||
/// material that way. With no touching on either side it goes by the nearest body ahead: `-n` if
|
||||
/// any spot has a body ahead that way, else `+n` if any has, else `-n`.
|
||||
/// The way holes at these points of a sketch drill (see [`sketch_hole_dir`]), flipped or not.
|
||||
/// None when the sketch or a point is not there.
|
||||
pub fn sketch_hole_direction(st: &ModelState, sketch: u64, ids: &[String], flip: bool) -> Option<Vec3> {
|
||||
let ss = st.sketch(sketch)?;
|
||||
let spots: Vec<Vec3> =
|
||||
ids.iter().map(|id| ss.sketch.points.iter().find(|p| &p.id == id).map(|p| ss.plane.to_world(p.pos))).collect::<Option<_>>()?;
|
||||
let dir = sketch_hole_dir(st, &spots, ss.plane.normal());
|
||||
Some(if flip { -dir } else { dir })
|
||||
}
|
||||
|
||||
fn sketch_hole_dir(st: &ModelState, spots: &[Vec3], n: Vec3) -> Vec3 {
|
||||
let down = -n;
|
||||
let any = |d: Vec3, ahead: bool| spots.iter().any(|p| hole_reaches(st, *p, d, ahead));
|
||||
@@ -2077,6 +2087,7 @@ fn hole_spots(st: &ModelState, f: &Feature) -> Result<(Vec<Vec3>, Vec3)> {
|
||||
v.push(ss.plane.to_world(p.pos));
|
||||
}
|
||||
let dir = sketch_hole_dir(st, &v, ss.plane.normal());
|
||||
let dir = if sp.flip { -dir } else { dir };
|
||||
(v, dir)
|
||||
}
|
||||
None => {
|
||||
@@ -2123,6 +2134,7 @@ fn hole_spots_raw(st: &ModelState, f: &Feature) -> Result<(Vec<Vec3>, Vec3)> {
|
||||
let v: Vec<Vec3> =
|
||||
sp.ids.iter().filter_map(|id| ss.sketch.points.iter().find(|p| &p.id == id)).map(|p| ss.plane.to_world(p.pos)).take(10_000).collect();
|
||||
let dir = sketch_hole_dir(st, &v, ss.plane.normal());
|
||||
let dir = if sp.flip { -dir } else { dir };
|
||||
Ok((v, dir))
|
||||
}
|
||||
None => {
|
||||
|
||||
@@ -129,6 +129,9 @@
|
||||
//! taken from another face whose plane passed near the point, such as the far side of a thin
|
||||
//! plate or a face of another body at the same height) is mirrored into that face when the
|
||||
//! design is evaluated. Holes whose direction enters their face build as before.
|
||||
//! Holes at sketch points can be flipped (`flip: true` in the hole's `points`): they drill away
|
||||
//! from the side they would go into by themselves. Holes without it save as before; 0.9.0 would
|
||||
//! drop the flip and drill the other way.
|
||||
|
||||
//! - 19: editable associative offset-distance dimensions. Older offsets retain their saved
|
||||
//! fixed distances; migration does not invent dimensions or change geometry.
|
||||
|
||||
@@ -48,7 +48,7 @@ pub use document::*;
|
||||
pub use eval::{
|
||||
EdgeRef, FeatureResult, Model, ModelBody, ModelState, RevolveExtent, SolvedSketch, ThreadInfo, curve_pick_error, edge_names_for, edge_refs,
|
||||
hole_direction_at, object_height, parse_metric_thread, pattern_matrices, revolve_extent, revolve_extent_with_convention, select_profiles,
|
||||
state_in_frame, state_in_frame_at, through_all_distance, world_state,
|
||||
sketch_hole_direction, state_in_frame, state_in_frame_at, through_all_distance, world_state,
|
||||
};
|
||||
pub use params::{ParamRow, ParamUser, cycles};
|
||||
pub use solidcraft_kernel as kernel;
|
||||
|
||||
Reference in new issue
Block a user