Maxima Draw2D labels error

Maxima Draw2D labels error - Errors on labels on Draw2D from Maxima - Сообщения

#1 Опубликовано: 14.06.2022 01:52:42
Diego

Diego

1 сообщений из 7 понравились пользователям.

Группа: User

Hi!
I have recently update Smath Studio to version 1.0.8151 and now I'm getting some errors on Draw2D() plot: See attached file. Ejemplo Maxima 2D Draw rectangles.sm (6 КиБ) скачан 82 раз(а).
Apparently, now there is an error on labels, but in older versions of Smath it worked just fine.
The issue seems to be that now Draw2D() function doesn't support special characters and instead replaced them with UNICODE text...
Can anyone help me please!!?
#2 Опубликовано: 14.06.2022 13:18:49
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

This is due to a change in string encoding on SMath side. I haven't had time to adjust the string handling on Maxima side. I see two workarounds for now:

1. use an older version of SMath (I don't remember at which version the change was implemented).
2. add a custom translation rule in maxima.xml in the plugin directory. The procedure is described in section 7.6 of the SMath Handbuch (the section is in English).

You might try to replace "\\0020\\" by " ".


Note that custom changes to maxima.xml aren't conveyed with the .sm file, so this is not portable.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#3 Опубликовано: 15.06.2022 03:20:05
Diego

Diego

1 сообщений из 7 понравились пользователям.

Группа: User

Wrote

Wrote

Can anyone help me please!!?


Make it native brute force.

Square.PNG



The issue is with special characters like ".", " ", "_", "/", etc.
#4 Опубликовано: 15.06.2022 10:48:23
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

I confirm that there seems to be a problem with custom translations in maxima.xml. Sorry for guiding you into a dead end.

Possibly, this also has been broken at some version of SMath Studio. I'll ad that to the bug tracking system just as the string handling.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#5 Опубликовано: 15.06.2022 12:59:20
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Wrote

I'll ad that to the bug tracking system just as the string handling.



add text decoding.jpg

ConvertToMaxima.cs:


        public static string PrepareStringsForMaxima(string text)
        {        
       //     text = ConvertTrigonometricFunctionsFromSMathToMaxima(text);
            text = TermsConverter.DecodeText( text ).Replace("\"$", "";
            text = text.Replace("$\"", "";
            //foreach (var pair in CharactersToAscii) text = (new Regex(pair.Key).Replace(text, pair.Value));
            //foreach (var pair in letters) text = (new Regex(pair.Key).Replace(text, pair.Value));
            //foreach (var pair in symbolsToMaxima) text = (new Regex(pair.Key)).Replace(text, pair.Value);
            text = text.Replace("\\", "\\\\"; // convert backslash
            return text;
        }

You need to add TermsConverter.DecodeText( text )
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
sergio 15.06.2022 16:56:00
#6 Опубликовано: 15.06.2022 15:50:50
Diego

Diego

1 сообщений из 7 понравились пользователям.

Группа: User

Wrote

Wrote

I'll ad that to the bug tracking system just as the string handling.



add text decoding.jpg

ConvertToMaxima.cs:


        public static string PrepareStringsForMaxima(string text)
        {        
       //     text = ConvertTrigonometricFunctionsFromSMathToMaxima(text);
            text = TermsConverter.DecodeText( text ).Replace("\"$", "";
            text = text.Replace("$\"", "";
            //foreach (var pair in CharactersToAscii) text = (new Regex(pair.Key).Replace(text, pair.Value));
            //foreach (var pair in letters) text = (new Regex(pair.Key).Replace(text, pair.Value));
            //foreach (var pair in symbolsToMaxima) text = (new Regex(pair.Key)).Replace(text, pair.Value);
            text = text.Replace("\\", "\\\\"; // convert backslash
            return text;
        }

You need to add TermsConverter.DecodeText( text )



Hi Thanks!, but I'm not sure how to do that, can you guide me?
1 пользователям понравился этот пост
Martin Kraska 17.06.2022 10:21:00
#7 Опубликовано: 16.06.2022 01:40:27
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Wrote

Hi Thanks!, but I'm not sure how to do that, can you guide me?



This is a hint for the plugin developer who needs to make changes to the source files in order to fix the problem: ConvertToMaxima.cs

Russia ☭ forever, Viacheslav N. Mezentsev
#8 Опубликовано: 16.06.2022 07:19:03
Davide Carpi

Davide Carpi

1417 сообщений из 2873 понравились пользователям.

Группа: Moderator

I've applied the fix proposed by Viacheslav, please try the updated plugin and check if it works.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
2 пользователям понравился этот пост
Martin Kraska 17.06.2022 10:21:00, sergio 17.06.2022 12:04:00
#9 Опубликовано: 17.06.2022 10:26:45
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

Wrote

I've applied the fix proposed by Viacheslav, please try the updated plugin and check if it works.



Thanks, Viacheslav and Davide. I confirm that the fix works with version 8151. It is, however, not available for older version (tested with 7921).

EDIT: Tried again, works with 7921.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#10 Опубликовано: 17.06.2022 14:18:59
Davide Carpi

Davide Carpi

1417 сообщений из 2873 понравились пользователям.

Группа: Moderator

Hi Martin, thank you for the feedback, I wasn't able to test it myself.
I've published the current code for every stable SMath Studio since 0.99.7579, so it should be available in the extensions Manager for a wide user base.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#11 Опубликовано: 17.06.2022 16:48:07
Diego

Diego

1 сообщений из 7 понравились пользователям.

Группа: User

Wrote

I've applied the fix proposed by Viacheslav, please try the updated plugin and check if it works.



It works! thanks!! ur the best!

Captura.JPG
#12 Опубликовано: 17.06.2022 18:21:04
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

Wrote

Hi Martin, thank you for the feedback, I wasn't able to test it myself.
I've published the current code for every stable SMath Studio since 0.99.7579, so it should be available in the extensions Manager for a wide user base.



Tried again, works now with 7921. Don't know what went wrong at the first try. Thanks again for fixing the problem.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений