Helix computing very slow. How to do performance code changes?

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!
Post Reply
psommerfeld
Posts: 38
Joined: Fri Jul 08, 2022 2:11 pm

Helix computing very slow. How to do performance code changes?

Post by psommerfeld »

I'm doing designs where I need to render screw threads. A single thread, drawn as a helix path, might take 20 seconds to render. Can't imagine a design with 20 of them!
I'm seriously thinking about doing some code profiling. Who to talk to about the details of FreeCAD compute implementation? Who/which forums can I go to to get more info about software and realtime profiling details?
I looking quickly at the source, seems like TopoShape.cpp does the compute, which passes it on to OpenCascade.
I wonder if OpenCascade takes full advantage of SIMD processing in Intel/AMD/M1 processors?

Thanks!
Peter
user1234
Veteran
Posts: 3342
Joined: Mon Jul 11, 2016 5:08 pm

Re: Helix computing very slow. How to do performance code changes?

Post by user1234 »

psommerfeld wrote: Sun Aug 14, 2022 4:47 pm I'm doing designs where I need to render screw threads.
I hope only for printing and not for engineering and drawings, since that is a nogo in CAD in general. But i would assume, that you have set your angular defection and deviation too small. For me a helix works in notime.

Greetings
user1234
psommerfeld
Posts: 38
Joined: Fri Jul 08, 2022 2:11 pm

Re: Helix computing very slow. How to do performance code changes?

Post by psommerfeld »

user1234 wrote: Sun Aug 14, 2022 4:50 pm I hope only for printing and not for engineering and drawings, since that is a nogo in CAD in general. But i would assume, that you have set your angular defection and deviation too small. For me a helix works in notime.
I'm doing some designs for 3d printing that include screw-type fastening. What other option is there to design them? I'm new to FC, and CAD of this type in general.
The attached project takes about 17 seconds to recompute a small change in length of the helix, on a Mac M1. It takes over 45 seconds if I lengthen the helix from 15 mm to 25 mm. Am I doing something wrong?
Attachments
test helix.FCStd
(733.49 KiB) Downloaded 16 times
Screen Shot 2022-08-14 at 1.01.31 PM.png
Screen Shot 2022-08-14 at 1.01.31 PM.png (174.76 KiB) Viewed 971 times
user1234
Veteran
Posts: 3342
Joined: Mon Jul 11, 2016 5:08 pm

Re: Helix computing very slow. How to do performance code changes?

Post by user1234 »

psommerfeld wrote: Sun Aug 14, 2022 5:45 pm I'm doing some designs for 3d printing that include screw-type fastening. What other option is there to design them?
No, for that it is the purpose. Since you wrote, that you want to do many of them, i thought you make a screw library.

There is no project attached, only a screenshot. But as i wrote, try to set the your angular defection and deviation higher. Many time in recalculating goes in the meshing the representation.


Greetings
user1234
Syres
Veteran
Posts: 2893
Joined: Thu Aug 09, 2018 11:14 am

Re: Helix computing very slow. How to do performance code changes?

Post by Syres »

I tested using your file and it take 14 seconds to do any change to the thread. I would definitely look at the Fasteners Wb, the M4 default thread is configurable with custom pitch, length, left hand/right hand and it's way quicker at updating, like 14 times quicker. The wb has in it's Preferences settings a 3D printing scale function applied to all threads/fasteners created.
user1234
Veteran
Posts: 3342
Joined: Mon Jul 11, 2016 5:08 pm

Re: Helix computing very slow. How to do performance code changes?

Post by user1234 »

I have overseen the file. It takes 9 seconds for me. But when the thread does not overlap in front of the bolt, it takes only 7 seconds. I assume cutting it out would be a little bit faster.

Greetings
user1234
User avatar
ThanklessLiving
Posts: 98
Joined: Sat May 30, 2020 1:49 pm

Re: Helix computing very slow. How to do performance code changes?

Post by ThanklessLiving »

The visual clout of having physical threads is quite irrelevant compared to conveying the information that the threads are there. For the rendering, replace your thread with a cylinder of the thread's major diameter and a chamfer on the end, and perhaps attach to it a detail image from your model to show the threads as "zoomed in".
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Helix computing very slow. How to do performance code changes?

Post by Jee-Bee »

I would suggest buy some thread cutting dies and some taps they work always. Less difficulties to create in FC, less difficult to print ...
User avatar
Shalmeneser
Veteran
Posts: 9475
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: Helix computing very slow. How to do performance code changes?

Post by Shalmeneser »

You should use the axis / symmetry.

Code: Select all

 \_Body (Body)
    \_Pad (Pad)
    |  \_frame anchor (Sketch)
    \_Pad001 (Pad)
    |  \_shaft (Sketch)
    \_AdditiveHelix (AdditiveHelix)
       \_Sketch002 (Sketch)
Attachments
test helix_SHALM.FCStd
(106.54 KiB) Downloaded 10 times
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Helix computing very slow. How to do performance code changes?

Post by chrisb »

If you have many threds to model, then using Fasteners workbench is very useful, because you can control thread modeling with a single parameter. And using expressions provides a possibility to switch them off while modeling and then switch them all on in one single go as a final step.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply