Another query about The Use of, and Scope of User-Variables

Hello,

My query is going to reap the wrath and ire (Again!) of certain members of this community, and I will either be ignored or scathingly lectured on things that should be apparent, even to those with IQs numerically lower than their shoe-sizes!

As a novice still in the process of learning to use the application and it’s features, I still somewhat struggle with what seem to be inconsistencies in the ‘Scope’ of User-Variables.

I show here two three screenshots of the Var-Table and have underlined (Highlighted / Highlit ?) a local variable that I created to hold a value of the length of Splines.

I filled the ‘Value’ with a formula (SplPath_C17_C22 + SplPath_C18_C22) which was available on the ‘Curve Lengths’ tab of the table, and the value was filled accordingly.

20250207094046_Seamly_VAR-Table

However, after closing and opening the table, the value (formula) was flagged as an error.

I find the inconsistency disconcerting, to put it mildly, and would appreciate a calm and informative clarification - including perhaps, a ‘User-Guide’ on this subject.

I do understand, at least a little, some of the scope constraints in this Application. For example, only being able to use values etc., created ‘Upstream’ can be used / evaluated by those objects further ‘Downstream’. Here, however, the objects and their values are clearly In-Scope, so I am obliged to ask ‘Why’ are these values ‘Available’, then suddenly ‘Unavailable’ ?

PS: With reference to the third screenshot; the value field can be restored by altering a different variable, which then seems to reinitialize the field. Since I cannot imagine these (SplPath) values going in and out of scope, why are they accessible then Not?

PPS: To those who might say “Just another User who doesn’t understand the complexities of programming”, might I offer my ‘Pedigree’:

I have programmed since the early 1970’s and have used at various times: Machine Assembler (Mainframe - Honeywell 200/1200/3200/4200), COBOL, Assembler COBOL, IBM (PC) Assembler, IBM Basic, MS VisualBasic / Visual C++, Pascal, Java etc. etc.

I have also used (at various times) DB-2, diverse SQL dialects, MS-VB Scripting for Excel / Word applications and others that I cannot name right now, since they have now been long-forgotten.

With that said, I would be willing to offer my time and remaining abilities in support of those who may like to take advantage of said abilities. All I ask is help with my familiarisation of the development environment, the tools, libraries / compilers and any other materials needed.

2 Likes

Ok, the passive-aggressive opening tack is not endearing, so I’ll try to move past it before responding. We’ll start with a question. Did you manually enter “SplPath_C17_C22” or did you find it in the Formula Wizard? Only if you found it in the Formula Wizard, is it “clearly In-Scope;” since Douglas fixed that little oversight. Do not manually enter formulae, only enter them with the Formula Wizard, until such time as the following paragraph has been fully understood.

Every time the pattern updates, Seamly has to re-render the file. It reads off the directions for rendering in this order: Measurement file, Custom Variables, Block A in order of creation, Block B in order of creation, Block C in order of creation, etc… Any formula created out of order cannot be used in drafting.

When you open the variables table, Seamly re-renders the pattern while searching for the items to populate it with. The current state of the pattern is held in memory. Since the entire pattern is loaded at this point, it is possible to manually enter formulae referencing any part of the pattern, but the moment Seamly has to re-render, Seamly finds a formula referencing something which does not exist yet.

tl/dr: If it isn’t in the Formula Wizard it doesn’t exist. It’s just an illusion. Do not try to operate without using the Formula Wizard until you are able to accept this.

:unicorn:

4 Likes

OK, sounds like a Plan … only my inexperience and a lack of (imho) relevant info caused me to explore the boundaries of the possible.

Passive Aggressive ?

As you also saw in my previous posting regarding ‘something’ that seemed ‘off’, the response to that was a little less than - again imho - polite, with no regard to my innocent and well-meant query. In that regard, I was somewhat in defensive mode.

[Edit] Anyway … having re-re-read your posting and informative explanation, I will certainly abide by those directives (until otherwise informed) and ‘Play Nice’.

[Edit] PS: With regard to values being ‘There’ but Not ‘There’, this is very reminiscent of Schrödinger’s Cat :wink:

2 Likes

Once again… To add to what @Pneumarian said…

The items in the red box are only lists that are similar to the History on the menu. Their purpose is only for checking things… Information:

image

If you open the pattern in a text editor, you’ll see something similar to this:

As you can see, the measurement file is normally loaded first, then the variables and then the draft block.

In the draftblock section, there are the following sections - Calculation, Modeling, Pieces, Groups and Image (this is an old pattern since long before Images, so it doesn’t feature here):

image

I hope that this draws an understandable picture as to how things are arranged in the pattern file and why you can’t use anything in the draftBlock sections in the Variables Table. And why this will never change.

3 Likes

The tool variables ARE downstream… as I pointed out previously in another topic. In this case they’re only in scope when the variables table is opened and go out of scope when closed and the pattern gets reparsed. And there’s no way to stop users from cutting and pasting invalid variables into formulas.

As @Pneumarian pointed out… if you use the fx editor when editing a formula for a custom variable, the only things you can access are measurements, custom variables created before (above), or functions. You can not use line lengths, line angles, etc in custom variable formulas.

image

It’s all based on the strict linear parsing of a pattern. Don’t worry about scope… just don’t cut and paste into formulas, and just use the fx editor, and you’ll be fine.

3 Likes

I think I can further fix this issue by excluding tool variables (line length, line angles, etc) in custom variable formulas… so it would throw an error right away when it tries to evaluate the formula. I’m already tracking a bit flag as to what dialog opened the fx editor, and can probably use the same for the EvalFormula() routine to filter out any tool variables from custom variable formulas.

That would then only leave figuring out how to validate using only existing custom variables in the formulas to eliminate this issue entirely.

3 Likes

I have a long “pedigree” as well going back to the days of Fortran and punchcards - as well as degrees in civil engineering and technical theatre, plus 45+ years of pattern making experience… Don’t want to bore everyone listing every computer language or system I’ve worked with. Suffice to say when I first found Valentina - which then forked as Seamly in the fall of 2017 - I was outspoken on the forums as to what the applications should do… until I actually started to try and program some changes. I soon found the app is way more complex than it appears, and just doesn’t operate like your typical CAD or pattern software. I more or less bit my lip and spent a couple+ years working on my own fork to actually learn Qt and understand the codebase before making my first PR to Seamly.

Given the fact that other than c++ you haven’t listed using any of the development requirements… Since I’ve been there I will say this: “assume nothing.” You are probably starting at square one. So…

You will need to have installed a Git client such as Github Desktop, as well as having a Github account, and understand how to use Git, including working with branches, forking the repo, pulling changes from the develop branch, and making PRs just to name a few.

You will need to install at minimum Qt 15.5.2 (Not Qt 6 at this time).

You will need to understand how to use Creator - including, but not limited to: Configuring build kits for debug & releases for the compiler used. Note: Qt includes the gcc & MSVC compilers, and while it’s not required, but preferred to use the MSVC compiler as that’s what the releases use - when using the MSVC compiler, Visual Studio also needs to be installed and configured in Creator which needs some of the MS kits and libs. You could configure VS to use as your build environment, but your on own there.

You will need to know the Qt framework - forget how other C++ is programmed, as with Qt we don’t really use the std library. Also in Qt you mainly work with “modules” not libs. Of note you should be familar with at least c++14 syntax. I’m going to bump the minimum to c++17 soon when I get a chance.

You will really need to comprehend the use of signals and slots in Qt, as the whole application pretty much functions with connections between all the various objects and widgets.

You need to understand the use of the Dom document & XML as the applications are XML based and require an understanding of parsing the QDomDocument class.

You need to know how to create / edit / use ui forms and how layouts & widgets are used in Creator. It real easy to mess up forms… I’ve made my share of mistakes.

You will need to know how to configure Creator to be able to run lupdate if any changes are made to translated text.

We also would like any “new” methods in the code to be fully commented (in the cpp, unless the method appears inline in the header) so as to be included in the Doxygen docs that are automatically generated with each build.

Most importantly you need to learn the codebase.

FYI: I’ve been working with Valentina / Seamly for 7+ years and I comprehend about 70% of the codebase. It took me about 2 years to know enough of the Qt framework to be able to code without looking for examples or looking up every class and method up in the docs. I’m still a bit vague on some intricacies of GIt.

More info on contributing can be found here:

https://github.com/FashionFreedom/Seamly2D/blob/develop/.github/README-DEVELOPER.md

