Display of constraints: some are missing

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
chrisb
Veteran
Posts: 54212
Joined: Tue Mar 17, 2015 9:14 am

Re: Display of constraints: some are missing

Post by chrisb »

kisolre wrote: Mon Mar 07, 2022 3:57 pm As in the arcs left point?
Yes. The grouping itself could be improved, but that did never occurred to me as a an issue, because if I have zoomed far out, I cannot see where the constraints belong anyway.

Abdullah, is this something that can or should be tackled for 0.20?
Abdullah wrote:ping
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 54212
Joined: Tue Mar 17, 2015 9:14 am

Re: Display of constraints: some are missing

Post by chrisb »

Is this possibly related to issue #6283?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: Display of constraints: some are missing

Post by kisolre »

Probably. It had always bugged me especially with equality chains.
User avatar
Shalmeneser
Veteran
Posts: 9560
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: Display of constraints: some are missing

Post by Shalmeneser »

Confirmed.

All the sketch visualization are regrouped around the last constraint in the list.

When you zoom out a little, touching an axis create the problem.
Zooming in a little (just one mouse wheel action), touching an axis will solve the problem.

Code: Select all

OS: Linux Mint 20.3 (MATE/mate)
Word size of FreeCAD: 64-bit
Version: 0.20.27809 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 409b922)
Hash: 409b9225176ad1c772aede14f56f99c8ce225db8
Python 3.9.10, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: French/France (fr_FR)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Display of constraints: some are missing

Post by abdullah »

chrisb wrote: Mon Mar 07, 2022 5:59 pm Abdullah, is this something that can or should be tackled for 0.20?
It looks poor and it would be great if fixed.

On change of zoom, the function to redraw constraints need to be called, so that the grouping is recalculated.

At this moment I cannot remember if there is a way to detect a change of zoom in a viewprovider. As far as I remember, zoom is handled by View3DInventorViewer. I am getting old. I will have to ask Werner...
wmayer wrote: Wed Mar 02, 2022 10:08 am...
Any wise word of advise?
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Display of constraints: some are missing

Post by wmayer »

Any wise word of advise?
A view provider has three event handlers that are called inside ViewProvider::eventCallback. It handles key events, move events and mouse press/release events. But wheel events to perform a zoom is not handled (the function ViewProvider::eventCallback) is not called. This is because it's handled by the navigation style to perform the zoom and thus not passed to the scene graph.
chrisb
Veteran
Posts: 54212
Joined: Tue Mar 17, 2015 9:14 am

Re: Display of constraints: some are missing

Post by chrisb »

abdullah wrote: Tue Mar 08, 2022 1:40 pm
I interpret Werner's post that it is not easily done. Should I create an issue in the tracker so it will not be forgotten?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Display of constraints: some are missing

Post by abdullah »

chrisb wrote: Wed Mar 09, 2022 10:19 pm
abdullah wrote: Tue Mar 08, 2022 1:40 pm
I interpret Werner's post that it is not easily done. Should I create an issue in the tracker so it will not be forgotten?
It may not be that complicated. Werner's post highlights where code needs to be inserted to bring such capability to the ViewProvider. The thing is that I want first to check the bugs with BSplines. Then I will try to look into this.

But yes, please create an issue in case I forget. Thanks :)
chrisb
Veteran
Posts: 54212
Joined: Tue Mar 17, 2015 9:14 am

Re: Display of constraints: some are missing

Post by chrisb »

A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Display of constraints: some are missing

Post by wmayer »

The wheel event is handled in NavigationStyle::processSoEvent

Code: Select all

SbBool NavigationStyle::processSoEvent(const SoEvent * const ev)
{
    bool processed = false;

    //handle mouse wheel zoom
    if (ev->isOfType(SoMouseWheelEvent::getClassTypeId())) {
        const SoMouseWheelEvent * const event = static_cast<const SoMouseWheelEvent *>(ev);
        processed = processWheelEvent(event);
    }

    if (!processed) {
        processed = viewer->processSoEventBase(ev);
    }

    return processed;
}
Here are the four steps to make it working:

Step 1:
To make sure that it's also passed to the scene graph make a small change:

Code: Select all

SbBool NavigationStyle::processSoEvent(const SoEvent * const ev)
{
    bool processed = false;

    //handle mouse wheel zoom
    if (ev->isOfType(SoMouseWheelEvent::getClassTypeId())) {
        const SoMouseWheelEvent * const event = static_cast<const SoMouseWheelEvent *>(ev);
        processed = processWheelEvent(event);
        viewer->processSoEventBase(ev); /// <<<< ============ Add this line
    }

    if (!processed) {
        processed = viewer->processSoEventBase(ev);
    }

    return processed;
}
Hint: We can be sure that no standard Inventor node will handle this event because it's a custom event that DeepSOIC has added.

Step 2:
Add a new event handler to ViewProvider mouseWheelEvent() with the required information in its interface.

Step 3:
Adjust ViewProvider::eventCallback to handle the SoMouseWheelEvent

Step 4:
Override mouseWheelEvent() in ViewProviderSketch
Post Reply