Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key Error "auto_metric_edge" #2

Open
luismaie opened this issue Apr 29, 2024 · 3 comments
Open

Key Error "auto_metric_edge" #2

luismaie opened this issue Apr 29, 2024 · 3 comments

Comments

@luismaie
Copy link

Hi,

I have used you script the first time and got the following crash:
grafik

I used the recently release KLayout 0.29 (Windows 11 x64). Maybe there was a change here that lead to the problem, but I have not explicitly tested it on the previous version.

Maybe it is as simple as a missing entry in the dictionary in centerRulerDock.py on line 135. There no value "auto_metric_edge" is present.

@luismaie
Copy link
Author

I just saw this in the changelog for 0.29:
Enhancement: New ruler type "auto measure along edge"

So I guess it is related to the version change.

@luismaie
Copy link
Author

luismaie commented Apr 29, 2024

I was able to fix the issue with the addition of the line below. I have no idea if the value 1 for the points is correct.

def getRulerTemplates(self):
    ...
            if (configs.split("=")[0]  == "mode"): 
                points, mode = {
                    "auto_metric"      : ( 1, pya.Annotation.RulerModeAutoMetric),

                    # ADD THIS LINE
                    "auto_metric_edge" : ( 1, pya.Annotation.RulerModeAutoMetricEdge),

                    "single_click"     : ( 1, pya.Annotation.RulerModeSingleClick),
                    "normal"           : ( 2, pya.Annotation.RulerModeNormal),
                    "angle"            : ( 3, pya.Annotation.RulerThreeClicks),  
                    "multi_segment"    : (-1, pya.Annotation.RulerMultiSegment),             
                }[configs.split("=")[1]]
    ...
    return templates

@s910324
Copy link
Owner

s910324 commented May 2, 2024

hi @luismaie

Thanks for reaching out and report in this issue, this indeed is a new version related bug, currently I was still using 0.28 and haven't check the good stuffs from the 0.29.

This function was originally designed to adapt different measurement types the fix you done here is actually the correct way to patch this bug.

The ”1” here corrospond to how many clicks we need from user inorder to end the ruler measurement process.

I'll push a new update that includes this fix shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants