Expression Completer - Changes, Fixes

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
acpopescu
Posts: 16
Joined: Thu Jan 19, 2023 11:49 pm
Contact:

Expression Completer - Changes, Fixes

Post by acpopescu »

Hi everyone, I'm new in this forum and in the developer's community for FreeCAD!

I'm a software engineer, C++, currently working in computer games for a loooong time. I've been trying to get into designing some parts for my hobby with FreeCAD again (3D Printing).

I noticed that the Expression Completer has some issues with the Formula (it wouldn't complete Constraints.Height, or have bugs with Completion), so I started to look into fixing that for myself (LOTS of dependent parts, sketches and tolerances that need references)

I did manage to get something that works OK, BUT it's not done yet (https://github.com/acpopescu/FreeCAD/tr ... ompletions). I also didn't want to rock the boat too much by changing everything there for now (looking at the splitPath function in the Expression completer)

Putting this out here so we can talk about it :)

Video with current state:
phpBB [video]
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

Re: Expression Completer - Changes, Fixes

Post by chrisb »

Hi and welcome to the forum!

Good to see somebody working on this again. Are you aware of issue #3062.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
acpopescu
Posts: 16
Joined: Thu Jan 19, 2023 11:49 pm
Contact:

Re: Expression Completer - Changes, Fixes

Post by acpopescu »

Hey, didn't know about that! - it has more features, and includes python completion too! Plus a bunch of other changes (parser changes, python completion as a baseline, unit changes).

It looks like it would fix more items and UI issues than what I did and possibly handle a bunch of edge cases I definitely don't know about.

That PR is pretty big though, on the other hand my changes are isolated to ExpressionCompleter.cpp (maybe the .h is in there as well?) and I wanted to keep them simple and doable in a couple of days, to help me with the constraints.

Also, I don't know the codebase, so I tried to keep the changes targeted and not intrusive.

Thanks for linking that PR issue!
acpopescu
Posts: 16
Joined: Thu Jan 19, 2023 11:49 pm
Contact:

Re: Expression Completer - Changes, Fixes

Post by acpopescu »

Looking over that PR - https://github.com/FreeCAD/FreeCAD/pull/3062 it looks like it needs some work to be integrated:
- update to latest changes
- fix the https://github.com/FreeCAD/FreeCAD/pull/7688

The main issue is that it seems to be waiting for the topo naming changes - are there any dependencies beside @realthunder owning both?
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

Re: Expression Completer - Changes, Fixes

Post by chrisb »

acpopescu wrote: Fri Jan 20, 2023 4:24 am The main issue is that it seems to be waiting for the topo naming changes - are there any dependencies beside @realthunder owning both?
I don't know. But it is a very, no an extremely good idea to keep pull requests small! So I'm looking forward to see completion inside constraints again.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
acpopescu
Posts: 16
Joined: Thu Jan 19, 2023 11:49 pm
Contact:

Re: Expression Completer - Changes, Fixes

Post by acpopescu »

I could push a PR with my changes until we get that larger one sorted out, and when that other one is ready to go it can overwrite them. It's a single changed file, ExpressionCompleter.cpp .

It depends if y'all want something in place before the big one comes in.
bleber
Posts: 259
Joined: Thu Jun 30, 2016 5:12 pm

Re: Expression Completer - Changes, Fixes

Post by bleber »

Some idea to make expressions easy:
Wat a tool to click the reference (line, 3D edge, constraint,....)with the mouse to easy add existing references to expression.
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

Re: Expression Completer - Changes, Fixes

Post by chrisb »

acpopescu wrote: Sat Jan 21, 2023 11:04 pm I could push a PR with my changes until we get that larger one sorted out, and when that other one is ready to go it can overwrite them. It's a single changed file, ExpressionCompleter.cpp .

It depends if y'all want something in place before the big one comes in.
Please do so. I am sure it is highly appreciated. This completion used to work, and it was even said to be a blocking error for the 0.19 release, when it suddenly vanished. Several users stayed for rather long with an outdated version, just to have this completion of constraint names.
I am not to decide this, so other voices are highly appreciated.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
acpopescu
Posts: 16
Joined: Thu Jan 19, 2023 11:49 pm
Contact:

Re: Expression Completer - Changes, Fixes

Post by acpopescu »

Allright! - I've pushed https://github.com/FreeCAD/FreeCAD/pull/8228 with the fixes I did to the ExpressionCompleter.

@bleber - what did you have in mind: referencing Constraints inside the same Sketch, X-links to other sketches in the documents, or both?
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

Re: Expression Completer - Changes, Fixes

Post by chrisb »

bleber wrote: Sun Jan 22, 2023 12:32 am Wat a tool to click the reference (line, 3D edge, constraint,....)with the mouse to easy add existing references to expression.
That's something different and should go to its own feature request in Open discussion forum. It's a nice idea, something between CarbonCopy and expressions, but it needs more user interface, because there can multiple dimensions be attached to the same geometric element.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply