It looks like you're new here. If you want to get involved, click one of these buttons!
Hello Matthias,
I'm trying to split rectilinear polygons in rectangles in the DRC environment. Not sure if the code below is the way to go: it produces some shifts for some of the structures and I can't figure out why... Any idea what the issue might be?
Very amazed by the power of KLayout!!!
Cheers,
Tomas
Layer01 = input(1,0)
Layer01A = Layer01.rectilinear
Layer01B = polygon_layer
Layer01A.each {|polygon|
trapezoids = polygon.to_itype.decompose_trapezoids
trapezoids.each{|trapezoid|
Layer01B.insert(trapezoid.to_dtype)
}
}
Layer01A.output(10,0)
Layer01B.output(11,0)
Comments
Hi Matthias,
I managed to fix it, "to_itype(1.dbu)" instead of "to_itype", and "to_dtype(1.dbu)" instead of "to_dtype"...
:-)
Cheers,
Tomas
Very good ...
Well, once again I'm pleading for using code formatting ...
As the DRC feature is based on the RBA::Region class and the latter offers a universal "decompose_trapezoids" method, it's possible to employ the latter.
A DRC is based on a dynamic language you can extend the DRCLayer class at runtime to expose this feature. This code tricks DRC into having a new method called "decompose_trapezoids":
Regards,
Matthias
Hi Matthias,
Thanks for the suggestion, it works like a charm!!! I still got a lot to learn... :-O
I'm now looking into these mode parameters TD_htrapezoids, TD_simple, TD_vtrapezoids:
1) decompose_trapezoids_to_region(TD_htrapezoids) -> Error: Uninitialized Constant
2) decompose_trapezoids_to_region(0) -> Works fine
Do these constants need to be initialized somehow?
0 -> represents TD_htrapezoids
1 -> represents TD_simple???
2 -> represents TD_vtrapezoids???
Cheers,
Tomas
@Thomas The values are "RBA::Polygon::TD_htrapezoids" etc. Don't use the integer equivalents as they might change in future releases.
Great! Scripts updated. Thank you Matthias!