[pull request] Sketcher: Virtual Space

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
abdullah
Posts: 2816
Joined: Sun May 04, 2014 3:16 pm

[pull request] Sketcher: Virtual Space

Postby abdullah » Sat Dec 16, 2017 12:46 am

I intend to implement a new feature, codename "Virtual Space". This feature also enables the functionality to hide constraints.

What intends to be this "Virtual Space"?

It is a concept that extends the sketcher working view to actually have two views. A first view that temporarily is named "Real Space" and a second view that temporarily is named "Virtual Space". The terminology is to be changed as needed. The concept is not limited to constraints, although for a first implementation it will be limited to constraints.

These two views can be selected with a control and only one is shown at a time.

Probably the best way of explaining it is based on the "hiding functionality". Imagine you have a sketch and all the constraints are initially on the "Real Space". This situation is like any sketch we have seen until know. Now imagine that we "hide" one constraint. This contraint is not visible anymore on the "Real Space", but if we switch the view to "Virtual space" only the hidden constraints will show (and the ones in Real space will disappear).

As an extension, if one selects the "virtual space", the geometry is still shown, as this virtual space applies only to constraints. So one can in this virtual space add constraints (for example, in one application, reference constraints, the blue constraints). If afterwards one selects the "Real space", the blue constraints disappear (are hidden) and those constraints that were in the "Real Space" appear.

This enables, for example, looking into microElly's usage of reference constraints for feedback, to put all this blue constraints in "Virtual Space", being still able to switch from the "Real Space" to the "Virtual Space" to take a look a their values and back with one click.

Another usage is, for example, to "clean up" a complex fully constrained sketch, by only leaving in the "Real Space" the driving dimensional constraints.

I am sure the community will find more usages and of course limitations.

The user input that I request, is related to the UI and where to put the controls.

As of today, the controls are like this:
VirtualSpace1.png
VirtualSpace1.png (107.71 KiB) Viewed 1759 times
So the Constraints list has been provided with a checkbox, if the checkbox is enabled, the constraint is in the current view (e.g. "Real Space"). If the checkbox is disabled, the constraint is in the other view (e.g. "Virtual Space").

Initially I thought it was a good idea to put the visualization controls in the edit controls panel. So I did this:
VirtualSpace2.png
VirtualSpace2.png (51.53 KiB) Viewed 1759 times
Now that I start to play with it, I have the impression that is not comfortable to switch from the constraints list to the edit controls panel. However I am not sure I would like to have this visualization controls in the constraints list panel, as they only touch visualization, not a real operation on constraints. On the other hand the checkbox is already there and is only for visualization...

I think you get the picture.

So the question is: What do you think of this UI? Where do you think the controls should be? Do you have any suggestion, user input?
Last edited by abdullah on Sun Dec 17, 2017 10:58 am, edited 1 time in total.
User avatar
Kunda1
Posts: 3813
Joined: Thu Jan 05, 2017 9:03 pm

Re: [user input request] Sketcher: Virtual Space

Postby Kunda1 » Sat Dec 16, 2017 2:21 am

abdullah wrote:
Very cool! Would it be possible to see it in action, like a screencast?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
chrisb
Posts: 14019
Joined: Tue Mar 17, 2015 9:14 am

Re: [user input request] Sketcher: Virtual Space

Postby chrisb » Sat Dec 16, 2017 4:47 am

It sure will help to sort things out. The virtual space sounds to me like what I know as planes e.g. from Gimp.
paullee
Posts: 1305
Joined: Wed May 04, 2016 3:58 pm

Re: [user input request] Sketcher: Virtual Space

Postby paullee » Sat Dec 16, 2017 9:18 am

abdullah wrote:
Sat Dec 16, 2017 12:46 am
I intend to implement a new feature, codename "Virtual Space". This feature also enables the functionality to hide constraints.

What intends to be this "Virtual Space"?
...

Probably the best way of explaining it is based on the "hiding functionality". Imagine you have a sketch and all the constraints are initially on the "Real Space". This situation is like any sketch we have seen until know. Now imagine that we "hide" one constraint. This contraint is not visible anymore on the "Real Space", but if we switch the view to "Virtual space" only the hidden constraints will show (and the ones in Real space will disappear).

...

Another usage is, for example, to "clean up" a complex fully constrained sketch, by only leaving in the "Real Space" the driving dimensional constraints.

Yes, I have 2 inter-related ideas about sketcher that I have briefly discussed in the forum, one is about hiding or cleaning up sketcher display!

I can't programme (some layman script only) so I only have some conceptual ideas which I hope helps.


1. Ability to (auto) give (unique) name each edges in a sketch which would not be repeated or reused
https://forum.freecadweb.org/viewtopic. ... ch#p198334
https://forum.freecadweb.org/viewtopic. ... ch#p198099

I totally abandon Link to External Geometry, Map to Faces etc. which, when recompute the model, totally make my test building model into chaos.
I am testing only using expression to link between sketches, arch objects - some how works, but the ability / built-in function that each edges created is given a unique name/ numbers is much more productive. So each edges is named e.g. edge001, edge002 (unlike current way), if edge001 is deleted, the name edge001 WOULD NOT BE REUSED again.

Then, an edge can be reference absolutely, with Topological Naming problem, like sketch001.edge001.vertex1.x...


2. Geometry and Constraints display control capability.
This should be related to topic of this thread.
Discussion about ideas below similar to what had been discussed in Sketcher mini-features
- Sketcher - Make Invisible Reference Constraints & Construction Geometryhttps://forum.freecadweb.org/viewtopic.php?f=3&t=24570
- Hide measures https://forum.freecadweb.org/viewtopic. ... 5&start=10

An initial control maybe like this? similar to what is being suggested in fact...
Check boxes in 'Virtual Space' for display control -
- a. Turn on (Only) Driving Constraints
- b. Turn on (Only) Reference Constraints
- c. Turn on (Only) Named Constraints
...
- x. Turn on (Only) Normal Geometry
- y. Turn on (Only) Reference Geometry
...
- Combination of the above by selecting more than 1 checkbox


Hope it helps.
chrisb
Posts: 14019
Joined: Tue Mar 17, 2015 9:14 am

Re: [user input request] Sketcher: Virtual Space

Postby chrisb » Sat Dec 16, 2017 9:29 am

Not directly contributing to the topic but related: It would be great if the reference (=driven) constraints had a different color. Currently it can't be seen in the 3D view that they are defined using an expression.
triplus
Posts: 8124
Joined: Mon Dec 12, 2011 4:45 pm

Re: [user input request] Sketcher: Virtual Space

Postby triplus » Sat Dec 16, 2017 11:14 am

Hi Abdullah.

I welcome the addition of being able to show/hide different geometry/information in Sketcher edit mode.

As for the implementation. I would rather see a set of standalone standard (straightforward point and click) FreeCAD commands providing the functionality. As that usually reduces the complexity, learning curve and saves space in already crowded sidebar. In addition it makes it possible to reuse the functionality/commands in other places (like for example PieMenu).

P.S. For rare and complex use cases in addition having a Python API (offering much more options) should likely do.
abdullah
Posts: 2816
Joined: Sun May 04, 2014 3:16 pm

Re: [user input request] Sketcher: Virtual Space

Postby abdullah » Sat Dec 16, 2017 4:19 pm

Thanks to all of you for your feedback.
Kunda1 wrote:
Sat Dec 16, 2017 2:21 am
abdullah wrote:
Very cool! Would it be possible to see it in action, like a screencast?
I have never done one. Do you know what can be used to make a screencast in ubuntu?

In any case, if you feel like compiling, you can have a live demo:
https://github.com/abdullahtahiriyo/Fre ... rtualSpace
chrisb wrote:
Sat Dec 16, 2017 4:47 am
It sure will help to sort things out. The virtual space sounds to me like what I know as planes e.g. from Gimp.
I am not very familiar with Gimp...
paullee wrote:
Sat Dec 16, 2017 9:18 am
1. Ability to (auto) give (unique) name each edges in a sketch which would not be repeated or reused
https://forum.freecadweb.org/viewtopic. ... ch#p198334
https://forum.freecadweb.org/viewtopic. ... ch#p198099

I totally abandon Link to External Geometry, Map to Faces etc. which, when recompute the model, totally make my test building model into chaos.
I am testing only using expression to link between sketches, arch objects - some how works, but the ability / built-in function that each edges created is given a unique name/ numbers is much more productive. So each edges is named e.g. edge001, edge002 (unlike current way), if edge001 is deleted, the name edge001 WOULD NOT BE REUSED again.

Then, an edge can be reference absolutely, with Topological Naming problem, like sketch001.edge001.vertex1.x...
I (only/mostly) link sketches using the expression engine. To partially automate it, I created Carbon Copy, which helps in some scenarios, not all.

Naming edges uniquely might help toponaming. Naming edges uniquely globally in FreeCAD might help toponaming, but it is a FC wide decision, which I only see as part of the toponaming project.

However, it is noteworthy that sketcher elements have a unique identifier (accessible at least at a c++ level). This was introduced this year to enable complex geometry manipulations of bsplines which could not rely on this "automatic naming" you refer to. It was already foreseen to use it for improving the deleting process of sketcher elements (yet to be implemented).

