diff --git a/src/drc/drc/built-in-macros/_drc_layer.rb b/src/drc/drc/built-in-macros/_drc_layer.rb index 0592c6e35..c384d82c6 100644 --- a/src/drc/drc/built-in-macros/_drc_layer.rb +++ b/src/drc/drc/built-in-macros/_drc_layer.rb @@ -42,22 +42,38 @@ module DRC @engine._context("insert") do - requires_edges_or_region args.each do |a| if a.is_a?(RBA::DBox) + requires_edges_or_region self.data.insert(RBA::Box::from_dbox(a * (1.0 / @engine.dbu))) elsif a.is_a?(RBA::DPolygon) + requires_edges_or_region self.data.insert(RBA::Polygon::from_dpoly(a * (1.0 / @engine.dbu))) elsif a.is_a?(RBA::DSimplePolygon) + requires_edges_or_region self.data.insert(RBA::SimplePolygon::from_dpoly(a * (1.0 / @engine.dbu))) elsif a.is_a?(RBA::DPath) + requires_edges_or_region self.data.insert(RBA::Path::from_dpath(a * (1.0 / @engine.dbu))) + elsif a.is_a?(RBA::Box) || a.is_a?(RBA::Polygon) || a.is_a?(RBA::SimplePolygon) || a.is_a?(RBA::Path) + requires_edges_or_region + self.data.insert(a) elsif a.is_a?(RBA::DEdge) + requires_edges self.data.insert(RBA::Edge::from_dedge(a * (1.0 / @engine.dbu))) + elsif a.is_a?(RBA::Edge) + requires_edges + self.data.insert(a) + elsif a.is_a?(RBA::DText) + requires_texts + self.data.insert(RBA::CplxTrans::new(@engine.dbu).inverted * a) + elsif a.is_a?(RBA::Text) + requires_texts + self.data.insert(a) elsif a.is_a?(Array) insert(*a) else - raise("Invalid argument type for #{a.inspect}") + raise("Invalid argument type of #{a.inspect}") end end diff --git a/src/drc/unit_tests/drcSimpleTests.cc b/src/drc/unit_tests/drcSimpleTests.cc index a5403178c..79122f690 100644 --- a/src/drc/unit_tests/drcSimpleTests.cc +++ b/src/drc/unit_tests/drcSimpleTests.cc @@ -1954,6 +1954,11 @@ TEST(122_NamedLayers) compare_text_files (output, au_output); } +TEST(123_DirectInsert) +{ + run_test (_this, "123", false); +} + TEST(130_size_inside_outside) { run_test (_this, "130", false); diff --git a/testdata/drc/drcSimpleTests_123.drc b/testdata/drc/drcSimpleTests_123.drc new file mode 100644 index 000000000..1c1079cf2 --- /dev/null +++ b/testdata/drc/drcSimpleTests_123.drc @@ -0,0 +1,132 @@ + +source $drc_test_source +target $drc_test_target + +lp = polygons +le = edges +ll = labels + +lp.insert(RBA::Box::new(0, 0, 100, 200)) +lp.insert(RBA::DBox::new(0.200, 0, 0.300, 0.200)) +lp.insert(RBA::Polygon::new(RBA::Box::new(400, 0, 500, 200))) +lp.insert(RBA::DPolygon::new(RBA::DBox::new(0.600, 0, 0.700, 0.200))) +lp.insert(RBA::SimplePolygon::new(RBA::Box::new(800, 0, 900, 200))) +lp.insert(RBA::DSimplePolygon::new(RBA::DBox::new(1.000, 0, 1.100, 0.200))) +lp.insert(RBA::Path::new([ RBA::Point::new(1200, 100), RBA::Point::new(1300, 100) ], 200)) +lp.insert(RBA::DPath::new([ RBA::DPoint::new(1.400, 0.1), RBA::DPoint::new(1.500, 0.1) ], 0.2)) + +begin + lp.insert(RBA::Edge::new(RBA::Point::new(0, 0), RBA::Point::new(100, 100))) + raise Exception::new("Error expected") +rescue => ex +end + +begin + lp.insert(RBA::DEdge::new(RBA::DPoint::new(0, 0), RBA::DPoint::new(0.1, 0.1))) + raise Exception::new("Error expected") +rescue => ex +end + +begin + lp.insert(RBA::Text::new("ABC", RBA::Trans::new(RBA::Vector::new(0, 0)))) + raise Exception::new("Error expected") +rescue => ex +end + +begin + lp.insert(RBA::DText::new("XYZ", RBA::DTrans::new(RBA::DVector::new(0, 0.1)))) + raise Exception::new("Error expected") +rescue => ex +end + +le.insert(RBA::Box::new(0, 0, 100, 200)) +le.insert(RBA::DBox::new(0.200, 0, 0.300, 0.200)) +le.insert(RBA::Polygon::new(RBA::Box::new(400, 0, 500, 200))) +le.insert(RBA::DPolygon::new(RBA::DBox::new(0.600, 0, 0.700, 0.200))) +le.insert(RBA::SimplePolygon::new(RBA::Box::new(800, 0, 900, 200))) +le.insert(RBA::DSimplePolygon::new(RBA::DBox::new(1.000, 0, 1.100, 0.200))) +le.insert(RBA::Path::new([ RBA::Point::new(1200, 100), RBA::Point::new(1300, 100) ], 200)) +le.insert(RBA::DPath::new([ RBA::DPoint::new(1.400, 0.1), RBA::DPoint::new(1.500, 0.1) ], 0.2)) + +le.insert(RBA::Edge::new(RBA::Point::new(0, 0), RBA::Point::new(100, 100))) +le.insert(RBA::DEdge::new(RBA::DPoint::new(0, 0.1), RBA::DPoint::new(0.1, 0.2))) + +begin + le.insert(RBA::Text::new("ABC", RBA::Trans::new(RBA::Vector::new(0, 0)))) + raise Exception::new("Error expected") +rescue => ex +end + +begin + le.insert(RBA::DText::new("XYZ", RBA::DTrans::new(RBA::DVector::new(0, 0.1)))) + raise Exception::new("Error expected") +rescue => ex +end + +begin + ll.insert(RBA::Box::new(0, 0, 100, 200)) + raise Exception::new("Error expected") +rescue => ex +end + +begin + ll.insert(RBA::DBox::new(0.200, 0, 0.300, 0.200)) + raise Exception::new("Error expected") +rescue => ex +end + +begin + ll.insert(RBA::Polygon::new(RBA::Box::new(400, 0, 500, 200))) + raise Exception::new("Error expected") +rescue => ex +end + +begin + ll.insert(RBA::DPolygon::new(RBA::DBox::new(0.600, 0, 0.700, 0.200))) + raise Exception::new("Error expected") +rescue => ex +end + +begin + ll.insert(RBA::SimplePolygon::new(RBA::Box::new(800, 0, 900, 200))) + raise Exception::new("Error expected") +rescue => ex +end + +begin + ll.insert(RBA::DSimplePolygon::new(RBA::DBox::new(1.000, 0, 1.100, 0.200))) + raise Exception::new("Error expected") +rescue => ex +end + +begin + ll.insert(RBA::Path::new([ RBA::Point::new(1200, 100), RBA::Point::new(1300, 100) ], 200)) + raise Exception::new("Error expected") +rescue => ex +end + +begin + ll.insert(RBA::DPath::new([ RBA::DPoint::new(1.400, 0.1), RBA::DPoint::new(1.500, 0.1) ], 0.2)) + raise Exception::new("Error expected") +rescue => ex +end + +begin + ll.insert(RBA::Edge::new(RBA::Point::new(0, 0), RBA::Point::new(100, 100))) + raise Exception::new("Error expected") +rescue => ex +end + +begin + ll.insert(RBA::DEdge::new(RBA::DPoint::new(0, 0.1), RBA::DPoint::new(0.1, 0.2))) + raise Exception::new("Error expected") +rescue => ex +end + +ll.insert(RBA::Text::new("ABC", RBA::Trans::new(RBA::Vector::new(100, 0)))) +ll.insert(RBA::DText::new("XYZ", RBA::DTrans::new(RBA::DVector::new(0, 0.1)))) + +lp.output(1, 0) +le.output(2, 0) +ll.output(3, 0) + diff --git a/testdata/drc/drcSimpleTests_123.gds b/testdata/drc/drcSimpleTests_123.gds new file mode 100644 index 000000000..3546756f7 Binary files /dev/null and b/testdata/drc/drcSimpleTests_123.gds differ diff --git a/testdata/drc/drcSimpleTests_au123.gds b/testdata/drc/drcSimpleTests_au123.gds new file mode 100644 index 000000000..2fc76cdf6 Binary files /dev/null and b/testdata/drc/drcSimpleTests_au123.gds differ