Performance improvements for PartDesign patterns (PR)

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
freedman
Veteran
Posts: 3415
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Performance improvements for PartDesign patterns (PR)

Post by freedman »

davidosterberg
Thanks for looking into this issue, questions about slow array speed have come up hundreds of times. Can't wait to try it.
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: Performance improvements for PartDesign patterns (PR)

Post by davidosterberg »

As mentioned in the OP, topological naming issues is a risk with this PR, since it is changing things around under the hood. I did some testing with recomputing a Topo-sensitive test model created with master. Indeed this is a real issue. That I don't know how to manage best.

1) We could ignore the problem and say that FreeCAD has no guarantees with respect to topological naming.
2) We could keep the old method, and introduce a new Boolean property for Legacy compatibility. Old models would open and default to Legacy=True, and new models would default to Legacy=False. (Edit: is this even possible?)

After having written this down, I would say that option 2 is my favorite. But maybe there are other possibilities that were not mentioned. Is there any precedence for what to name the "Legacy" property?


In below model, there are some fillets that are applied on the result of the MultiTransform. You can see how one fillet on a hole edge jumps to another edge when I recompute the model.

topo_problems.gif
topo_problems.gif (545.98 KiB) Viewed 2615 times
Last edited by davidosterberg on Tue Feb 23, 2021 5:59 pm, edited 4 times in total.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: Performance improvements for PartDesign patterns (PR)

Post by chrisb »

I don't really see from the screencast what you have changed. If I understand it right, then it is not the pattern itself which has troubles with the topological naming, but rather further steps after it, which use generated geometry. In that case I'm for option 2 too.

Isn't the legacy property the same as the Overlap mode from above?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: Performance improvements for PartDesign patterns (PR)

Post by davidosterberg »

chrisb wrote: Tue Feb 23, 2021 4:12 pm I don't really see from the screencast what you have changed. If I understand it right, then it is not the pattern itself which has troubles with the topological naming, but rather further steps after it, which use generated geometry. In that case I'm for option 2 too.

Isn't the legacy property the same as the Overlap mode from above?

There are just some fillets applied further down the tree. You can see how one fillet on a hole edge jumps to another edge when I recompute the model. Overlap mode is still 3x faster than Legacy mode.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: Performance improvements for PartDesign patterns (PR)

Post by chrisb »

I saw the fillets, I just wondered what the Rename would do.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: Performance improvements for PartDesign patterns (PR)

Post by davidosterberg »

davidosterberg wrote: Tue Feb 23, 2021 3:52 pm 2) We could keep the old method, and introduce a new Boolean property for Legacy compatibility. Old models would open and default to Legacy=True, and new models would default to Legacy=False.
Well this sounded good in principle. But now when I try to implement it I figure out that I dont really know how to achieve this effect. Anybody know if it is possible?
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: Performance improvements for PartDesign patterns (PR)

Post by chrisb »

With a new OCC version there is quite some probability that old models will break with toponaming issues. This was discussed some time ago here iin the forum. Perhaps we should simply accept that some models need some rework.

And it would keep the code clean :mrgreen: .
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Performance improvements for PartDesign patterns (PR)

Post by Jee-Bee »

May i have a question.
If i have a object and i add a extrude on it, then then exacly the same on with a shift less then the first one.
Is the pad also checking for intersection?
If the answer is no why does pattern have? I would say the only thing the pattern does is creating a loop with the selected features over and over again?
If yes there a measurable difference?
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: Performance improvements for PartDesign patterns (PR)

Post by davidosterberg »

Jee-Bee wrote: Wed Feb 24, 2021 8:36 am If the answer is no why does pattern have? I would say the only thing the pattern does is creating a loop with the selected features over and over again?
Your description is accurate for what the pattern features do currently. Unfortunately it is too slow to be useful if there are many copies. This is because each fuse operation is more costly than the previous, because the base object is getting more and more faces for every copy that is sequentially fused to it. And the OCC fuse operation has to start from scratch each time.

The new code does it faster by detecting if there is overlap between what is added/removed. If there is no overlap all the copies are made into a compound object (very fast) that is cut/fused with the base object in one operation. If there is overlap between the copies then the copies are fused first (in one operation) and then cut/fused to the base (one operation). This way we get the needed speedup.

I hope it helps.
User avatar
-alex-
Veteran
Posts: 1849
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Performance improvements for PartDesign patterns (PR)

Post by -alex- »

Hi David and thank you for recent enhancements in PD!
davidosterberg wrote: Tue Feb 23, 2021 3:52 pm As mentioned in the OP, topological naming issues is a risk with this PR, since it is changing things around under the hood. I did some testing with recomputing a Topo-sensitive test model created with master. Indeed this is a real issue. That I don't know how to manage best.
- hypothesis nb1: realthunder's toponaming algorythm will be merge in FC0.20
- hypothesis nb2: toponaming algo will fix any issue related to your PR as topologie is concerned
1) We could ignore the problem and say that FreeCAD has no guarantees with respect to topological naming.
2) We could keep the old method, and introduce a new Boolean property for Legacy compatibility. Old models would open and default to Legacy=True, and new models would default to Legacy=False. (Edit: is this even possible?)
If both above hypothesis were correct, I would say we could ignore the problem and say that FreeCAD has a reliable guarantee with respect to toponaming :-D

Could you test the behaviour of your PR with Linkstage3 branch of @realthunder?
Just my 2 cts. Does it make sens in your opinion?
Post Reply