1 страниц (4 вхождений)
Units to string - defined vs. displayed units - Сообщения
#1 Опубликовано: 06.07.2023 13:38:05
This is probably not possible given what I have already read on other related posts, but I just want to see if anyone has any ideas.
When we define a variable, we have the choice to change the unit we display with that defined variable. We usually need to do this if the desired unit is something different than what is the default unit.
We can use var2str(1) to convert that value and unit to a string, so long as the unit is the default, the string will match the original input.
If the unit is not a default unit, then the string will show whatever value was originally defined, converted into the default unit.
The only thing that seems possible at this time is t manually cancel out the units before converting to a string in order to keep the original value, but the unit text is now lost.
other functions like UnitsOf(1) also only display the default unit.
![2023-07-06 12_18_55-SMath Solver 1.0.8348 - [Worksheet8_].png](/ru-RU/file/HuFh7m/2023-07-06-12_18_55-SMath-Solver-1_0_8348---_Worksheet8___png)
Is there a way to convert the defined variable into a string while keeping the original unit shown?
Something like this:
![2023-07-06 12_27_53-SMath Solver 1.0.8348 - [Worksheet8_].png](/ru-RU/file/m8yXLk/2023-07-06-12_27_53-SMath-Solver-1_0_8348---_Worksheet8___png)
If this is not possible, maybe it could be possible to detect the defined unit, something like this:
![2023-07-06 12_32_15-SMath Solver 1.0.8348 - [Worksheet8_].png](/ru-RU/file/2NWgo2/2023-07-06-12_32_15-SMath-Solver-1_0_8348---_Worksheet8___png)
It seems like any unit other than the default is just a conversion factor changing the display. It doesn't change the actual value of the variable as far as the calculations are concerned. So I understand that in the "background" the unit is still the default, and only my selection of "in" has modified the original value to convert it and show it in inches. Maybe a function could be made to show the displayed units of a variable? This way the distinction between defined units, and displayed units is made.
Something like this:
![2023-07-06 12_37_02-SMath Solver 1.0.8348 - [Worksheet8_].png](/ru-RU/file/SNHSqC/2023-07-06-12_37_02-SMath-Solver-1_0_8348---_Worksheet8___png)
When we define a variable, we have the choice to change the unit we display with that defined variable. We usually need to do this if the desired unit is something different than what is the default unit.
We can use var2str(1) to convert that value and unit to a string, so long as the unit is the default, the string will match the original input.
If the unit is not a default unit, then the string will show whatever value was originally defined, converted into the default unit.
The only thing that seems possible at this time is t manually cancel out the units before converting to a string in order to keep the original value, but the unit text is now lost.
other functions like UnitsOf(1) also only display the default unit.
Is there a way to convert the defined variable into a string while keeping the original unit shown?
Something like this:
If this is not possible, maybe it could be possible to detect the defined unit, something like this:
It seems like any unit other than the default is just a conversion factor changing the display. It doesn't change the actual value of the variable as far as the calculations are concerned. So I understand that in the "background" the unit is still the default, and only my selection of "in" has modified the original value to convert it and show it in inches. Maybe a function could be made to show the displayed units of a variable? This way the distinction between defined units, and displayed units is made.
Something like this:
#2 Опубликовано: 06.07.2023 14:20:38
#3 Опубликовано: 06.07.2023 14:54:13
Wrote... Is there a way to convert the defined variable into a string while keeping the original unit shown?
Hi. Artificial, but it's a way. A Hold() function obviously is better:
mcad_hold.sm (4 КиБ) скачан 24 раз(а).
Best regards.
Alvaro.
#4 Опубликовано: 06.07.2023 15:58:49
Hi Alvaro,
Thanks for this initial try.
I would like to avoid using the mathcad plugin. Not a huge fan of how the variable is defined, and in the end, if this is the only way, maybe just mathcad is a better solution...
Realistically, this probably requires an additional special function, that allows you to recall the "displayed" units.
As I have shown, code contains the display units as an operant, so this should be able to be recalled in some way.
I know a lot of people would just want to see a way of showing the initial substitution, but this request has been put forth for over a decade now with no result, so it must be hard, or the dev team is not financially motivated for this.
Personally, I think that this type of feature would really make Smath a better engineering calculation tool.
So, if this can't be done, then at least this simple request to recall the displayed unit can be done, and then with what you have already done, we can make a function that does this substitution for us.
Thanks for this initial try.
I would like to avoid using the mathcad plugin. Not a huge fan of how the variable is defined, and in the end, if this is the only way, maybe just mathcad is a better solution...
Realistically, this probably requires an additional special function, that allows you to recall the "displayed" units.
As I have shown, code contains the display units as an operant, so this should be able to be recalled in some way.
I know a lot of people would just want to see a way of showing the initial substitution, but this request has been put forth for over a decade now with no result, so it must be hard, or the dev team is not financially motivated for this.
Personally, I think that this type of feature would really make Smath a better engineering calculation tool.
So, if this can't be done, then at least this simple request to recall the displayed unit can be done, and then with what you have already done, we can make a function that does this substitution for us.
1 страниц (4 вхождений)
-
Новые сообщения
-
Нет новых сообщений