[pull requested] Sketcher: New Features: Symmetry, Copy and 2D Array transformations

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
triplus
Posts: 8839
Joined: Mon Dec 12, 2011 4:45 pm

Re: [ALPHA testing, user input] Sketcher: New Feature: Add Symmetric elements

Postby triplus » Fri Jul 24, 2015 12:03 am

Sketcher_Array.png
Sketcher_Array.png (569 Bytes) Viewed 808 times
Sketcher_PolarArray.png
Sketcher_PolarArray.png (2.64 KiB) Viewed 808 times
Attachments
Sketcher_PolarArray.svg
(6.39 KiB) Downloaded 18 times
Sketcher_Array.svg
(4.26 KiB) Downloaded 41 times
triplus
Posts: 8839
Joined: Mon Dec 12, 2011 4:45 pm

Re: [ALPHA testing, user input] Sketcher: New Feature: Add Symmetric elements

Postby triplus » Fri Jul 24, 2015 12:05 am

Sketcher_Offset.png
Sketcher_Offset.png (2.34 KiB) Viewed 808 times
Sketcher_Copy.png
Sketcher_Copy.png (1.52 KiB) Viewed 808 times
Attachments
Sketcher_Copy.svg
(5.12 KiB) Downloaded 84 times
Sketcher_Offset.svg
(3.09 KiB) Downloaded 18 times
jmaustpc
Posts: 9586
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: [ALPHA testing, user input] Sketcher: New Feature: Add Symmetric elements

Postby jmaustpc » Fri Jul 24, 2015 11:52 am

Hi all
I see triplus has posted some icons, I had started experimenting with making a set so I will post where I had got to.

My understanding is that we are talking about transforms of the element within the sketch, i.e some of the sketch's contents, not the entire sketch. My first reaction to triplus's icons is that to me they look like transforms of the entire sketch.

I was trying to think of a theme that would be consistent with the previously existing icons. I was thinking the icon need a "basic" or "standard" element, which for most of the Part workbench tends to be a cube, for sketcher that basic common element might be a sketcher line. For some icons the function is better described by a curved line and others with straight lines.

One element in each icon is green as this is the default "is selected" colour for a sketcher element. The idea is that item is selected and clicking the icon will produce the non-selected elements.

At first I included a construction line where appropriate to for example show the "Mirror_Element" axis. However I though the icons were getting too complex....particularly for the dreaded 16px requirement. So I made a different set that are more minimal i.e. I removed the Radial_Array centre point and I removed the Mirror_Element axis construction line.

This is what they could look like, I can improve these and create any more that may be require if you like?

The first...more complex... icons and then followed by the matching simplified version (which the file name ends in 2)
Sketcher_Mirror_Element_1_22px.png
Sketcher_Mirror_Element_1_22px.png (1.02 KiB) Viewed 790 times
Sketcher_Mirror_Element_2_22px.png
Sketcher_Mirror_Element_2_22px.png (877 Bytes) Viewed 790 times
Sketcher_Copy_Element.svg
(11.83 KiB) Downloaded 92 times
Sketcher_Lineal_Array_Element_2_22px.png
Sketcher_Lineal_Array_Element_2_22px.png (893 Bytes) Viewed 790 times
Sketcher_Radial_Array_1_22px.png
Sketcher_Radial_Array_1_22px.png (985 Bytes) Viewed 790 times
Sketcher_Radial_Array_Eement_2_22px.png
Sketcher_Radial_Array_Eement_2_22px.png (944 Bytes) Viewed 790 times
and these are the matching svg files from which the above were exported.
Sketcher_Mirror_Element.svg
(15.5 KiB) Downloaded 16 times
Sketcher_Mirror_Element_2.svg
(12.73 KiB) Downloaded 16 times
Sketcher_Copy_Element_1_22px.png
Sketcher_Copy_Element_1_22px.png (840 Bytes) Viewed 790 times
Sketcher_Lineal_Array_Element_2.svg
(21.79 KiB) Downloaded 19 times
Sketcher_Radial_Array_Element.svg
(24.5 KiB) Downloaded 86 times
Sketcher_Radial_Array_Element_2.svg
(22.51 KiB) Downloaded 20 times


Jim
mk2
Posts: 77
Joined: Wed Dec 10, 2014 4:27 pm

Re: [ALPHA testing, user input] Sketcher: New Feature: Add Symmetric elements

Postby mk2 » Fri Jul 24, 2015 1:02 pm

Hello,

nice to see this sketcher-tools. They are really welcome for the sketching process, in my opinion! ;)

Thank you for your work!

Kind Regards mk2
triplus
Posts: 8839
Joined: Mon Dec 12, 2011 4:45 pm

Re: [ALPHA testing, user input] Sketcher: New Feature: Add Symmetric elements

Postby triplus » Fri Jul 24, 2015 2:54 pm

jmaustpc wrote:Hi all
I see triplus has posted some icons, I had started experimenting with making a set so I will post where I had got to.
I made them as @abdullah asked and didn't want to left this loose end for to long. From my point of view i see them fit and will give the rationale behind them in the following responses.
My understanding is that we are talking about transforms of the element within the sketch, i.e some of the sketch's contents, not the entire sketch. My first reaction to triplus's icons is that to me they look like transforms of the entire sketch.
When i did toggle button i investigate the current Sketcher WB color scheme and decided i will use white background and red outline as a general indication of sketcher geometry.
I was trying to think of a theme that would be consistent with the previously existing icons. I was thinking the icon need a "basic" or "standard" element, which for most of the Part workbench tends to be a cube, for sketcher that basic common element might be a sketcher line. For some icons the function is better described by a curved line and others with straight lines.
I don't think this set of tools fits in with existing icons (except with toggle button) as this is the first set of tools used for transforming sketcher geometry in this particular way. Therefore a line could work but i do believe "group of" sketcher geometry is more appropriate indicator. I did use line for Copy icon but the main rationale behind that is more complex geometry doesn't make sense at that size.
One element in each icon is green as this is the default "is selected" colour for a sketcher element. The idea is that item is selected and clicking the icon will produce the non-selected elements.
My opinion is/was this set of tools doesn’t fit on the Sketcher tools toolbar. On that toolbar you have tools to create for example single closed sketcher geometry loop and some show/hide and selection tools. This set of tools would in my opinion be more fit on new toolbar named transform geometry.

Anyway i made the icons and gave rationale behind them and beyond that i will leave it for others to decide. If any additional question or suggestion arises feel free to ask (i will probably be able to answer them tomorrow as today i have less time available).
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: [ALPHA testing, user input] Sketcher: New Feature: Add Symmetric elements

Postby abdullah » Mon Aug 03, 2015 3:30 pm

Hi guys!!

Lately I have not had so much time to code. I have just committed a bug fix for endpoint-to-endpoint tangency (it took me a while to discover what was causing the issue).

I would like to ask for user input regarding the toolbar issue. Should these icons be placed in a new toolbar or should they remain in the Tools toolbar?

Nor do I have any criteria to decide when a new toolbar should be inserted, neither am I familiar with the problems with having many toolbars, or many short toolbars or fewer long toolbars... My original decision to put these into the tools toolbar was mostly motivated not to interfere with other existing toolbars created by others (the tools toolbar was created by me last year). Let me know what you think!!

About icons

Thank you so much for taking the time to do icons guys. I really appreciate it. I have no artistic capabilities :D

I have read the other icon related thread and I really really would not like this to become an icon war :( . I have worked with both of you and both of you have been (are) important to me, both in terms of advice, user input, testing, icon making...

I would be glad if somehow this gets merged into a single proposal on the merit of the icons, style of the Sketcher,... things I am not qualified to judge... maybe I am asking too much :?
triplus
Posts: 8839
Joined: Mon Dec 12, 2011 4:45 pm

Re: [ALPHA testing, user input] Sketcher: New Feature: Add Symmetric elements

Postby triplus » Mon Aug 03, 2015 11:22 pm

abdullah wrote:About icons

Thank you so much for taking the time to do icons guys. I really appreciate it. I have no artistic capabilities :D

I have read the other icon related thread and I really really would not like this to become an icon war :( . I have worked with both of you and both of you have been (are) important to me, both in terms of advice, user input, testing, icon making...

I would be glad if somehow this gets merged into a single proposal on the merit of the icons, style of the Sketcher,... things I am not qualified to judge... maybe I am asking too much :?
Yes i understand what you are saying and i don't want you to find yourself in situation like that. Therefore in situations like this just make a poll or this time just use the icons Jim provided.

P.S. As for the toggle icon in Sketcher WB i think the current one needs to stay for a while.
jmaustpc
Posts: 9586
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: [ALPHA testing, user input] Sketcher: New Feature: Add Symmetric elements

Postby jmaustpc » Wed Aug 05, 2015 2:44 pm

Hi Abdullah :)
I think your work is useful and important! :)

I have been, and still am, very busy on non-FreeCAD things I no longer have the time to read every single post on the forum or follow all the development branches but I do want to encourage you and see FreeCAD advance in general. I have been away for a few months for various reasons but if you send me a PM it would send me an email telling me. So if you ever want me for some reason and I am not around feel free to send me a PM. :)

I have successfully compiled your branch on Kubuntu 12.04 and I will follow and test your work.
abdullah wrote:I would like to ask for user input regarding the toolbar issue. Should these icons be placed in a new toolbar or should they remain in the Tools toolbar?
They should be in the tools toolbar.... if in using them for a while it becomes apparent that there is an advantage to a new tool bar then perhaps that could be a separate issue, ...or to put it another way, lets first lets get the functionality correct first and then worry about the toolbar.

Jim


OS: Kubuntu 12.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5214 (Git)
Build type: Debug
Branch: _new_sketcher_functionalities_
Hash: cb723bd8e998f012a7a06d500744f331d09f2c34
Python version: 2.7.3
Qt version: 4.8.2
Coin version: 3.1.3
OCC version: 6.7.1
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: [ALPHA testing, user input] Sketcher: New Feature: Add Symmetric elements

