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

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

Open
amstan opened this issue Mar 7, 2020 · 0 comments
Open

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

amstan opened this issue Mar 7, 2020 · 0 comments

Comments

@amstan
Copy link
Contributor

amstan commented Mar 7, 2020

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.

@amstan amstan changed the title Current autoname system could yield dublicated parts Current autoname system could yield duplicated parts Mar 12, 2020
amstan added a commit that referenced this issue Apr 12, 2020
BUG=Issue #4, Issue #19
TEST=git checkout c718fbc~1 examples/servo_micro.py
Refdeses should stay the same
amstan added a commit that referenced this issue Apr 12, 2020
BUG=Issue #4, Issue #19
TEST=git checkout c718fbc~1 examples/servo_micro.py
Refdeses should stay the same
amstan added a commit that referenced this issue Apr 12, 2020
Replaced the old name_part_with_mapping code with a fancier implementation.

Now it saves more info about each part in the .refdes_mapping file, each column is called an anchor. Now we also
keep track of net names, variable names, values, etc. We're resilient to changes in a variety of anchors now.

Fixed Issue #19, the naming loop had to be done in 2 passes.

BUG=Issue #4
TEST=git checkout c718fbc~1 examples/servo_micro.py
Refdeses should stay the same
TEST=Move stuff around in servo_micro.py, change things/connections.
Refdeses should stay the same
@amstan amstan changed the title Current autoname system could yield duplicated parts Part.refdes should have a setter with more checks Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant