3Dsurface unnecessary repeat on exit.

Here's the place for discussion related to CAM/CNC and the development of the Path module.
User avatar
freman
Posts: 1134
Joined: Tue Nov 27, 2018 10:30 pm

3Dsurface unnecessary repeat on exit.

Postby freman » Thu Jul 02, 2020 9:54 am

3Dsurface does not seem to accurately keep track of when the model has changed. This can lead to unnecessary recalculation when hitting OK to accept the path and leave the UI dialogue.

If parameters are set for a path and Apply is clicked, the path is calculated and displayed. If the path is fine and the user clicks OK to exit, without any other interaction with the parameter settings, the whole thing gets recalculated.

Due to the potentially very long calculation times which can occur with the 3D tools this is particularly inconvenient. If a path takes several minutes to compute, you grin and bear it, but doing it all again pointlessly is very painful.

It may be part of the same issue that the state of the apply button very often does not reflect when a recalculation is needed. Often a parameter is changed and Apply remains greyed out, even though often it is still in an active state.

I have noted this elsewhere in comments but this probably needs a separate thread so that it does not get forgotten.

Thanks.

PS. This may be happening on 2.5D tools as well though generally goes unnoticed since the calculation time is much faster in general.
User avatar
freman
Posts: 1134
Joined: Tue Nov 27, 2018 10:30 pm

Re: 3Dsurface unnecessary repeat on exit.

Postby freman » Sun Jul 05, 2020 2:12 pm

Annex to this issue, I also noticed that coming out of "inactive" state also forces a recomputation of the path.

I also wonder if this is necessary. Has the path been isolated from other changes in the model while in the inactive state which could potentially render it stale?

Again this may be belt and braces failsafe repetition which is fine for 2.5D but is with human scale computation time of 3D paths this is an issue. Any unwarranted recomputation is a big time waster which costs real user time, not just CPU cycles.
User avatar
sliptonic
Posts: 1791
Joined: Tue Oct 25, 2011 10:46 pm

Re: 3Dsurface unnecessary repeat on exit.

Postby sliptonic » Sun Jul 05, 2020 2:55 pm

These are legitimate issues but I wouldn't expect a fast response. We have so many fish to fry (both large and small) that this level of optimization is likely going to have to wait. If course, if it's scratching someone enough, they'll itch it.
User avatar
freman
Posts: 1134
Joined: Tue Nov 27, 2018 10:30 pm

Re: 3Dsurface unnecessary repeat on exit.

Postby freman » Sun Jul 05, 2020 3:21 pm

Well at least if the issue noted and recognised, it may get some attention when the possibility arises.

This will become much more pertinent as 3D path tools become more mainstream. Computation times are a killer.
User avatar
freman
Posts: 1134
Joined: Tue Nov 27, 2018 10:30 pm

Re: 3Dsurface unnecessary repeat on exit.

Postby freman » Mon Jul 06, 2020 5:51 pm

Are you able to confirm what I'm guessing from functionality: that there is currently no attempt to keep track of whether a tool path actually requires recomputing? ie. OK Exit from path dlg always triggers recomp. and an OK exit from job edit dlg always results in recomp. of ALL active paths.

While it would be tidy to have 2.5D tools also only do required work, my experience of FC has been that this is fast enough to reasonably ignore the wasted effort.

I don't think the same can be said of 3D tools.


For example I just added a new 4mm tool controller to my job, ie it is currently unused. That triggered a total recalc on four 3Dsurface paths which is good for about 4min of thumb twiddling for ZERO result. None of the paths needed reworking.

I'm thinking that a dirty flag could be added initially only for 3D paths and ignored by others, until a real need is seen for broader implementation.

There is also some room for workflow improvement in 3D paths since several options are currently only available in the treeview and not settable from the dlg. This means that as soon as you take the focus off that param you trigger a recomputation. eg I change " boundary enforcement" and want to change "cut pattern angle" ( neither available in the UI ), that means TWO long recalculations, not one.

Maybe integrating them into the UI is a simple solution, since there you make as many changes as required and you have control over when and if the recomp happens.

I think there is a real need for this on 3D, so maybe a discussion about how to implement it would be a first step.

Each path element could get a "dirty" status. 2.5D tools are free to ignore this until someone thinks it matters.
Changes in Job Edit would determine whether the job is dirty ( implying setting dirty bit of all existing paths ). Adding a NEW tool, does not affect anything existing: not dirty. Changing a tool's parameters could either set all paths dirty or, in the fullness of time only touch those which use that tool.

Currently, if I change the output filename by one character in the job Editor, it triggers a recomp of all active tool paths. This is crazy !


I have some more detailed ideas, which are not hard to sketch out, but I won't bother formulating a protocol unless there is some agreement about the desirability of advancing the issue.
cahlfors
Posts: 66
Joined: Tue Jan 24, 2012 8:27 pm
Location: Sweden

Re: 3Dsurface unnecessary repeat on exit.

Postby cahlfors » Mon Jul 06, 2020 6:56 pm

Does it seem to make sense to have automatic recalculation of 3D paths at all? There seem to be many ifs and buts?
Maybe it would be more practical to select a path and hit a "recalculate" button?
FreeCAD-daily/Ubuntu or Mint
Mendel 3d-printer/pronterface
HeeksCAM
LinuxCNC
Optimum BF20L mill
GeneFC
Posts: 1342
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: 3Dsurface unnecessary repeat on exit.

Postby GeneFC » Mon Jul 06, 2020 7:57 pm

cahlfors wrote:
Mon Jul 06, 2020 6:56 pm
Maybe it would be more practical to select a path and hit a "recalculate" button?
New feature request. "Make recalculation automatic. Why to I need to hit a button?" :lol: :lol: :lol:

Seriously, the workaround at this time is not too difficult. Simply select "Skip recomputes" (right click on the body) and then use the recompute double arrow icon as needed. This can be done repeatedly while "Skip recomputes" is active. That is why that feature was added a while back.

Gene
User avatar
freman
Posts: 1134
Joined: Tue Nov 27, 2018 10:30 pm

Re: 3Dsurface unnecessary repeat on exit.

Postby freman » Mon Jul 06, 2020 8:05 pm

Until 3D tools came of age, I would say that the current paradigm was fine. Calculation times were quick enough to ignore and the display was always up to date. That made sense. It worked.

As I out-lined above, it is with the advent of the hugely more complex 3D ops that calculation times have increased by an order of magnitude, or more, and this becomes a real problem.

There is probably a lot of inefficiency which could be improved upon once the code stabilises and matures. There seems to be at least three different representations of the same 3D coordinates in different representations with converter classes to juggle it all back and forth, plus jumping between C++ and inefficient python.

To what extent that can be fixed, I'm not sure. It maybe the price of bolting together different OSS libraries with python screws. I'm sure there is room for some worthwhile gains but I doubt we could hope for regaining the order of magnitude. In which case, the need to do less pointless repetition will remain.
User avatar
freman
Posts: 1134
Joined: Tue Nov 27, 2018 10:30 pm

Re: 3Dsurface unnecessary repeat on exit.

Postby freman » Mon Jul 06, 2020 8:11 pm

GeneFC wrote:
Mon Jul 06, 2020 7:57 pm
cahlfors wrote:
Mon Jul 06, 2020 6:56 pm
Maybe it would be more practical to select a path and hit a "recalculate" button?
New feature request. "Make recalculation automatic. Why to I need to hit a button?" :lol: :lol: :lol:

Seriously, the workaround at this time is not too difficult. Simply select "Skip recomputes" (right click on the body) and then use the recompute double arrow icon as needed. This can be done repeatedly while "Skip recomputes" is active. That is why that feature was added a while back.

Gene
Thanks Gene. That is rather well hidden but seems to be a valid solution ( or perhaps workaround ) for the problem I was seeing.
BTW it is not on the context menu of the Body it is at the very top level: "Application".

Thanks for the tip, that will save a lot of wasted time on this model. ;)
etrombly
Posts: 114
Joined: Thu Dec 05, 2019 6:50 pm

Re: 3Dsurface unnecessary repeat on exit.

Postby etrombly » Tue Jul 07, 2020 12:23 pm

freman wrote:
Mon Jul 06, 2020 8:05 pm
There is probably a lot of inefficiency which could be improved upon once the code stabilises and matures. There seems to be at least three different representations of the same 3D coordinates in different representations with converter classes to juggle it all back and forth, plus jumping between C++ and inefficient python.

To what extent that can be fixed, I'm not sure. It maybe the price of bolting together different OSS libraries with python screws. I'm sure there is room for some worthwhile gains but I doubt we could hope for regaining the order of magnitude. In which case, the need to do less pointless repetition will remain.
From performance profiling the majority of the time was spent either in OCCT meshing, or opencamlib actually performing the operation. I'm sure there could be some benefits from pulling more things into c++ once they are stabilized, but the conversions are relatively quick. If we could contribute upstream to opencamlib to improve multi-threading or just performance in general I think that would be the biggest gain, if we are going to continue using it for 3D operations.