Postby abdullah » Wed Aug 05, 2015 3:02 pm

Hi folks,

Thanks for your comments. :D

I have had some time to code lately.

Same branch as before:
https://github.com/abdullahtahiriyo/Fre ... ionalities_

Now there is UI support for direct copy... I am sure many will be happy with this.

This is the extra functionality:

Code: Select all

Sketcher: UI Copy Support & 2D Array python command rework
    
    ==========================================================
    
    - Support for copying geometric elements in the sketcher with Ctrl+C (or using the still missing icon). It will show you the vector of displacement from the
    "reference point". The reference point can be chosen by the user (although it is not necessary to do it so) by making the point the user wish to be the reference point
    the last selected element. It conveniently incorporates "autoconstraints", so that you can make this point (the one of the copy) directly coincident with any other point in the sketch.
    
    - Python 2D array command modified to lock elements position using construction lines and constraints.
    - Support for different spacing between u and v directions (the direction of the cols and the direction of the rows).
    
    - Support to avoid copying DistanceX and DistanceY constraints when used for locking a point. This means that if the geometry that you copy(array) is
    fully constraint, the resulting 2D array is also fully constraint.
The next item in my agenda is the UI stuff for array creation. It works already from Python and I am quite happy with the result. But I understand that it will not be of much use until it can be used with the UI. Some teaser:
originalgeo.png
originalgeo.png (19.31 KiB) Viewed 633 times
arrayofgeo.png
arrayofgeo.png (89.42 KiB) Viewed 633 times
This was made using this python command:
App.ActiveDocument.Sketch.addArray([0,1], App.Vector(150,150,0),3,4,True,0.5)

it takes:
- the list of geoids to copy: [0,1]
- the vector of displacement in the cols direction (the vector of displacement in the rows direction will be perpendicular): [150,150,0]
- 3 elements in the first dimension
- 4 elements in the second dimension

The last two are optional parameters.
- the first is "constraint the position of the copies": True (so do generate the construction lines and other constraints to keep it in place). The parameter defaults to False.
- the second is a scaling factor for the second dimension (so that you can advance for example 200 mm in the first dimension and 100 mm in the second dimension, if 0.5 is used). The parameter defaults to 1.0. If 1.0 is used the second dimension is forced to be the same as the first dimension by equality constraints.

As an extra, it could be implemented that instead of copying 1:1 all the constraints of the selected geometry, dimensional constraints are identified and substituted by equality constraints...

Let me know your impressions...

Regarding the icons and toolbar, I intend to use jmaustpc icons in the existing bar. The reasons behind it are: Triplus pointed to this possibility. I can not decide on creating a new toolbar (I do not know which one is the right choice), so I stay with the existing one. In this context, the icons provided by jmaustpc match the style of the existing toolbar.

Edit: If you use the python array command, execute one "App.ActiveDocument.recompute()" or "App.ActiveDocument.Sketch.solve()".
triplus
Posts: 8839
Joined: Mon Dec 12, 2011 4:45 pm

Re: [ALPHA testing, user input] Sketcher: New Feature: Add Symmetric elements

Postby triplus » Wed Aug 05, 2015 3:34 pm

Regarding the icons and toolbar, I intend to use jmaustpc icons in the existing bar. The reasons behind it are: Triplus pointed to this possibility. I can not decide on creating a new toolbar (I do not know which one is the right choice), so I stay with the existing one. In this context, the icons provided by jmaustpc match the style of the existing toolbar.
Sure you should do it like that as i don't feel strongly about it. And to avoid any "icon war" and "toolbar name" situations as we seen that in that other thread. There was demand for feedback and icons and that is why i got involved. To close that loose end.

As for waiting for somebody "to return" i think this is FOSS project and while Jim was away if i counted correctly 10 new icons where added to Sketcher WB. Therefore luckily FreeCAD has vibrant community build around "design issues". This is something i feel is still a bit convoluted regarding leveraging this potential. "Design" is still more like an "exclusive club" when it comes to FreeCAD but this is changing. For example there is quick response when it comes to requesting icons and there is first 3rd Party quality theme pack in development for FreeCAD. I am guessing 3rd party quality icon packs could follow. For example i doubt there will be "material design" icons by default in FreCAD soon. But there could be 3rd party icon packs available to fill the gap. They will probably be used by minority of FreeCAD users at first but i am sure they will influence the design choices from the outside over time. As for example with the PPA. Norm took a brake but PPA went online regardless of that fact.

And there is constant evolving and that is a good thing. For example if we look at the toggle icon. It went trough all the usual procedures but still some users have issue with it. I guess that is normal and we can be lucky we have that. To agree on something and still to not let it go and try to evolve it over time. And then there is the ultimate challenge. When will the FreeCAD logo change. Likely not soon but i am sure it will evolve soon enough as everything else does.