Recompute routine in Sketcher

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Konstantin
Posts: 261
Joined: Wed Jul 23, 2014 10:10 am

Recompute routine in Sketcher

Postby Konstantin » Fri Jul 25, 2014 10:20 am

Sorry, I might be wrong, but...
Does Sketcher need to recompute a whole sketch every time I add a new element?
I am editing a sketch and every time I add a new one I must wait for this recomputation ends.
It started wery well, but now I have 48 elements and ~48 secs I must wait. and time grows with element number. I've deleted all constraints, I tought they eat my time and CPU, but nothing changed. Add a line and wait. more and more and more.
And it's about 70% of my sketch. And then add constraints, fit in it's places... oh..
wmayer
Site Admin
Posts: 15279
Joined: Thu Feb 19, 2009 10:32 am

Re: Recompute routine in Sketcher

Postby wmayer » Fri Jul 25, 2014 11:49 am

Does Sketcher need to recompute a whole sketch every time I add a new element?
Of course because otherwise how would you know in which step an error occurred when let's say it updates every 10th change?

However, I don't think the problem is that it updates after every change but the update routine is called a couple of times for each change. So, there is for sure some place for improvements. Another point is that dependent objects (like pad, pocket, ...) don't need to update as long as the sketch is being edited.
Konstantin
Posts: 261
Joined: Wed Jul 23, 2014 10:10 am

Re: Recompute routine in Sketcher

Postby Konstantin » Fri Jul 25, 2014 12:33 pm

Lots of recalculations... and coffee...
If I knew it yesterday, I've been translating FreeCAD. I should leave it for today :)
Loots of coffee.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Recompute routine in Sketcher

Postby NormandC » Fri Jul 25, 2014 1:20 pm

Could you please provide your complete FreeCAD info.

I noticed slowness problems in the sketcher on Ubuntu 14.04. There are no such problems with the same sketches on Ubuntu 12.04. It seems to me like the same problem which affected Ubuntu 13.10.

I'll have to locate the topic about this.
Konstantin
Posts: 261
Joined: Wed Jul 23, 2014 10:10 am

Re: Recompute routine in Sketcher

Postby Konstantin » Fri Jul 25, 2014 1:31 pm

But it was always like that. I still remember the PAIN, when I (about two years ago) tried to make a sketch of a guitar.. Oh...
There was another computer, another version of FreeCAD and another Linux.

Here is my set now
OS: Ubuntu 14.04 LTS
Word size: 64-bit
Version: 0.15.3778 (Git)
Branch: master
Hash: ecbda2772eb399bd609403b23c349ebb715ae321
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
SoQt version: 1.6.0a
OCC version: 6.7.0

But on another hand, Could it be a problem with Coin3d or Qt? Because it goes like that: I add a line, Computer thinking for some time, then finished line appears, computer thinks a litle more (cursor spinning), cursor stops spinning and then comes "third stage" after which FreeCAD releases tools, and refreshes viewport and start working.
wmayer
Site Admin
Posts: 15279
Joined: Thu Feb 19, 2009 10:32 am

Re: Recompute routine in Sketcher

Postby wmayer » Fri Jul 25, 2014 1:33 pm

viewtopic.php?f=3&t=4651&start=40#p36719
But on another hand, Could it be a problem with Coin3d or Qt?
That seems extremely unrealistic to me.
Konstantin
Posts: 261
Joined: Wed Jul 23, 2014 10:10 am

Re: Recompute routine in Sketcher

Postby Konstantin » Fri Jul 25, 2014 1:37 pm

Oh. and what defenatly is not nesesery:
I make distance constraint between points, Computer goes into deep recalculation cicle, Then measure window appears, I click Ok (not changin any thing, And computer goes another round. If I didn't change measure - there's nothing to recalculate.
jmaustpc
Posts: 9619
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Recompute routine in Sketcher

Postby jmaustpc » Fri Jul 25, 2014 1:40 pm

Its quite possible that its taking so long because the sketch is over complicated and/or possibly has some conflicting constraints.

If at all possible make several simpler sketches rather than one overly complex sketch.

Although having said that, 48 items is not as many as some others have used successfully.
Konstantin
Posts: 261
Joined: Wed Jul 23, 2014 10:10 am

Re: Recompute routine in Sketcher

Postby Konstantin » Fri Jul 25, 2014 2:58 pm

Ok. Here is my file.

Let's asume we have lines A,B,C,D,E,F,G,I
Lines D and E are tight with Tangent constraint.
If I move E or D, or any of their points, only C,D,E,F lines are affected (and if we take their points, then add B and G to that list)
And at least A and I are not affected at all. And now imagine a long chain of unneeded dependencies (or whatever) calculated every time I do something
In example I've provided only one constraint is present. But you can even remove it to, then do something and you see what Im talking about. I can drag any point where ever I want but if I release it - FreeCAD goes into DEEP freeze
P.S. Yes, It's a Horsie :lol:
Attachments
horsie.fcstd
(27.97 KiB) Downloaded 41 times
wmayer
Site Admin
Posts: 15279
Joined: Thu Feb 19, 2009 10:32 am

Re: Recompute routine in Sketcher

Postby wmayer » Fri Jul 25, 2014 3:24 pm

Whenever I move one of the arcs the recompute takes 1-2s to finish.
OS: Windows 7
Word size: 64-bit
Version: 0.15.3765 (Git)
Branch: 0001563
Hash: a73ed3144aa078ac8626480bca091bcfecd5cc38
Python version: 2.7.6
Qt version: 4.8.5
Coin version: 4.0.0a
SoQt version: 1.6.0a
OCC version: 6.6.0
Eigen is 3.0.5