How to make a boolean papameter shown only when another boolean parameter is true in instance page?


I saw we can add boolean parameter in Pcell writing in Python.

But what should I do if I want to add a parameter "grating_length" when boolean parameter "DrawnType" is true, and another parameter "period_number" when this boolean parameter "DrawnType" value is false?

Thus, in the instance page, that is to say, when we make boolean parameter values true, only "grating_length" is shown.
When we make boolean paramter false, only "period_number" is shown.

I try to add parameter like this, but whether I make DrawnType to true or false, only "Period_number" is shown.

    self.param("DrawnType", self.TypeBoolean, "Drawn parameter Type (grating_length=True,period_number =False)", default=True)

    if self.DrawnType is True:
        self.param("grating_length", self.TypeDouble, "Grating length ", default=19.0)
        self.param("period_number", self.TypeInt, "Period_number", default=30)

What is the reason causing this?
Could anyone who knows give me some suggestions on how to achieve this?

Thank you in advance!


Sign In or Register to comment.