Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline ironwizard  
#1 Posted : 06 August 2020 18:28:00(UTC)
ironwizard

Rank: Newbie

Groups: Registered
Joined: 04/08/2020(UTC)
Posts: 2
United States

Hey all,

I've been trying to add some units to Smath that aren't supported natively (specifically unit weight in pcf, linear load in plf, and flow rate in gpm, cfs, etc...) I've been able to successfully add all of this to the units.xml file and they work just fine. The issue I have is that I'm trying to add the descriptions of these units to the language file so that it displays correctly in the dynamic help dialog during use.

I have edited my ENG.lang file as follows:

Quote:
ENG
English
97765104672
iVBORw0KGgoAAAANSUhEUgAAABAAAAALCAIAAAD5gJpuAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHzSURBVHjaYkxOP8IAB//+Mfz7w8Dwi4HhP5CcJb/n/7evb16/APL/gRFQDiAAw3JuAgAIBEDQ/iswEERjGzBQLEru97ll0g0+3HvqMn1SpqlqGsZMsZsIe0SICA5gt5a/AGIEarCPtFh+6N/ffwxA9OvP/7//QYwff/6fZahmePeB4dNHhi+fGb59Y4zyvHHmCEAAAW3YDzQYaJJ93a+vX79aVf58//69fvEPlpIfnz59+vDhw7t37968efP3b/SXL59OnjwIEEAsDP+YgY53b2b89++/awvLn98MDi2cVxl+/vl6mituCtBghi9f/v/48e/XL86krj9XzwEEEENy8g6gu22rfn78+NGs5Ofr16+ZC58+fvyYwX8rxOxXr169fPny+fPn1//93bJlBUAAsQADZMEBxj9/GBxb2P/9+S/R8u3vzxuyaX8ZHv3j8/YGms3w8ycQARmi2eE37t4ACCDGR4/uSkrKAS35B3TT////wADOgLOBIaXIyjBlwxKAAGKRXjCB0SOEaeu+/y9fMnz4AHQxCP348R/o+l+//sMZQBNLEvif3AcIIMZbty7Ly6t9ZmXl+fXj/38GoHH/UcGfP79//BBiYHjy9+8/oUkNAAHEwt1V/vI/KBY/QSISFqM/GBg+MzB8A6PfYC5EFiDAABqgW776MP0rAAAAAElFTkSuQmCC
Andrey Ivashov (78.2%), Anonymous (12%), tivasyk (9.4%), Other (0.3%), Davor Košturić (0.1%)
2019.02.26.10
d54d74e83ab84e518dd54929051f09ed
//717
Save changes in
Author
E-Mail
Web-site

...

On error
Continue
Pause
Interrupt
Unit Weight
Linear Load
Flow Rate

//130
Finds the derivative of expression {0} relative to variable {1}.
X-Y plot.


With my additions and changes highlighted. When I do this, Smath fails to launch. If I remove the unit descriptions (I.e. the lower change in the snippet), Smath will launch just fine. If I launch with my units.xml file pointing to ids past 714 (i.e. for the new descriptions), the dynamic help shows an empty string for those units. Additionally, if I launch with the changed count at the top, Smath will throw an error when attempting to insert a unit, and I won't be able to sort by type of unit (velocity, force, etc...) in the resulting dialogue.

So my question is, what am I doing wrong? What do I need to do to get Smath to accept my additional unit descriptions? I've searched the forums and my best guess is that I'm running afoul of some kind of protection? Is it possible that the long string on line 4 is a hash for verification and my changes mean it's no longer valid?

Thanks,
-Sean

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline ironwizard  
#2 Posted : 07 August 2020 18:40:03(UTC)
ironwizard

Rank: Newbie

Groups: Registered
Joined: 04/08/2020(UTC)
Posts: 2
United States

Sorry, I could have clarified. Flow rate in this case is volumetric, cubic feet per minute and such,

As I said, I have all my units added to the units.xml file and they work just fine. I just can't get the descriptions added to the ENG.lang file to work.
Offline mkraska  
#3 Posted : 07 August 2020 19:04:38(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,980
Germany

Was thanked: 1120 time(s) in 718 post(s)
I think that the lang file are hardwired, no chance for ordinary users to add, you can just modify existing entries.

Thus, using the units.xml file lacks the chance of adding description texts. Also, this approach is non-portable. Your files won't work in an SMath installation without your particular units.xml.

You might use a snippet instead.
These are ordinary SMath files which can be embedded in any other file just by typing their name, usually as collapsed area region. And in ordinary SMath sheets you can define units with descriptions in whatever set of languages.

The advantage is that such files are portable. The disadvantage is that they aren't updated when you update your unit snippet.

This auto-update can be achieved using the plugin-mechanism. It also includes portability, as the dependence on plugin and version is stored in the sm file and any user with an installation lacking this plugin will be offered to download it from the online gallery in the extension manager.

Of course, you can ask Andrey to include your units in the next update. That would be the easiest and most straightforward way for the users.
This, however, would require you to stick to common standards and not to invent arbitrary units of convenience.
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 2 users thanked mkraska for this useful post.
on 07/08/2020(UTC),  on 07/08/2020(UTC)
Offline Razonar  
#4 Posted : 07 August 2020 23:26:15(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi. I agree with Martin. Also, in the standard way to introduce new units in SMath, you can add your own unit description, again, in the standard form.

Clipboard02.jpg


I don't check if you can add different description for different languages.

Best regards.
Alvaro.
Offline Jean Giraud  
#5 Posted : 08 August 2020 03:59:30(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
This document is SS 6179.
If you have red, expect some user of your SS version to doctor.

Inst_Colebrook Pipe Data.sm (72kb) downloaded 22 time(s).
Offline Kenny Lemens  
#6 Posted : 12 May 2023 19:16:02(UTC)
Kenny Lemens


Rank: Advanced Member

Groups: Registered
Joined: 11/01/2018(UTC)
Posts: 131
Man
United States
Location: Wisconsin

Was thanked: 58 time(s) in 37 post(s)
Greetings,

Originally Posted by: ironwizard Go to Quoted Post
So my question is, what am I doing wrong? What do I need to do to get Smath to accept my additional unit descriptions?

Simply do not reference the *.lang file; that is: do not specify an 「id」. Instead, I would advise you to just declare a 「title」 field.

If you inspect the 「Constants.xml」 file, you will notice the constant "ε.0" does not reference an id, but just defines a 「title」 of value "Vacuum permittivity"; the 「title」 field IS the value that is displayed as the SMath unit description.

Code:
    <add factor="8.85418781762039" exp="-12" connection="{A^2*s^4}/{kg*m^3}" [h]title="Vacuum permittivity"[/h] lang:rus="Электрическая постоянная">
      <synonym name="ε.0" />
    </add>

    <add factor="2.04548" exp="3" connection="(kg/{s^2*m})^0.5" [h]id="612">[/h]<!-- id='612' : Hildebrand, solubility parameter -->
      <synonym name="hildebrand" />
    </add>
"No matter where you go, there you are." -Buckaroo Banzai

Hotkeys: https://en.smath.com/for...rce.ashx?a=45771&b=2
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.