FashionFreedom / Seamly2D

Open source patternmaking software to democratize fashion.
https://seamly.io
GNU General Public License v3.0
617 stars 111 forks source link

BUG: с переменными -(Circular reference in Variables Table) #1135

Closed Tzenzikk closed 3 months ago

Tzenzikk commented 4 months ago

После создания переменной и присвоения ей формулы она всё считает, но как только нажимаешь обновить или пытаешься использовать эту переменную, то выскакивает ошибка. Скриншот приложил.

DSCaskey commented 4 months ago

There is no screenshot attached so I'm not sure where you're having an issue. I just added a custom variable, set it to 40mm, and used it in a formula and it works fine.

image

Screenshot 2024-07-04 115513

If you know the varianle name you can just type it in a formula field, otherwise you can click the FX button to open the Formula editor... from there you can select Custom Variables and select a variabe from the list to add to the formula. When you click OK it updates the formula in the tool dialog.

Screenshot 2024-07-04 120421

Tzenzikk commented 4 months ago

Hello! I recorded a video of the problem. Video by link: https://disk.yandex.ru/i/iQSrDADDL1ZI0g I'm waiting for a comment!

DSCaskey commented 4 months ago

Hello! I recorded a video of the problem.

Thank you for the video. Now I understand the issue. This is a known limitation of the Variables Tables, in that the variables are parsed in the pattern before any tools. If you reference a tool's line length for example... when you click Refresh, the pattern is reparsed and the custom variable referencing the line length is reset to 0 as the tool has not been created yet so there is no value. In other words Custom Variables are limited to using measurements, functions, or other custom variables as long as they appear in the table list before the one you're editing a formula for.

For example: This is OK Screenshot 2024-07-06 091018

This is not: image

Hope this makes sense. At some point I need to figure out how to disable the tool variables in the FX Editor when entering a Custom Variable formula.

Tzenzikk commented 4 months ago

Thanks for the reply. But I didn't understand, will this be improved in the next versions?

slspencer commented 3 months ago

Hi @Tzenzikk.

We follow the rules of programming: A variable (var1) cannot use the value of a second variable (var2) before the second variable (var2) exists. All programmers must follow this rule.

To fix this problem, we would need to be Time Lords. :) Var1 can use Var2 in its formula if Var2 is above it in the list.

The fix is to re-arrange the order of your variables in the Variables Tables.

HTH!!!!