DRC enhancements:

- Shapes are added to existing categories rather than creating
  a new category with the same name
- The category name in "output" can be an array creating a
  hierarchy of categories.
This commit is contained in:
Matthias Koefferlein 2024-04-27 23:02:54 +02:00
parent 4b967fcc51
commit ed64d4a59b
4 changed files with 27 additions and 2 deletions

View File

@ -3226,7 +3226,23 @@ CODE
output_rdb = channel.rdb
output_cell = channel.cell
cat = output_rdb.create_category(args[0].to_s)
categories = args[0]
if !categories.is_a?(Array)
categories = [ categories.to_s ]
end
cat = nil
categories.each do |c|
ccat = nil
if cat
ccat = cat.each_sub_category.find { |i| i.name == c }
else
ccat = output_rdb.each_category.find { |i| i.name == c }
end
cat = ccat ? ccat : output_rdb.create_category(cat, c)
end
cat ||= output_rdb.create_category("default")
args[1] && cat.description = args[1]
cat.scan_collection(output_cell, RBA::CplxTrans::new(self.dbu), data)

View File

@ -5111,7 +5111,11 @@ CODE
# This method will copy the content of the layer to the specified output.
#
# If a report database is selected for the output, the specification has to include a
# category name and optionally a category description.
# category name and optionally a category description. The category name can be an
# array of strings - in that case, a hierarchy of categories is created
# with the first array item being the top level category name.
# Shapes are added to an existing category, if a category with the given
# name already exists.
#
# If the layout is selected for the output, the specification can consist of
# one to three parameters: a layer number, a data type (optional, default is 0)

View File

@ -1342,6 +1342,7 @@ Class<rdb::Database> decl_ReportDatabase ("rdb", "ReportDatabase",
"@brief Creates a new sub-category\n"
"@param parent The category under which the category should be created\n"
"@param name The name of the category\n"
"Since version 0.29.1, 'parent' can be nil. In that case, a top-level category is created."
) +
gsi::method ("category_by_path", &rdb::Database::category_by_name, gsi::arg ("path"),
"@brief Gets a category by path\n"

View File

@ -1275,6 +1275,10 @@ Database::import_cells (const Cells &cells)
Category *
Database::create_category (Category *parent, const std::string &name)
{
if (! parent) {
return create_category (name);
}
set_modified ();
Category *cat = create_category (&parent->sub_categories (), name);