FreeCAD sketcher slowing down due to restrains

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
japie
Posts: 163
Joined: Thu Jun 26, 2014 5:49 am

FreeCAD sketcher slowing down due to restrains

Post by japie »

Hello, with attached drawing FreeCAD is slowing down to an unacceptable level, there are a lot off restrains but not that much, it looks to me that most of the trouble is caused by using == on objects and was wondering is this caused by a bug/leak or due to internal calculations?
gordelplaat.FCStd
(73.08 KiB) Downloaded 16 times
OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18260 (Git)
Build type: Release
Branch: master
Hash: dbf0644b60c35273525985fa13859ad39b0c10df
Python version: 3.7.3
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Netherlands (en_NL)
Last edited by japie on Sat Sep 21, 2019 10:56 am, edited 1 time in total.
kisolre
Veteran
Posts: 4162
Joined: Wed Nov 21, 2018 1:13 pm

Re: FreeCAD sketcher slowing down due to restrains

Post by kisolre »

This should be at lears 6 sketches - one external contour, 3 for the holes that can be linear patterned, one for the longer hole and one for all other holes. There are 474 constraints in that sketch. What number would you consider too much?
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: FreeCAD sketcher slowing down due to restrains

Post by chrisb »

NormandC has stated a limit of approximately 100 constraints for FreeCAD models, and I think this is still a very good value.
japie wrote: Sat Sep 21, 2019 7:29 am Hello, with attached drawing FreeCAD (latest dev rev. on osX) ...
If you want to inform people here about your version - and it is a good idea to do so -, please attach your FreeCAD infos as described following the IMPORTANT link above. The forum is often searched for similar issues, and I am quite sure that in a month your information will be utterly wrong.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
japie
Posts: 163
Joined: Thu Jun 26, 2014 5:49 am

Re: FreeCAD sketcher slowing down due to restrains

Post by japie »

kisolre wrote: Sat Sep 21, 2019 7:47 am This should be at lears 6 sketches - one external contour, 3 for the holes that can be linear patterned, one for the longer hole and one for all other holes. There are 474 constraints in that sketch. What number would you consider too much?
To be honest it shouldn't matter if there where 10 or 10e6 constrains ;-) And no this can't be 6 sketches (wel it can off course) since my lasercutter only except dxf files so it would be handy if I can export it as one file instead of 6 different ones ;-)
I understand your point btw but I draw from the POV from machining, so one sketch that's gonna be laser or watercutted (or lathe work if it's round) for the base material, holes or shapes that are gonna be machined afterwards I draw as separate steps so my drawing tree contains the same steps as the production steps.
chrisb wrote: Sat Sep 21, 2019 10:25 am NormandC has stated a limit of approximately 100 constraints for FreeCAD models, and I think this is still a very good value.
There is a big difference in what constrain type uses for system resource, just connecting dots doesn't do anything but using a lot of == does, if I don't do == but set true measurement for those objects the system doesn't slow down (no matter if it are lines or arcs) so it's not the number of constrains but the used type, can't it be that == is leaking memory or triggering a constant calculation loop or something weird?

ps: modified post with build info, forgot that sorry.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD sketcher slowing down due to restrains

Post by DeepSOIC »

japie wrote: Sat Sep 21, 2019 11:19 am To be honest it shouldn't matter if there where 10 or 10e6 constrains
But it does. Sketcher internally builds quite a few matrices with a size m*n, where m is number of internal DOFs and n is number of internal constraints (amounting to circa 2x the constraints you see in the list). For fully constrained sketches, m==n. Solver runs quite a formula for each element of that matrix for each iteration, that can take some time.
For 1e7 constraints, one matrix alone will take 8e14 bytes of memory, i.e. almost a petabyte.
japie
Posts: 163
Joined: Thu Jun 26, 2014 5:49 am

Re: FreeCAD sketcher slowing down due to restrains

Post by japie »

DeepSOIC wrote: Sat Sep 21, 2019 11:49 am Solver runs quite a formula for each element of that matrix for each iteration, that can take some time.
So every all ready solved element is recalculated at every change? And every recalculation contains all different possibilities in one formula?
DeepSOIC wrote: Sat Sep 21, 2019 11:49 am For 1e7 constraints, one matrix alone will take 8e14 bytes of memory, i.e. almost a petabyte.
Don't think my system is up to that :lol:
Thanks for responding, I am an end user and use what is convenient for me so sometimes I hit the limit? (for "the" you can fill in "FreeCAD's" or "my" as you please ;-))
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD sketcher slowing down due to restrains

Post by DeepSOIC »

japie wrote: Sat Sep 21, 2019 12:55 pm So every all ready solved element is recalculated at every change? And every recalculation contains all different possibilities in one formula?
Yes, it has to be done to test if the element is indeed solved.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD sketcher slowing down due to restrains

Post by DeepSOIC »

Regarding dxf export. I'm not 100% but quite sure, the object to be exported as dxf doesn't have to be a sketch. It probably can be a face. Then, you can use Boolean operations on faces (in Part workbench). Relevant operations you might be interested in:
* Part Make Face From Wires (in Part WB menu), to convert sketches to faces
* Draft Array
* Part Cut, Part Common
* Part Union, don't forget to change its "Refine" property to True to merge faces.
You can also build a 3d solid in PartDesign or elsewhere, and then use its face for your export (Draft FaceBinder will help with face extraction)
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD sketcher slowing down due to restrains

Post by DeepSOIC »

Also, you seem to be using complex arrangements. PartDesign Patterns can be difficult to set up. Lattice2 add-on workbench may come in handy, as it allows to make arrays on edges, which you can draw in sketcher.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: FreeCAD sketcher slowing down due to restrains

Post by sgrogan »

japie wrote: Sat Sep 21, 2019 11:19 am since my lasercutter only except dxf files so it would be handy if I can export it as one file instead of 6 different ones
You can multi-select many sketches the export as .dxf to get one file.
"fight the good fight"
Post Reply