[Merged]Regular polygons

Merged, abandoned or rejected pull requests are moved here to clear the main Pull Requests forum.
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Merged]Regular polygons

Post by wmayer »

I wonder, should icons appear besides the labels in the drop down menu? I'm guessing from a previous screen capture that they should...
Do you see icons on the other drop-down tool buttons, e.g. arc, circle?
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [Merged]Regular polygons

Post by NormandC »

I don't see icons in the other drop-downs. I see the icons in the workbench switcher.

I will reboot in Ubuntu 12.04 to compare... FYI my desktop is Unity/GNOME.
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Merged]Regular polygons

Post by wmayer »

Well, then it's a general issue. On 12.04 I also use Unity/Gnome and menus in general don't show any icons there.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: [Merged]Regular polygons

Post by jmaustpc »

Hi guys
normandc wrote: I wonder, should icons appear besides the labels in the drop down menu? I'm guessing from a previous screen capture that they should... :?
The icons appear OK for me in Kubuntu 14.04 64bit.

normandc wrote:
normandc wrote:
wmayer wrote:+ maybe we should think about creating the regular polygon using the construction circle.
I agree, I like to have a construction circle so the polygon can be centered.
I can see that it could be a good idea, is there any "down side"? I was thinking that for now we could at least add one manually by creating a circle with three points on line constraints and setting it to construction mode, although that is quite a few clicks and therefore not very convenient.


OS: Ubuntu 14.04.1 LTS
Word size: 64-bit
Version: 0.15.3789 (Git)
Branch: master
Hash: a1da4bb4fbd0c715edf7b9eecc9d19c0a84511b0
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


Jim
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: [Merged]Regular polygons

Post by ian.rees »

wmayer wrote:Well, then it's a general issue. On 12.04 I also use Unity/Gnome and menus in general don't show any icons there.
Just did a clean out-of-source build and the icons in dropdowns work fine. FWIW, I'm using KDE 4.11.3 at the moment. -Ian-

OS: "Fedora release 20 (Heisenbug)"
Word size: 64-bit
Version: 0.15.3789 (Git)
Branch: master
Hash: a1da4bb4fbd0c715edf7b9eecc9d19c0a84511b0
Python version: 2.7.5
Qt version: 4.8.6
Coin version: 3.1.3
SoQt version: 1.5.0
OCC version: 6.7.0
User avatar
DevJohan
Posts: 41
Joined: Sun Jul 13, 2014 2:36 pm
Location: Stockholm, Sweden

Re: Regular polygons

Post by DevJohan »

Hi,

I've been away these last couple of days.
wmayer wrote: Two points:
+ maybe we should think about creating the regular polygon using the construction circle. Then we can support arbitrary regular polygons.
+ I noticed that after adding a few profiles the adding of new elements becomes very slow. You can even see that new lines and constraints are added step by step. To solve this issue I extended the interface of addGeometry() and addConstraint() a while ago so that all geometries and all constraints can be added in one step. This reduces the required time dramatically.
I totally agree, I can look into making the appropriate changes.

Regarding the second point, another way of achieving similar speedups would be to hold back the recompute() command from these python script commands. I think this would be a more straight forward way when using c++. An alternative would be to delegate the creations of regular polygons to a python script in the Profile library just like the hexagon script. Similar to

Code: Select all

import ProfileLib.Hexagon
ProfileLib.Hexagon.makeHexagonSimple('Sketch')
we could generate a command like

Code: Select all

import ProfileLib.RegularPolygon
ProfileLib.RegularPolygon.makeRegularPolygon('Sketch',"centerpoint", "first corner point")
What do you think?

/Johan
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Merged]Regular polygons

Post by wmayer »

Regarding the second point, another way of achieving similar speedups would be to hold back the recompute() command from these python script commands. I think this would be a more straight forward way when using c++.
It's not the document's recompute() function because this isn't called at all at this time. The bottleneck is that the sketch solver is called for every little addition of a constraint. See the method SketchObjectPy::addConstraint.
An alternative would be to delegate the creations of regular polygons to a python script in the Profile library just like the hexagon script. Similar to
That would be pretty good because it's much easier to write down and fix this Python code.
User avatar
DevJohan
Posts: 41
Joined: Sun Jul 13, 2014 2:36 pm
Location: Stockholm, Sweden

Re: [Merged]Regular polygons

Post by DevJohan »

I've done the discussed changes now. In ProfileLib there is a RegularPolygon.py defining makeRegularPolygon(...), which takes the name of the sketch, the number of corners, the center point as an App.Vector and the first corner as an App.Vector as arguments in that order.

The code

Code: Select all

import ProfileLib.RegularPolygon
ProfileLib.RegularPolygon.makeRegularPolygon('Sketch',6,App.Vector(-5,1,0),App.Vector(10,-5,0))
will create a hexagon centered at (-5,1) and has one corner at (10,-5). The creation is much faster than before, but for regular polygons with many corners ( I tried 45), my debug build is very slow when modifying the sketch.

I've so far noticed that the version with construction circle is quite sensitive to large changes ( a pentagon became a triangle and so forth). The code is once again available at https://github.com/DevJohan/FreeCAD_sf_ ... cherguihex.
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Merged]Regular polygons

Post by wmayer »

Oh, something seems wrong. I get some merge conflicts when trying to rebase on master but I can also copy&paste the changes. Then it seems you forgot to add the file RegularPolygon.py
User avatar
DevJohan
Posts: 41
Joined: Sun Jul 13, 2014 2:36 pm
Location: Stockholm, Sweden

Re: [Merged]Regular polygons

Post by DevJohan »

Then it seems you forgot to add the file RegularPolygon.py
Ok, thanks :oops:

Will look at the other stuff as well
Post Reply