forked from 1b-agent/opencadstudio-upstream
feat(app): record accepted snaps per point step and guard dimension inference
Point input now keeps an `AcceptedSnap` alongside each point a command collects: the paper point, the model point it came from, the viewport and frame it was seen through, and the geometry identity the snap engine attributed. Interactive picks record in the click handler, typed / dynamic / headless points record in `feed_command`, and the list is cleared whenever a command starts or the active space changes. Commands that don't care keep consuming the plain paper point unchanged; PR2 reads the model point and frame, PR3 the source. Dimension association inference is suppressed when the dimension's points came through a viewport. Inference matches geometry against the dimension's own definition points in whatever space it is handed, so paper definition points projected from a viewport would associate with unrelated paper-sheet geometry at those coordinates, or match model geometry using paper coordinates. An empty source list makes `attach_dimension_association` a no-op. PR3 replaces this with real viewport-aware associations. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
1 parent
6def465ba5
commit
dbdddb7dc2
3 files changed
+38
-12
No files matched your search
+13
-12
@@ -102,6 +102,10 @@ impl OpenCADStudio {
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
self.tabs[i].snap_result = None;
|
||||
self.last_point = None;
|
||||
// Points collected in the space being left are meaningless in the new
|
||||
// one (PR1).
|
||||
self.clear_accepted_snaps();
|
||||
self.pending_click_snap = None;
|
||||
self.snapper.from_point = None;
|
||||
self.snapper.clear_tracking();
|
||||
self.otrack_active = None;
|
||||
@@ -368,6 +372,11 @@ impl OpenCADStudio {
|
||||
if !self.command_point_allowed(i, *point) {
|
||||
return Task::none();
|
||||
}
|
||||
// Typed / dynamic-input / headless points carry no snap, but the
|
||||
// accepted-snap list must stay index-parallel with the points the
|
||||
// command collects (PR1). Interactive picks record themselves in
|
||||
// the click handler and never reach here.
|
||||
self.record_accepted_snap(None, None, *point);
|
||||
}
|
||||
if default_start {
|
||||
let StepInput::Point(point) = &input else {
|
||||
@@ -1590,9 +1599,7 @@ impl OpenCADStudio {
|
||||
};
|
||||
if is_associative_dimension && association_enabled {
|
||||
if let Some(handle) = committed {
|
||||
let sources = self.tabs[i]
|
||||
.scene
|
||||
.infer_dimension_sources(handle);
|
||||
let sources = self.infer_dimension_sources_guarded(i, handle);
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.attach_dimension_association(handle, sources);
|
||||
@@ -2063,9 +2070,7 @@ impl OpenCADStudio {
|
||||
let committed = self.commit_entity_handle(entity);
|
||||
if is_associative_dimension && association_enabled {
|
||||
if let Some(handle) = committed {
|
||||
let sources = self.tabs[i]
|
||||
.scene
|
||||
.infer_dimension_sources(handle);
|
||||
let sources = self.infer_dimension_sources_guarded(i, handle);
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.attach_dimension_association(handle, sources);
|
||||
@@ -2175,9 +2180,7 @@ impl OpenCADStudio {
|
||||
crate::command::DimensionAssociationInput::Infer(source) => {
|
||||
let sources: Vec<_> = source.map_or_else(
|
||||
|| {
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.infer_dimension_sources(handle)
|
||||
self.infer_dimension_sources_guarded(i, handle)
|
||||
},
|
||||
|source| {
|
||||
if single_source_dimension {
|
||||
@@ -2302,9 +2305,7 @@ impl OpenCADStudio {
|
||||
crate::command::DimensionAssociationInput::Infer(source) => {
|
||||
source.map_or_else(
|
||||
|| {
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.infer_dimension_sources(handle)
|
||||
self.infer_dimension_sources_guarded(i, handle)
|
||||
.into_iter()
|
||||
.map(|source| {
|
||||
source.map(
|
||||
|
||||
Reference in new issue
Block a user