-
Notifications
You must be signed in to change notification settings - Fork 264
Closed
Description
Whenever such a PCell is installed, "Convert Shape To PCell" will result in an error message of this kind:
ERROR: :/built-in-pymacros/pcell_declaration_helper.lym:30: 'NoneType' object does not support item assignment in PCellDeclaration.can_create_from_shape
Reason: in the helper function "PCellDeclarationHelper#can_create_from_shape_impl", "layer", "shape" and "layout" are used as temporary attributes to simplify the implementation of this method. If a parameter with the same name exists, the parameter is set instead of the temporary attribute. This parameter is not defined, hence this error.
Bad news is that this will break "can_create_from_shape_impl" for all other PCell implementations.
Workarounds are:
- Try to avoid PCell parameters named "layer", "shape" or "layout" for Python PCells
- If you have to, use "can_create_from_shape" and "transformation_from_shape" instead of the ".._impl" helpers and always provide them, even if they are not required:
def can_create_from_shape(self, layout, shape, layer):
return False
# or do something meaningful like: return shape.is_box()
def transformation_from_shape(self, layout, shape, layer):
return pya.Trans()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels