It looks like you're new here. If you want to get involved, click one of these buttons!

Hi Hutch,

thanks :-)

But good point: I did not have angles in mind yet.

Here is a script that measures the angle between two rulers:

mw = RBA::Application::instance.main_window lv = mw.current_view lv || raise("No layout loaded") rulers = [] lv.each_annotation { |a| rulers << a } rulers.size == 2 || raise("There must be two rulers exactly") v1 = rulers[0].p2 - rulers[0].p1 v2 = rulers[1].p2 - rulers[1].p1 v1 = v1 * (1.0 / v1.abs) v2 = v2 * (1.0 / v2.abs) cos = v1.x * v2.x + v1.y * v2.y sin = v1.x * v2.y - v1.y * v2.x angle = Math.atan2(sin, cos) * 180 / Math::PI v = RBA::MessageBox::warning("Angle", "Angle between rulers is %.2f degree" % angle, RBA::MessageBox::Ok)

Regarding Python: there is a test version already (see http://klayout.de/python_preview.html) in case you like to try it.

Regards,

Matthias

It seems that this script is not working anymore ... lv.each_annotation { |a| rulers << a }

I think about Partial-Select and that selecting a single vertex might be able to deliver the nearest-neighbor coords somehow, to figure the angle of it?

Hello @laurent_c

It's workable for my 0.28 earlier version, and it's also a funny start if change annotation to vector or each_edge type.

Hmm ... the script still works for me

But anyway, there is the Angle ruler now (finally in 2023):

It needs three clicks: first point, common point (of both arms) and second point.

## Comments

Hi Hutch,

thanks :-)

But good point: I did not have angles in mind yet.

Here is a script that measures the angle between two rulers:

Regarding Python: there is a test version already (see http://klayout.de/python_preview.html) in case you like to try it.

Regards,

Matthias

It seems that this script is not working anymore ... lv.each_annotation { |a| rulers << a }

I think about Partial-Select and that selecting a single vertex

might be able to deliver the nearest-neighbor coords somehow,

to figure the angle of it?

Hello @laurent_c

It's workable for my 0.28 earlier version, and it's also a funny start if change annotation to vector or each_edge type.

Hmm ... the script still works for me

But anyway, there is the Angle ruler now (finally in 2023):

It needs three clicks: first point, common point (of both arms) and second point.

Matthias