Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Part.refdes should have a setter with more checks #19

@amstan

Description

@amstan
While it's not really possible to define a part with the same refdes as another par normally.

Part(refdes="C1")
C1
Part(refdes="C1")
Traceback (most recent call last):
File "", line 1, in
File "/home/amstan/Projects/pcbdl/pcbdl/base.py", line 532, in init
Plugin.init(self)
File "/home/amstan/Projects/pcbdl/pcbdl/base.py", line 54, in init
instance.plugins = {plugin: plugin(instance) for plugin in factories}
File "/home/amstan/Projects/pcbdl/pcbdl/base.py", line 54, in
instance.plugins = {plugin: plugin(instance) for plugin in factories}
File "/home/amstan/Projects/pcbdl/pcbdl/context.py", line 137, in init
global_context.new_part(instance)
File "/home/amstan/Projects/pcbdl/pcbdl/context.py", line 36, in new_part
raise Exception("Cannot have more than one part with the refdes %s in %s" % (part.refdes, self))
Exception: Cannot have more than one part with the refdes C1 in <pcbdl.context.Context object at 0x7fdd3eb02190>

The check gets bypassed if one were to do part.refdes="something_already_in_use", like the autoname system. This really ought to be implemented differently instead. Perhaps with a setter that checks if there's duplicates instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions