-
Notifications
You must be signed in to change notification settings - Fork 262
Closed
Description
Here is some sample PCell code:
import pya
class Discussion2458PCell(pya.PCellDeclarationHelper):
description = ""
def __init__(self, description):
super(Discussion2458PCell, self).__init__()
self.description = description
self.param("a", self.TypeCallback, "AParam")
self.param("b", self.TypeDouble, "BParam", default = 22)
self.param("c", self.TypeBoolean, "CParam")
self.param("d1", self.TypeBoolean, "D1Param")
self.param("d2", self.TypeBoolean, "D2Param")
self.param("d3", self.TypeBoolean, "D3Param")
self.param("d4", self.TypeBoolean, "D4Param")
self.param("d5", self.TypeBoolean, "D5Param")
self.param("e", self.TypeBoolean, "EParam")
def callback_impl(self, name):
if name == "":
self.a.tooltip = "Tool Tip for A"
self.b.tooltip = "Tool Tip for B"
if name == "" or name == "b":
self.c.enabled = self.b.value >= 20.0
if name == "" or name == "c":
self.b.value += 1
self.b.readonly = self.c.value
self.b.icon = pya.PCellParameterState.ErrorIcon if self.c.value else pya.PCellParameterState.WarningIcon
self.d1.visible = self.c.value
self.d2.visible = self.c.value
self.d3.visible = self.c.value
self.d4.visible = self.c.value
self.d5.visible = not self.c.value
if name == "a":
print("INFO: button pressed")
def display_text_impl(self):
return self.description
def produce_impl(self):
if self.b < 0:
raise Exception("An error! b<0!")
self.cell.shapes(self.layout.layer(1, 0)).insert(pya.DBox(0, 0, 1.0, 1.0))
class Discussion2458PCellLib(pya.Library):
def __del__(self):
print("INFO: del on "+repr(self))
def __init__(self):
self.description = "Discussion2458 PCell library"
self.layout().register_pcell("PCell", Discussion2458PCell("description"))
self.register("Discussion2458PCellLib")
Discussion2458PCellLib()
Problem exists if the "C" parameter gets enabled:
or disabled:
Reactions are currently unavailable

