Skip to content

Material bank cannot be updated from outside while the app is running #49

Open

Description

@Maaxion

Problem

External tools cannot add or update entries in the material bank (the wood stock catalog with names, dimensions and prices) while BenchUp is running.

An agent that generates a .bup model cannot give the app prices for the stock it uses. The cutting plan and the cost estimate read prices only from the catalog inside the app, so every product has to be typed into the stock settings dialog by hand.

What the source does

  • The catalog (name, wood type, thickness, width, length, price per piece, currency) is part of the general settings in the inspector preferences. eframe persists these in app.ron in the app data directory (see preferences_path in crates/benchup-app/src/identity.rs). The catalog is a RON string nested inside that RON file.
  • The running app keeps the catalog in memory. eframe calls save on its autosave interval and on exit, and save writes the in-memory preferences again (save_inspector_preferences in crates/benchup-app/src/sidebar.rs). An external edit made while the app is running is overwritten at the next save. Nothing reloads app.ron.
  • The .bup file stores a stock material's name, dimensions and grain (StockMaterial in crates/benchup-core/src/objects.rs). It has no price, so a model cannot carry prices with it.
  • Prices come from Settings::wood_price in crates/benchup-app/src/stock_settings.rs. A catalog entry matches a cut material only when the material id and the dimensions are identical. A price of 0 counts as unpriced.

Today the only working way to change the catalog from outside is to quit the app, edit app.ron by hand (string-patching escaped RON inside RON), and start the app again. That is fragile. A wrong id or a dimension that differs by a tenth of a millimetre makes the price silently not apply.

Use case

An agent generates a .bup model from a script and uses real supplier products as stock. The user wants the cutting plan and the cost estimate to price those products without retyping each one in the stock settings dialog.

Possible directions

Any of these would work. None is a firm proposal.

  • Keep the catalog in its own plain JSON file in the app data directory, and reload it when the file changes on disk. External tools could then edit it safely.
  • Add an import or merge of a catalog file, from the UI or the command line, with a clear rule for matching existing entries.
  • Carry optional price data in the project file and offer to import it into the bank. The model would then travel with its prices.

Whatever the format, the matching rule (material id plus dimensions) should be easy for tools to follow, or be replaced by a rule that is easier to write, such as name plus dimensions.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions