From c1b4f97f337ffc84dce7f486dec0daf6d4c86c2d Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 14 Feb 2026 22:03:17 +0100 Subject: [PATCH] Some fill tool enhancements * It's possible to specify the fill cell origin now (this is the point where the first cell's lower left is placed) * margin is taken into account when no step vectors are specified * "No exclude" is default --- src/lay/lay/FillDialog.ui | 367 +++++++++++++++++++++-------------- src/lay/lay/layFillDialog.cc | 37 +++- src/lay/lay/layFillDialog.h | 2 + 3 files changed, 254 insertions(+), 152 deletions(-) diff --git a/src/lay/lay/FillDialog.ui b/src/lay/lay/FillDialog.ui index 592435ffb..c78340400 100644 --- a/src/lay/lay/FillDialog.ui +++ b/src/lay/lay/FillDialog.ui @@ -86,87 +86,6 @@ - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Select how the region to fill is specified. - - - - All (whole cell) - - - - - Shapes on layer ... - - - - - Selected shapes - - - - - Single box with ... - - - - - Ruler bounding boxes - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - @@ -277,22 +196,6 @@ 6 - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 241 - 20 - - - - @@ -316,6 +219,22 @@ + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 241 + 20 + + + + @@ -436,6 +355,87 @@ + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Select how the region to fill is specified. + + + + All (whole cell) + + + + + Shapes on layer ... + + + + + Selected shapes + + + + + Single box with ... + + + + + Ruler bounding boxes + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + @@ -491,6 +491,9 @@ The fill will not be generated over the areas specified by these layers + + 3 + All layers @@ -810,6 +813,83 @@ + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Raster origin + + + + + + + + 0 + 0 + + + + + + + + (x, y of lower-left corner of fill cell in µm) + + + + + + + Qt::Horizontal + + + + 135 + 20 + + + + + + + @@ -837,13 +917,6 @@ 6 - - - - µm (keep distance between fill cells unless stitched) - - - @@ -851,16 +924,17 @@ - - - - - 0 - 0 - + + + + µm (keep distance between fill cells unless stitched) - - Leave empty for no distance. Otherwise enter a distance in micron (can be anisotropic in the form "dx,dy") + + + + + + Fill cell margin @@ -871,26 +945,6 @@ - - - - Qt::Horizontal - - - - 141 - 20 - - - - - - - - Fill cell margin - - - @@ -904,16 +958,6 @@ - - - - The second order fill cell is used to fill space remaining from the first fill step. Thus, the second order fill cell must be smaller than the first order fill cell. The boundary layer must be the same for the second order fill cell. - - - true - - - @@ -980,6 +1024,42 @@ + + + + Qt::Horizontal + + + + 141 + 20 + + + + + + + + The second order fill cell is used to fill space remaining from the first fill step. Thus, the second order fill cell must be smaller than the first order fill cell. The boundary layer must be the same for the second order fill cell. + + + true + + + + + + + + 0 + 0 + + + + Leave empty for no distance. Otherwise enter a distance in micron (can be anisotropic in the form "dx,dy") + + + @@ -1030,6 +1110,7 @@ row_le column_le enhanced_cb + origin_le second_order_fill_cb fill_cell_2nd_le choose_fc_2nd_pb diff --git a/src/lay/lay/layFillDialog.cc b/src/lay/lay/layFillDialog.cc index 6ed037fc8..1d02e8241 100644 --- a/src/lay/lay/layFillDialog.cc +++ b/src/lay/lay/layFillDialog.cc @@ -92,6 +92,7 @@ FillDialog::FillDialog (QWidget *parent, LayoutViewBase *view) fill_area_stack->setCurrentIndex (0); connect (fill_area_cbx, SIGNAL (currentIndexChanged (int)), this, SLOT (fill_area_changed (int))); + connect (enhanced_cb, SIGNAL (stateChanged (int)), this, SLOT (enhanced_fill_changed (int))); connect (button_box, SIGNAL (accepted ()), this, SLOT (ok_pressed ())); connect (choose_fc_pb, SIGNAL (clicked ()), this, SLOT (choose_fc ())); connect (choose_fc_2nd_pb, SIGNAL (clicked ()), this, SLOT (choose_fc_2nd ())); @@ -167,6 +168,8 @@ FillDialog::generate_fill (const FillParameters &fp) bool enhanced_fill = enhanced_cb->isChecked (); + db::Point fill_origin = db::CplxTrans (ly.dbu ()).inverted () * fp.fill_origin; + db::Coord exclude_x = db::coord_traits::rounded (fp.exclude_distance.x () / ly.dbu ()); db::Coord exclude_y = db::coord_traits::rounded (fp.exclude_distance.y () / ly.dbu ()); @@ -232,8 +235,6 @@ FillDialog::generate_fill (const FillParameters &fp) fill_region.merge (); } - db::Box fr_bbox = fill_region.bbox (); - if (tl::verbosity () >= 20) { tl::info << "Collecting exclude areas"; } @@ -263,8 +264,6 @@ FillDialog::generate_fill (const FillParameters &fp) // Perform the NOT operation to create the fill region fill_region -= es; - db::Region new_fill_area; - int step = 0; do { @@ -276,7 +275,7 @@ FillDialog::generate_fill (const FillParameters &fp) } if (! enhanced_fill) { - db::fill_region (cv.cell (), fill_region, fill_cell->cell_index (), fc_bbox, row_step, column_step, fr_bbox.p1 (), false, fill_cell2 ? &fill_region : 0, fill_margin, fill_cell2 ? &fill_region : 0); + db::fill_region (cv.cell (), fill_region, fill_cell->cell_index (), fc_bbox, row_step, column_step, fill_origin, false, fill_cell2 ? &fill_region : 0, fill_margin, fill_cell2 ? &fill_region : 0); } else { db::fill_region_repeat (cv.cell (), fill_region, fill_cell->cell_index (), fc_bbox, row_step, column_step, fill_margin, fill_cell2 ? &fill_region : 0); } @@ -478,6 +477,20 @@ FillDialog::get_fill_parameters () fp.enhanced_fill = enhanced_cb->isChecked (); + // read origin + x = 0.0, y = 0.0; + s = tl::to_string (origin_le->text ()); + ex = tl::Extractor (s.c_str ()); + if (ex.try_read (x)) { + if (ex.test (",") && ex.try_read (y)) { + // take x, y + } else { + y = x; + } + } + + fp.fill_origin = db::DPoint (x, y); + db::DBox fc_bbox = db::CplxTrans (cv->layout ().dbu ()) * (fc_bbox_layer < 0 ? fill_cell->bbox () : fill_cell->bbox (fc_bbox_layer)); if (fc_bbox.empty ()) { if (fc_bbox_layer >= 0) { @@ -492,7 +505,7 @@ FillDialog::get_fill_parameters () if (ex.try_read (x) && ex.test (",") && ex.try_read (y)) { fp.row_step = db::DVector (x, y); } else { - fp.row_step = db::DVector (fc_bbox.width (), 0.0); + fp.row_step = db::DVector (fc_bbox.width () + fp.fill_cell_margin.x (), 0.0); } s = tl::to_string (column_le->text ()); @@ -500,7 +513,7 @@ FillDialog::get_fill_parameters () if (ex.try_read (x) && ex.test (",") && ex.try_read (y)) { fp.column_step = db::DVector (x, y); } else { - fp.column_step = db::DVector (0.0, fc_bbox.height ()); + fp.column_step = db::DVector (0.0, fc_bbox.height () + fp.fill_cell_margin.y ()); } fp.fc_bbox = fc_bbox; @@ -528,7 +541,7 @@ FillDialog::get_fill_parameters () if (ex.try_read (x) && ex.test (",") && ex.try_read (y)) { fp.row_step2 = db::DVector (x, y); } else { - fp.row_step2 = db::DVector (fc_bbox2.width (), 0.0); + fp.row_step2 = db::DVector (fc_bbox2.width () + fp.fill_cell_margin2.x (), 0.0); } s = tl::to_string (column_2nd_le->text ()); @@ -536,7 +549,7 @@ FillDialog::get_fill_parameters () if (ex.try_read (x) && ex.test (",") && ex.try_read (y)) { fp.column_step2 = db::DVector (x, y); } else { - fp.column_step2 = db::DVector (0.0, fc_bbox2.height ()); + fp.column_step2 = db::DVector (0.0, fc_bbox2.height () + fp.fill_cell_margin2.y ()); } fp.fc_bbox2 = fc_bbox2; @@ -575,6 +588,12 @@ BEGIN_PROTECTED END_PROTECTED } +void +FillDialog::enhanced_fill_changed (int ef) +{ + origin_le->setEnabled (ef != Qt::Checked); +} + void FillDialog::fill_area_changed (int fa) { diff --git a/src/lay/lay/layFillDialog.h b/src/lay/lay/layFillDialog.h index cbd614e0f..bb4706cd5 100644 --- a/src/lay/lay/layFillDialog.h +++ b/src/lay/lay/layFillDialog.h @@ -53,6 +53,7 @@ struct LAY_PUBLIC FillParameters bool exclude_all_layers; std::vector exclude_layers; FillRegionMode fill_region_mode; + db::DPoint fill_origin; db::Region fill_region; db::LayerProperties fill_region_layer; db::DVector exclude_distance; @@ -81,6 +82,7 @@ public: public slots: void fill_area_changed (int); + void enhanced_fill_changed (int); void ok_pressed (); void choose_fc (); void choose_fc_2nd ();