When I am using KLayout in interactive mode, if i double click on any selected polygon, then I can choose coordinate display format with checking on "Absolute (accumulated) transformations" check box. But when I try to use Ruby script in order to retrieve xy on edges of polygons, it will only return coordinate without absolute transformation.
app = Application.instance
mw = app.main_window
lv = mw.current_view
lv.each_object_selected do |sel|
shape = sel.shape
if shape.is_polygon?
ply = shape.polygon
ply.each_edge {
|ed|
p1_s = ed.p1
x1 = p1_s.x --------->
y1 = p1_s.y ----------> Not in absolute transformation format.
}
end
Comments
Hi,
"sel.trans" will give you the transformation of the polygon into the current cell. "sel.trans.trans(p)" will transform a point into the current sel. Hence:
Matthias