Show Error messages

Hello,

I am making a macro PCell, and there are many parameters to check the conditions.
So, I want to know which parameter breaks the rule(condition) when user change the value of the parameter.

For example,
if you see the figure, the size of box is 1.5µm as the parameter "viaSource" sets 1.5.
However, since the condition for viaSource is " viaSource >= 1.5", if viaSource is under 1.5, it would not be created showing an error message.
I used

     viaSource < rule1 && raise("viaSource should be greater than or equal to 1.5µm")   

So, if the rule1 is broken, then it isn`t created.
Here, what I want to do is that, I want to know which parameter breaks the rule while user change parameters from instance properties window.
So, I want to get the error message "viaSource should be greater than or equal to 1.5µm" on the palette.

Thank you very much in advance. :smile:

Comments

  • Hi,

    I think I answered a similar question already here but I can't find it.

    I guess you're raising an exception inside "produce_impl". Such an exception will be shown as a text in the layout, but not on the parameter page.

    If you want a text to appear there, use "coerce_parameters_impl". Like this:

        def coerce_parameters_impl
          r < 0 && raise("Radius must be positive")
        end
    

    Explanation: "coerce_parameters_impl" is called when you change a parameter on the parameters page. It's supposed to validate the parameters and change values if required. If you raise an exception there, it is shown in the parameter page.

    Matthias

  • Thank you very much Matthias,

    yes you did, but I didn`t know how to use and where to put it and though my explain was not enough to understand, but now it works well.
    Here, I have one more question.
    How can I use variable in the produce_impl in the coerce_parameters_impl?
    Is there kinds of self. as like in Python?

    How does coerce_parameters_impl work exactly? Because, some conditions, I want to check in this order,
    A user inputs the parameter (produce_impl) -> Calculate another variable using parameter which user input (produce_impl) -> Check the condition if it follow the rule or not (coerce_parameters_impl)

  • Hello,

    I have one more question.

    As you can see the figure, when I set viaSource below 1.5, then the error message shows very well.
    But since after the user checks the error and changes the value to fulfill the condition, I want to erase the error message. Is there any way to do this?

    And plus, some time, because of other parameter, another parameter should be changed. For example, sometimes, because of pPlus, viaSource should be changed to 2.5. In this case, I want to update the value in the parameter input box to 2.5.
    How do I do for this?

    I tried to find the answer from HELP windows, but I cannot find proper solution of it.

    Thank you very much.

  • Hi,

    doesn't the error go away if the value is corrected? No even if you press "Apply"?

    Inside "coerce_parameter_impl" you can basically change parameters. That's why the function is called "coerce". The parameter changes will be reflected in the UI. You cannot change parameters inside "produce_impl". Or: you can, but the new value is not kept.

    Regards,

    Matthias

Sign In or Register to comment.