coerce_parameters_impl

Hi,

I read most of the articles about this definition, but I was wondering how I can use this to return an error message like this:
def coerce_parameters_impl(self):
if (self.w>70): #if width input is bigger than 70
#error message should be here
[here it should be "end" or "return"?]

Sorry, this is my first experience with Klayout so I'm a little bit confused.

Comments

  • Is this a duplicate of the previous discussion?

  • Yes, but in Python, not in Ruby. By putting Raise, the error message is not shown.

  • edited June 14

    @ashkan This is how I do see the error:

    I see that it's kind of difficult to highlight the cause and to rectify it - i.e. the entry box does show 3, but in fact the value has not changed. But basically, raising an exception makes the PCell not accept the new parameters.

    You can also raise the exception in the "produce" code:

    I also noted that one should not have the macro IDE open when the exception is risen. With this, the debugger stops at the exception. During my experiments, the application crashed a few times :(

    Matthias

  • Thank you Matthias,
    I have one more question:
    I have a "pya.Region" which I want to rotate 90 degrees. I know that it can rotate by "transform" but I don't know how I can use this code.

Sign In or Register to comment.