Skip to content

Pass Eagle/Fusion board variant as metadata instead of in the title - #590

Merged
qu1ck merged 2 commits into
openscopeproject:masterfrom
DominikPalo:fix-eagle-variant-metadata
Oct 7, 2026
Merged

qu1ck merged 2 commits into
openscopeproject:masterfrom
DominikPalo:fix-eagle-variant-metadata

Conversation

@DominikPalo

@DominikPalo DominikPalo commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #574.

Since #574 the BOM header shows the board variant from pcbdata.metadata.variant (see populateMetadata in web/ibom.js), and the %v / %V output name format substitutions in core/ibom.py read the same key. The KiCad parser sets it, but the Eagle/Fusion parser never did. It appended the current variant to the title instead:

title = "{0}, Variant: {1}".format(title, variant)

So for Eagle/Fusion boards with a current <variantdef>:

  • the new variant cell in the header stayed hidden,
  • the title was long and got truncated in the header ("withvariant.brd, Variant…"),
  • %V in --name-format always produced default, and %v was empty.

This change stores the current variant in metadata['variant'] and leaves the title as the file name. When no variant is current, the variant key is omitted rather than set to an empty string: Eagle/Fusion variant names are required and the default assembly variant is implicit, so there is never an empty-named variant (details in the comment below).

Testing

Eagle test boards generated with --name-format "%f_%V":

master this PR
Board with <variantdef name="LITE" current="yes"/>: metadata.title withvariant.brd, Variant: LITE withvariant.brd
metadata.variant missing LITE
Header variant cell hidden "Variant: LITE"
Output file name withvariant_default.html withvariant_LITE.html
Board with empty <variantdefs/> no variant cell, novariant_default.html unchanged, variant key omitted
Board with variants defined but none current (default variant active) no variant cell, nocurrent_default.html unchanged, variant key omitted

Checked the generated pages in a browser: the header renders correctly and there are no console errors.

Note for reviewers

The page's local storage key prefix is derived from the title. For Eagle/Fusion boards with an active variant the title changes, so checkbox state saved in BOMs generated before this change won't be picked up by BOMs generated after it.

🤖 Generated with Claude Code

Since openscopeproject#574 the BOM header shows the variant from pcbdata.metadata.variant,
and the %v/%V name format substitutions read the same key. The Eagle and
Fusion parser never set it and instead appended ", Variant: X" to the
title, so the variant header stayed hidden, the title got truncated and
%V always produced "default". Put the current variant into
metadata.variant like the KiCad parser does and keep the title as the
file name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qu1ck

qu1ck commented Oct 6, 2026

Copy link
Copy Markdown
Member

Does eagle/fusion always specify a variant even if user didn't customize anything? If there is a distinction between variant that is empty string and no variant I'd like to keep it reflected in the data, even if it shows up on the page the same at the moment.

Eagle and Fusion never store a variant with an empty name: variantdef
names are required and the default assembly variant is implicit. Leave
metadata.variant out when no variant is current instead of setting it
to an empty string, so "no variant" stays distinguishable in the data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DominikPalo

DominikPalo commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

No, Eagle/Fusion don't always specify a variant, and a variant never has an empty name. Per the DTD, variantdef requires a name. The default assembly variant is implicit and is never stored. Real boards on GitHub I checked either have an empty <variantdefs/> or a named variant marked current="yes".

So the only distinction is a named variant vs no variant. I've updated the PR (772b2ae) to omit metadata.variant when no variant is current instead of setting it to "".

@qu1ck
qu1ck merged commit ea9254d into openscopeproject:master Oct 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants