Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binging up imperial output again ... #14

Open
ShamanTcler opened this issue Jan 14, 2024 · 6 comments
Open

Binging up imperial output again ... #14

ShamanTcler opened this issue Jan 14, 2024 · 6 comments
Labels
contributions welcome An issue that currently has no takers and only affects a subset of users enhancement New feature or request

Comments

@ShamanTcler
Copy link

I have started looking into this again. I am attempting to make a few changes, let's see if I am headed the right direction. ( I am a C++ kind guy with some Python... so I know enough to be dangerous)

I see in btl\ui\feedsandspeeds.py a method _on_calculator_finished, it appears to be the routine that cycles through the parameters (param) and send them into the screen (table) pipeline.

The inputs to the calculator can be metric or imperial, but the calculator always works in metric. Which means the state of a parameter will always be metric.

My thoughts are to modify "params" to have a method "fmtd_to_display". If the flag mentioned earlier is set, convert from metric to imperial.

So now in _on_calculator_finished you call params.fmtd_to_display in the for row, (name, param) in enumerate(params): loop.

@knipknap
Copy link
Owner

My thoughts: I would consider the params a backend function which should be unaware of the UI - so I would choose one of the following approaches:

  • Option 1: fmtd_to_display() should be a btl/ui/util.py function (i.e. not a method) that can be invoked in the UI when the value is prepared for display.
  • Option 2: The backend should have a method like as_unit(theformat), where the format is the desired target format.

Your proposal is pretty much option 2, if it ensures that the param object does not access any UI specific stuff (i.e. it should make any calls to Qt functions). The method should create the target format based on the input parameters only.

A challenge may be that the UI does not necessarily know the target format. E.g. what is the target unit for a param that uses N(ewton) be? But btl/units.py has a function get_default_unit_conversion() that may be of help.

@ShamanTcler
Copy link
Author

Regarding your comment "the UI does not necessarily know the target format." Would it not make sense that the units from the "Tool" tab match the units in the "Feeds & Speeds" tab?

@knipknap
Copy link
Owner

I think not - especially when thinking about "shareable tools", but also when considering tools with "mixed specifications" - some dimensions may be specified in metric, others in inches.
Imagine that you import a tool for which all data was given in mm by the manufacturer - I am guessing you probably still want to see the calculator result in inches, or feet/minute, etc.?

In other words, I would display it always according to user preferences, regardless of what the specs of the tool were.

But maybe the user preference is "use the same unit as whatever the manufacturer specified", then that would be another reason to manage this complexity in the UI instead of the backend.

@ShamanTcler
Copy link
Author

First let me say that I view this tool as a tremendous asset, so please don't take my comments as being negative. I have a OneFinity Elite Foreman ( 2.2kw spindle with ATC, with a Masso G3 touch controller)

Running through a few ideas on displayed units:

Given: "I would display it always according to user preferences, regardless of what the specs of the tool were." does this mean you have a unit toggle under the preferences or is it on the actual "feeds and speeds" tab. Actually, this could be convenient.... imagine typing in the parameters in imperial hitting OK and have them auto-magically converted to metric.

Or should the app display results (and input) as governed by: Edit/Preferences/General ... in my case Imperial decimal vs "Metric small parts & CNC"

@knipknap
Copy link
Owner

Thanks, I am glad to see that the work I put in is useful ;-).

Since FreeCAD already has user settings for preferred units, my instinct would be:

  1. Test whether these settings can be accessed when the FreeCAD GUI isn't up. In other words, when BTL is running in standalone mode, i.e. when starting it outside of FreeCAD. If this works, it is the way to go.
  2. If this doesn't work, then I would put the setting into the BTL preferences. It may then make sense to have those preferences default to whatever is configured in the FreeCAD settings when the FreeCAD GUI is up.

@knipknap knipknap added contributions welcome An issue that currently has no takers and only affects a subset of users enhancement New feature or request labels Feb 11, 2024
@Connor9220
Copy link

So, on the Feeds and Speeds output, it needs to follow the FreeCAD's units. Also, no one uses mm/min It's mm/sec and for imperial it's either ipm (inches per minute) or in/min notation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions welcome An issue that currently has no takers and only affects a subset of users enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants