Suggestion for Symmetry Constrant Symbol Enhancement

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Suggestion for Symmetry Constrant Symbol Enhancement

Postby abdullah » Tue Aug 26, 2014 4:01 am

 where the non-icon constraints are setup for drawing. It should be a minor change to adapt this code to display the same way the icon is displayed.
Sorry, I can not understand what you mean. What is a non-icon constraint? Do you mean by this something like the two arrows on the points to which a symmetry with respect another point or a line are set?
User avatar
DevJohan
Posts: 41
Joined: Sun Jul 13, 2014 2:36 pm
Location: Stockholm, Sweden

Re: Suggestion for Symmetry Constrant Symbol Enhancement

Postby DevJohan » Tue Aug 26, 2014 2:14 pm

There are constraints which are not represented by a icon but by additional drawings and text eg angular constrainrs and distance constraints. I can't check the exact line number right now, but I will get back to you with that info.

hope that is more clear,
cheers
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Suggestion for Symmetry Constrant Symbol Enhancement

Postby abdullah » Tue Aug 26, 2014 2:57 pm

Ok. I am having problems following it.

So interpreting the previous message with this new information.
I had a look at this a while back and if I recall correctly, there is code for displaying "a" symmetry constraint where the non-icon constraints are setup for drawing. It should be a minor change to adapt this code to display the same way the icon is displayed."
So in the code, in the place where constraints not having an icon are drawn, there is code for displaying "a" symmetry constraint. I do not know what exactly you mean with the double quotes "a" (it is a special one, a different one, this code is commented or unused?). Ok, I understand there is some code that would draw a symmetry constraint (of some type)...
... then it should be a minor change to adapt this code (that if I understood correctly is able to paint a symmetry constraint), to display (the symmetry constraint?) the same way the icon (the symmetry icon?) is displayed...

... but then, why should I want to use some code that is available where the constraints not having an icon are drawn to adapt it to draw the same icon that the current code currently draws?

I am really really sorry. I am not an english native speaker and I am really missing something. But I can not understand what ... :oops:
jmaustpc
Posts: 9619
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Suggestion for Symmetry Constrant Symbol Enhancement

Postby jmaustpc » Tue Aug 26, 2014 4:47 pm

Hi Abdullah

Firstly I would think that your work here making the current symmetry icon align to the line of symmetry is a good idea as it is.

It is a small change from a gui perspective (I know nothing of the changes to code but I assume it is not a large or invasive change). But it greatly helps with identifying what the symmetry applies to.

I would think it is a simple small change that deserves to be pulled into master as it is. This does not mean that you or someone else could not decide to extend it further in the future.

However if you are interested in doing something more extensive I have an idea. I have no idea how easy or hard this would be to code or if it is even possible. But here is an idea.
  • Think of the distance constraint, it has a value and two arrows, think of how you can drag it around to move it to a visually more pleasing or less confusing location if desired.
  • Now imagine that when the number is displayed in distance constraint, that instead it had the symmetry symbol.
  • Also imagine that the arrows were three rather than two, and that they radiated from the symmetry icon rather than being on the same line like distance constraint.
  • Imagine that the arrow head points where fixed at the points being controlled by symmetry constraint (or lines and points combination) and that the other end of the arrow lines stayed fixed relative to where ever one dragged the symmetry icon
Here is a VERY rough free hand drawing I made in The Gimp over a screen shot of FreeCAD Sketcher in edit mode. I hope I am clear enough for you to see what I am talking about. :)
symmetryconstraintidea.jpg
symmetryconstraintidea.jpg (25.42 KiB) Viewed 1954 times
In the picture above I have a rectangle centred on Origin with a symmetry constraint applied to the diagonally opposed points and origin. In the centre you can see the current icon sitting on origin. I added three points to my sketch just so that I could generate the symmetry icon in the left upper quarter to save me trying to draw it in The Gimp.

I don't know if my idea is realistic or not.

Jim
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Suggestion for Symmetry Constrant Symbol Enhancement

Postby abdullah » Tue Aug 26, 2014 8:01 pm

Firstly I would think that your work here making the current symmetry icon align to the line of symmetry is a good idea as it is. It is a small change from a gui perspective (I know nothing of the changes to code but I assume it is not a large or invasive change). But it greatly helps with identifying what the symmetry applies to.I would think it is a simple small change that deserves to be pulled into master as it is. 
I agree. I am waiting for your answer: did you manage to fit the football team in the motorcycle? :D

Seriously, if you can improve the spacing it would be great. If not, just let me know.
However if you are interested in doing something more extensive I have an idea. I have no idea how easy or hard this would be to code or if it is even possible. But here is an idea. 
I would like to think about your idea with some calm. Today is not my best day...
User avatar
DevJohan
Posts: 41
Joined: Sun Jul 13, 2014 2:36 pm
Location: Stockholm, Sweden

Re: Suggestion for Symmetry Constrant Symbol Enhancement

Postby DevJohan » Tue Aug 26, 2014 10:42 pm

Hi Abdullah,

The code I'm referring to is first setup in ViewProviderSketch.cpp @ line 3193 and the drawing code is in SoDatumLabel.cpp @ line 336, master branch at github. When I said `"a" symmetry constraint` I wanted to suggest the symbol drawn was not the same as the normal symbol. If you look at nahshons post viewtopic.php?p=60443#p60443 there is the normal symmetry icon and one arrow from each symmetry endpoint. These two extra arrows are what the code I am talking about is drawing or at least something similar.

The normal symmetry icon is approximately the two arrowheads drawn at the midpoint with no lines from the endpoints to the arrowheads. I don't remember exactly what I did to make these arrows visible, but I think it was just a matter of scaling( ie the arrows were already drawn but they weren't scaled correctly). I could be wrong though. I don't know if you are interested in using this code but it's already there. The main advantage is you don't need to rotate the icon, and if you want to draw more than a small icon you can start from there. It's just a suggestion.
jmaustpc
Posts: 9619
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Suggestion for Symmetry Constrant Symbol Enhancement

Postby jmaustpc » Wed Aug 27, 2014 1:39 am

Hi all
To be honest I had not understood what DevJohan and nahshons were talking about either until DevJohan's last post above.... Now I finally get it! :)

If you compile Jürgen's development branch "Assembly2" which with yesterday's updates now compiles for me on Kubuntu 14.04 64bit, and create a sketch with a rectangle with a diagonally opposed symmetry constraint on origin and then drage the rectangle from square to long and skinny or short and fat (highly technical geometric terminology there! :-) ) you can see how those arrows work with the current icon.

Indeed this does something with similarities to what I suggested.

I have made some screen shots here.
symmetryconstraint_Assembly2_branch_1.jpg
symmetryconstraint_Assembly2_branch_1.jpg (5.1 KiB) Viewed 1919 times
symmetryconstraint_Assembly2_branch_2.jpg
symmetryconstraint_Assembly2_branch_2.jpg (8.22 KiB) Viewed 1919 times
symmetryconstraint_Assembly2_branch_3.jpg
symmetryconstraint_Assembly2_branch_3.jpg (3.42 KiB) Viewed 1919 times
symmetryconstraint_Assembly2_branch_4.jpg
symmetryconstraint_Assembly2_branch_4.jpg (8.02 KiB) Viewed 1919 times


OS: Ubuntu 14.04.1 LTS
Platform: 64-bit
Version: 0.14.3772 (Git)
Branch: dev-assembly2
Hash: dffff67f7430ea5af1dc1d6202413af664d74943
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
SoQt version: 1.6.0a
OCC version: 6.7.1



I think
  • if we added Abdullah's rotating icon to the Assembly2 style symmetry constraint symbols, it would produce a great result.
  • another useful advancement could be to make the arrows directly selectable and pre-selectable and possibly even be able to drag them closer to, or further away from, the symmetry point.
abdullah wrote:I agree. I am waiting for your answer: did you manage to fit the football team in the motorcycle? :D

Seriously, if you can improve the spacing it would be great. If not, just let me know.
:D
I’ll come back to you on that shortly.

Jim
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Suggestion for Symmetry Constrant Symbol Enhancement

Postby abdullah » Wed Aug 27, 2014 11:31 am

Ok!!!

Now I understand you Johan!!!

Yes I am interested in that. Thanks!!

I am going to look into it. I agree with Jim. I want the icon definitely rotated. It gives a much better user experience, it is much more clear. But I also like the arrows, so probably the combination would be great... Starting from there (if I arrive there), I will see about dragging the arrows.

Thanks to you all for your feedback!!!
jmaustpc
Posts: 9619
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Suggestion for Symmetry Constrant Symbol Enhancement

Postby jmaustpc » Wed Aug 27, 2014 12:05 pm

Hi all

Abdullah I had a look at that symmetry icon....my new icon is not much better. I just moved the two halves further apart, I think it does look a bit better. The difference is subtle, I compiled my new 16px version into a FreeCAD and you can't see much or any difference...

here is the current icon from master today top left, beside it on the right is my modified icon from today, for get the lower left, the lower right is the simplified svg file from which the smalle xpm file can be exported from Inkscape.
symmetryconstraint_minor_update.jpg
symmetryconstraint_minor_update.jpg (26.25 KiB) Viewed 1888 times
this zip contains the above files and some exported in png and xpm at both 16 and 32 px, of course you only needed the one svg and one xpm, but I zipped them all up together, if you would like to have a look at them.
Constraint_Symmetric.svg.zip
(9.72 KiB) Downloaded 56 times
in this next picture below you can see the current/old icon in the tool bar and at origin.
symmetry_constraint_old_icon.jpg
symmetry_constraint_old_icon.jpg (33.34 KiB) Viewed 1888 times

and this is what my new one would look like
symmetry_constraint_new_icon1.jpg
symmetry_constraint_new_icon1.jpg (32.11 KiB) Viewed 1888 times

I don't see much, if any, difference.

Jim
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Suggestion for Symmetry Constrant Symbol Enhancement

Postby abdullah » Wed Aug 27, 2014 1:09 pm

I managed to recover the arrows (good pointers Johan!). The problem is explained in the git comment.

To https://github.com/abdullahtahiriyo/Fre ... master.git
6f66964..0e457de sketcher_symmetry_constraint -> sketcher_symmetry_constraint

Now it looks like this:
constraints_4.png
constraints_4.png (19.77 KiB) Viewed 1882 times
I can change the size of the arrows, I think this is a suitable size, but let me know if you think otherwise.

Give it a try, before I pull request it.

Now I am going to integrate your icon...