Markus Rudolf
2019-05-06 15:02:00 UTC
I wrote an ULP that "retrofits" user attributes for BOM management like
ORDERCODE, COMMENT, SUPPLIER etc.
It iterates through all schematic sheets, all instances on the sheet and
checks if the instance has a package (to exclude mainly power supply
symbols from getting attributes as well)
It tries to read the attribute (to check if the attribute is already
there, and to not overwrite it in case it's already defined and set to a
value).
If the attribute is not found, the ULP is adding a line to an output
script that can be run later to "retrofit" all the needed attributes.
In general it works quite well, the problem starts when there is any
part that consists of multiple gates, like TTL logic with seperate power
gates.
From the debug output in the generated script I see that attributes are
only found on the "first" gate of the multi gate part.
The second+ gate returns no valid attribute even though if i check
manually with a right click in the schematic all attributes are there,
even on all "sub-gates" of a part.
My script then assumes there must be the attribute missing and
overwrites the attribute with an empty one, which also deletes the
attributes' values of the first gate of a part.
As result I lose any attribute values that existed before running my
script in any multigate part.
There is no iterator for gates of an instance so i have no idea how to
memorize or recognize that I'm accessing not the first gate of a part
but the second one so i could skip those entirely (obviously the data is
attached internally to the the first gate of an instance, so i could
skip any other gates)
I'm kinda stuck here. Maybe someone from the good old eagle times or
former CadSoft employees can have a look at this and make suggestions?
I attach the script as reference (the V6 stems from it was written
originally for V6 but it has the same problem there)
Cheers,
Markus
ORDERCODE, COMMENT, SUPPLIER etc.
It iterates through all schematic sheets, all instances on the sheet and
checks if the instance has a package (to exclude mainly power supply
symbols from getting attributes as well)
It tries to read the attribute (to check if the attribute is already
there, and to not overwrite it in case it's already defined and set to a
value).
If the attribute is not found, the ULP is adding a line to an output
script that can be run later to "retrofit" all the needed attributes.
In general it works quite well, the problem starts when there is any
part that consists of multiple gates, like TTL logic with seperate power
gates.
From the debug output in the generated script I see that attributes are
only found on the "first" gate of the multi gate part.
The second+ gate returns no valid attribute even though if i check
manually with a right click in the schematic all attributes are there,
even on all "sub-gates" of a part.
My script then assumes there must be the attribute missing and
overwrites the attribute with an empty one, which also deletes the
attributes' values of the first gate of a part.
As result I lose any attribute values that existed before running my
script in any multigate part.
There is no iterator for gates of an instance so i have no idea how to
memorize or recognize that I'm accessing not the first gate of a part
but the second one so i could skip those entirely (obviously the data is
attached internally to the the first gate of an instance, so i could
skip any other gates)
I'm kinda stuck here. Maybe someone from the good old eagle times or
former CadSoft employees can have a look at this and make suggestions?
I attach the script as reference (the V6 stems from it was written
originally for V6 but it has the same problem there)
Cheers,
Markus