diff --git a/src/db/db/built-in-macros/pcell_declaration_helper.lym b/src/db/db/built-in-macros/pcell_declaration_helper.lym index 43754b65d..ba97fac7d 100644 --- a/src/db/db/built-in-macros/pcell_declaration_helper.lym +++ b/src/db/db/built-in-macros/pcell_declaration_helper.lym @@ -118,6 +118,12 @@ Optional, named parameters are @li @b:unit@/b: the unit string @/li + @li + @b:min_value@/b: the minimum value (effective for numerical types and if no choices are present) + @/li + @li + @b:max_value@/b: the maximum value (effective for numerical types and if no choices are present) + @/li @li @b:default@/b: the default value @/li @@ -335,6 +341,8 @@ module RBA # :hidden -> (boolean) true, if the parameter is not shown in the dialog # :readonly -> (boolean) true, if the parameter cannot be edited # :unit -> the unit string + # :min_value -> the minimum value (only effective for numerical types and if no choices are present) + # :max_value -> the maximum value (only effective for numerical types and if no choices are present) # :default -> the default value # :choices -> ([ [ d, v ], ...) choice descriptions/value for choice type # this method defines accessor methods for the parameters @@ -373,6 +381,8 @@ module RBA args[:hidden] && pdecl.hidden = args[:hidden] args[:readonly] && pdecl.readonly = args[:readonly] args[:unit] && pdecl.unit = args[:unit] + args[:min_value] && pdecl.min_value = args[:min_value] + args[:max_value] && pdecl.max_value = args[:max_value] if args[:choices] if !args[:choices].is_a?(Array) raise ":choices value must be an array of two-element arrays (description, value)" diff --git a/src/db/db/built-in-pymacros/pcell_declaration_helper.lym b/src/db/db/built-in-pymacros/pcell_declaration_helper.lym index 462883154..2b3113ca0 100644 --- a/src/db/db/built-in-pymacros/pcell_declaration_helper.lym +++ b/src/db/db/built-in-pymacros/pcell_declaration_helper.lym @@ -127,6 +127,12 @@ Optional, named parameters are @li @bunit@/b: the unit string @/li + @li + @bmin_value@/b: the minimum value (effective for numerical types and if no choices are present) + @/li + @li + @bmax_value@/b: the maximum value (effective for numerical types and if no choices are present) + @/li @li @bdefault@/b: the default value @/li diff --git a/src/pymod/distutils_src/klayout/db/pcell_declaration_helper.py b/src/pymod/distutils_src/klayout/db/pcell_declaration_helper.py index 5bdb73e4e..5beff2043 100644 --- a/src/pymod/distutils_src/klayout/db/pcell_declaration_helper.py +++ b/src/pymod/distutils_src/klayout/db/pcell_declaration_helper.py @@ -66,7 +66,7 @@ class _PCellDeclarationHelperMixin: self.layer = None self.cell = None - def param(self, name, value_type, description, hidden = False, readonly = False, unit = None, default = None, choices = None): + def param(self, name, value_type, description, hidden = False, readonly = False, unit = None, default = None, choices = None, min_value = None, max_value = None): """ Defines a parameter name -> the short name of the parameter @@ -76,6 +76,8 @@ class _PCellDeclarationHelperMixin: hidden -> (boolean) true, if the parameter is not shown in the dialog readonly -> (boolean) true, if the parameter cannot be edited unit -> the unit string + min_value -> the minimum value (only effective for numerical types and if no choices are present) + max_value -> the maximum value (only effective for numerical types and if no choices are present) default -> the default value choices -> ([ [ d, v ], ...) choice descriptions/value for choice type this method defines accessor methods for the parameters @@ -102,6 +104,8 @@ class _PCellDeclarationHelperMixin: pdecl.readonly = readonly if not (default is None): pdecl.default = default + pdecl.min_value = min_value + pdecl.max_value = max_value if not (unit is None): pdecl.unit = unit if not (choices is None):