CAD: three Design-tab fixes — consumed holed loop, constraint rows, hover ghost

1. A consumed loop WITH HOLES was never dropped from the sketch overlay.
   sync_sketch_display compares each region's entity list against what a per-loop
   extrude stored, but rebuilt the candidate from the region's OWN entities while
   the extrude stores the region's entities PLUS every hole's (see
   selected_loop_entities). For a plate with one bore that is 4 against 5, so the
   match never fired and the extruded rectangle stayed drawn on top of the solid
   it had become. Adds region_entity_indices_with_holes, which returns the same
   order the extrude uses, and compares against that; a matching region now drops
   its holes' entities too. Hole-less regions are unaffected.

   This is also the artefact that made a correct plate-with-a-bore read as a
   plate with a plug in it during rig testing.

2. The Constraints card drew its header and its first row on top of each other.
   The rows and the delete buttons were parented to m_form rather than m_cards,
   so they were laid out in the wrong window's coordinate space and started at
   the card's top edge. Re-parented; nothing else about the card changed.

3. The mate hover ghost never appeared. The highlight handler asked for a repaint
   with request_repaint(), which only queues a Refresh — and a wxMenu popup runs
   its own modal loop, so the paint was not serviced until the menu closed, by
   which time the ghost had been dropped. Adds DesignCanvas::repaint_now(), which
   flushes the paint immediately, mirroring the m_status->Update() the status line
   in the same function already needed for the same reason.

Delegated to opencode (DeepSeek V4 Pro) and reviewed by diff. Fix 1 needed an
accessor on DesignSketchTool because region_loops/RegionLoop are private — that
was outside the file list it was given, and it said so rather than working around
it.

Verified on the rig: a rectangle-plus-circle sketch extrudes to a plate with a
bore and NO overlay left on top of it, and the Constraints card shows its header
clear of eight readable rows.
This commit is contained in:
Tommaso Bianchi
2026-08-14 09:15:51 +02:00
parent 9340d4c7dc
commit c45f84edf4
5 changed files with 48 additions and 6 deletions
+13
View File
@@ -282,6 +282,14 @@ void DesignCanvas::force_repaint()
});
}
void DesignCanvas::repaint_now()
{
if (m_canvas == nullptr || m_canvas_widget == nullptr)
return;
request_repaint(); // mark dirty + Refresh (hardware GL) or render (software GL)
m_canvas_widget->Update(); // service the pending paint immediately (a modal popup owns the loop)
}
void DesignCanvas::reload(bool keep_view)
{
m_canvas->reset_volumes();
@@ -593,6 +601,11 @@ std::vector<std::vector<int>> DesignCanvas::region_entity_indices(const std::vec
return m_sketch_tool.region_entity_indices(ents);
}
std::vector<std::vector<int>> DesignCanvas::region_entity_indices_with_holes(const std::vector<SketchEntity>& ents) const
{
return m_sketch_tool.region_entity_indices_with_holes(ents);
}
void DesignCanvas::clear_loop_pick()
{
m_sketch_tool.clear_display_pick();