I have been weighing the idea of reusing this unique identifier for a "Carbon Copy 2.0", in which a sketcher element (and I do not say edge, because this only works between sketches) is "constraint" in place so as follow a sketcher element of the same type existing in another sketch. This is for the future.
paullee wrote:
Sat Dec 16, 2017 9:18 am
2. Geometry and Constraints display control capability.
This should be related to topic of this thread.
Yes, indeed. The threads you link are previous work, which was not my finest (it was merged and the reverted because it had problems and in any case the underlaying mechanism relayed on moving Coin3d nodes which I learnt might lead to unwanted behaviour). Werner pointed me to SmSwitchBoard, which is what this implementation is using. So somehow it is a "hiding 2.0"...
chrisb wrote:
Sat Dec 16, 2017 9:29 am
Not directly contributing to the topic but related: It would be great if the reference (=driven) constraints had a different color. Currently it can't be seen in the 3D view that they are defined using an expression.
I am not sure I follow. The "reference"/"driven"/"blue" constraints are blue, which is different from the "constraints","driving","red" constraints. If you refer to "red" constraints which value is determined by one expression, then I have also missed such a feature (specially when using carbon copy in not very simple sketches). Nevertheless, note that using an expression does not mean that they are not independent, the expression may be "10mm + 8.5mm". If there isn't a ticket for this in the bug tracker, I invite you to create one, a feature request, and assign it to my name. It annoys me so eventually it will come.
triplus wrote:
Sat Dec 16, 2017 11:14 am
As for the implementation. I would rather see a set of standalone standard (straightforward point and click) FreeCAD commands providing the functionality. As that usually reduces the complexity, learning curve and saves space in already crowded sidebar. In addition it makes it possible to reuse the functionality/commands in other places (like for example PieMenu).

P.S. For rare and complex use cases in addition having a Python API (offering much more options) should likely do.
I have reconsidered my initial proposal in the light of this. I think you are pointing in the right direction. I still have to think about it, but thanks!!
chrisb
Posts: 14019
Joined: Tue Mar 17, 2015 9:14 am

Re: [user input request] Sketcher: Virtual Space

Postby chrisb » Sat Dec 16, 2017 5:08 pm

abdullah wrote:
Sat Dec 16, 2017 4:19 pm
If you refer to "red" constraints which value is determined by one expression, then I have also missed such a feature (specially when using carbon copy in not very simple sketches).
That's in fact what I mean. The blue lines can have red measures as well. I would like to have measures which are defined by expressions in a different color.

I will create a ticket.
User avatar
saso
Posts: 1135
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: [user input request] Sketcher: Virtual Space

Postby saso » Sat Dec 16, 2017 5:34 pm

abdullah wrote:
Sat Dec 16, 2017 4:19 pm
paullee wrote:
Sat Dec 16, 2017 9:18 am
1. Ability to (auto) give (unique) name each edges in a sketch which would not be repeated or reused
https://forum.freecadweb.org/viewtopic. ... ch#p198334
https://forum.freecadweb.org/viewtopic. ... ch#p198099

I totally abandon Link to External Geometry, Map to Faces etc. which, when recompute the model, totally make my test building model into chaos.
I am testing only using expression to link between sketches, arch objects - some how works, but the ability / built-in function that each edges created is given a unique name/ numbers is much more productive. So each edges is named e.g. edge001, edge002 (unlike current way), if edge001 is deleted, the name edge001 WOULD NOT BE REUSED again.

Then, an edge can be reference absolutely, with Topological Naming problem, like sketch001.edge001.vertex1.x...
I (only/mostly) link sketches using the expression engine. To partially automate it, I created Carbon Copy, which helps in some scenarios, not all.

Naming edges uniquely might help toponaming. Naming edges uniquely globally in FreeCAD might help toponaming, but it is a FC wide decision, which I only see as part of the toponaming project.

However, it is noteworthy that sketcher elements have a unique identifier (accessible at least at a c++ level). This was introduced this year to enable complex geometry manipulations of bsplines which could not rely on this "automatic naming" you refer to. It was already foreseen to use it for improving the deleting process of sketcher elements (yet to be implemented).

I have been weighing the idea of reusing this unique identifier for a "Carbon Copy 2.0", in which a sketcher element (and I do not say edge, because this only works between sketches) is "constraint" in place so as follow a sketcher element of the same type existing in another sketch. This is for the future.
For the type of workflow that paullee shows, the best tool we have at the moment is probably Lattice2 -> SubLink, unfortunately it also suffers from the topological naming problems. What we actually really need for this is something like in the following videos, it is in some way actually very similar to the above idea of having unique names (or our existing named constraints in sketcher), but would as in the case of SubLink also have a graphical element which is easier to work with. The hope is that this would work well (be stable even with no improvements to topological naming) is because the user is able to manage this only from inside the sketch.

https://www.youtube.com/watch?v=mRt_M50HmJs
https://www.youtube.com/watch?v=Tmzmb3kG0tA
https://www.youtube.com/watch?v=9hQdmVuVMdo
chrisb
Posts: 14019
Joined: Tue Mar 17, 2015 9:14 am

Re: [user input request] Sketcher: Virtual Space

Postby chrisb » Sat Dec 16, 2017 5:48 pm

chrisb wrote:
Sat Dec 16, 2017 5:08 pm
I will create a ticket.
Done: issue #3285. Please have a look if we are talking about the same.