https://github.com/FashionFreedom/Seamly2D/blob/develop/CONTRIBUTING.md

4 Likes

Sorry, that was very remiss of me! Ov course C++ should be in my ‘Resumé’, my employer at hat time financed the entire MSVC Developer Environment and the complete C++ manual set (around 30 books). Thanks for your other advice some of which I have already done. I am indeed a total novice in the area of ‘Qt’ and will have to invest time in that!

I am also familiar with XML and the Document Class(es)

Question(s):

  1. Since I no longer have the fully licensed MSVC / C++ environment (my favourite anyway), does the (free) Visual Studio Code suite fit the bill for the environment?
  2. I saw that there is / was a Qt developer env. But that costed even more than my ‘old’ MSVC stuff (years ago now!) - is there a version for ‘Personal Use’?
  3. I did a lot of ‘Form’ (User Forms) development in MSVC / MSVB and Siemens SPS (Process & micro-controllers), is that equivalent?

If you also have any tip/tricks/ pointers to ‘where’ I can get ‘what’ - esp. any software you can recommend or that is essential for the project, I would be very grateful.

1 Like

Yes. You can use the “Community” version. As far as compiling with Creator using an MSVC kit, it only requires a handful of items.Some are automatically setup, others have to be manually configured PER Qt kit.

image

image

image

Again to note: You only need VS installed if you build with a MSVC kit… or if you prefer using the VS editor *see below. You could use a GCC MinGW compiler kit to start, and switch to MSVC once you’re more familar with building with Creator.

Yes. Same deal with Qt… there is a free community ver. It does require a Qt account, as downloading / updating the framework works through the Qt Maintenace Tool. BTW… unless you want to build Qt itself, you don’t need all the source code which takes a lot longer to download.

If you mean if it relates to Qt ui forms? Probably not much at all. First there’s the whole designer part in Creator which has it’s own quirks, and you really have to understand how each Qt layout class as well as widgets and their sizing hints work… especially when layouts get nested inside other layouts, group boxes, pages, and widgets. Without layouts widgets will not automatically resize. For ex: here’s what the Pattern Piece Dialog form looks like for the Seam Allowance page:

Each red box represents a layout. You could make all the forms in the code, but that would be insanly nuts. That’s not all though… every form is usually associated with a cpp code file that interacts with the form.

If you have not already done so you first need a Github account, and Git client - Github desktop is recomended to start. You then need to “clone” the Seamly repo… click the green Code button.

This will download the repo to your computer as your “local”. You will also need to create a fork to actually contribute to the project.

image

The idea here (for now as you can’t write to the main repo) is you will work between your fork and your local… and between the Main (origin) repo and your fork. For now though you need to be able to get Qt up and running to build locally.

VS Download:

image

Qt Download:

This should give you the insaller for the Maintence tool after creating am account, which you will then use to select Qt components to download. I can’t show the Add components without updating the “white” ones first - which I don’t want to do at this time… but this is pretty much the minimal list of Qt 15.5.2 components… althikugh you could knock off a good chunk by not including the debugger components. As you can see it’s like 6-7 GB.

Once you get Qt installed and configured… there’s probaby one last decision to make… what you want to use as an editor. You can use Qt’s editor… which I don’t like. You can use VS if you installed that. My preference at the moment is the Atom editor… but I may switch to VS at some point as Atom is no longer supported. Of course there are other options out there.

3 Likes

Hi @Douglas ,

I had already done some of this (DL & Inst. of the MS community Developer, GitHub Account / Cloning the Seamly release etc), with the major exception of Qt, which I had no idea what would be needed - I will also check the GitHub documentation (URLs) which you posted previously.

I will ‘absorb’ as much of your advice as mentally possible, and get back to you when I’m done, or have more queries.

Thanks and Brgds,

David D.

2 Likes

No problem… I’m sure you’ll have questions about setting up the Creator IDE.

BTW… just so I know… did you setup Github Desktop as your Git client? For now since you won’t have write access to the main repo, you’ll have to work through your fork. Which we can get into once you have Qt up and building.

3 Likes

Hi, I did as you mentioned (GitHub Desktop As Client / Fork DL only) … The rest will be WIP for a while, regretfully :frowning:

2 Likes

Understood. Just let me know if and when you need any help. :slight_smile:

2 Likes