Proposed Extensions Improvements - PR #4388

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Russ4262
Posts: 952
Joined: Sat Jun 30, 2018 3:22 pm
Location: Oklahoma
Contact:

Proposed Extensions Improvements - PR #4388

Post by Russ4262 »

Good afternoon fellow FreeCADians.
Starting a few months back I began work on some improvements to the Extensions feature available currently in the PocketShape op in 0.19. As with many of my endeavors, they rarely have defined start and stop boundaries. Well, this was no exception and has morphed into a much larger project than initially conjured up. Nonetheless, the improvements and slight changes have many benefits.

With this thread I would like to ask for feedback on what I will call the official draft of this PR #4388, [Path] Improved Extensions feature and add to Adaptive operation. I say official draft because I do not have any other features I wish to add at the moment and what is done seems fairly stable at this point. As such, I am content to leave it alone except for bug fixes or consensus changes identified here in this thread.

The changes are comprised of three parts:
1. Actual extensions functionality improvements
2. GUI changes to accommodate new features
3. Application of this upgraded Extensions feature to the Adaptive op.

In more detail:
1. Changes to functionality include:
  • A waterline extension is now available per face and has some built-in model awareness.
  • An extended outline extension is now available per face with some built-in model awareness.
  • An auto-disable mechanism is active to disable the Extensions feature upon initialization when total edges surpass 30 in count.
  • Extensions are recalculated when the `Use Outline` property is toggled in the GUI Task Panel, updating to only show available extensions on the exterior of each face selected.
  • Relocation of physical Extensions code to `features` subfolder in parent `PathScripts` folder.
  • The code isolation now creates a more globally available feature.
2. Changes to GUI and Task Panel:
  • A manual enable/disable push button has been added.
  • A manual include/ignore edges and wires push button has been added.
  • A warning message is displayed in the event that the Extensions feature has been auto-disabled. However, the manual enable button is available to enable and use Extensions feature, as well as the manual include/ignore edges/wires button.
  • An extend outline extension entry is added for each face for selection just as a normal edge or wire.
  • A waterline extension entry is added for each face for selection just as a normal edge or wire.
  • Visualizations for the new extended outline and waterline extensions.
  • When Default Length is changed, it triggers an update of the extensions and their visuals.
3. Application of Extensions to Adaptive:
  • The same Extensions feature is available to Adaptive op.
  • The availability of the Extensions feature and subsequent testing has revealed at least one bug in the Adaptive code.
Discussion topics, among others you have to present here:
1. The auto-disable threshold is set at 30 in this PR. I did no scientific research to arrive at that number, but my tests show it to be a decent choice. I think perhaps this value could be entered as a Path setting in the Parameter settings within FreeCAD to allow greater customization for uses. Just an idea.

2. The separate `Include/Ignore Edges and Wires` might be too much decision making. However, it is handy when the selected face(s) have large numbers of edges that are available for extensions. Trying out this PR and interaction will be the best way to determine if this feature should stay or go. My experience has shown it to be useful.

3. There is a bug, identified by Sliptonic, in the current Extensions code that is not fixed in this PR. I will likely need MLampert's expertise to track down the critter and squash it out.

4. At the moment, the improvements default to what is experienced now with the Extensions code with a little more compute time on loading due to the calculation of and extended outline and waterline extensions for each face selected. Therefore, I think it might be useful to add another checkbox or push button that controls the inclusion of these two types of extensions. Perhaps make it a checkbox and change the aforementioned and included `Edges and Wires` button to a checkbox as well. Just thinking.

5. I know there are some bugs with the extended outline and waterline extension visualizations not always displaying correctly. I ask for MLampert's assistance with correcting this. I might be able to fix it, but I bet it will be much better and quicker with his expertise. :)

6. There is a known bug in the improvements related to the auto-disable feature where the Extensions are auto-disabled upon editing of an existing op that has extensions in use - the extensions in use are not checked in the list as they should be when the user enables Extensions. I will work to track down and fix this.

EDIT: 7. I would like to implement a storage mechanism, perhaps a simple dictionary object, that stores computed extension objects for the GUI list so that the extended outline[EO] and waterline[W] extensions are not recomputed in certain situations. For example, as it is now the EO and W are recomputed if the user toggles the Use Outline feature, but there really is no reason for doing so if we can just save those originals and recall them. Just thinking here about improving efficiency in the PR changes.


I will await member feedback and make necessary changes before converting the PR to a regular PR.
A screenshot of the updated Task Panel is attached.

Have a great weekend.
Russell
Attachments
Snip macro screenshot-2da0e8.png
Snip macro screenshot-2da0e8.png (246.6 KiB) Viewed 1009 times
Last edited by Russ4262 on Sun Apr 25, 2021 12:56 pm, edited 2 times in total.
spanner888
Posts: 327
Joined: Tue May 28, 2019 10:51 am

Re: Proposed Extensions Improvements - PR #4388

Post by spanner888 »

Wow!

Will certainly take me a while to play with all this, before I can make any "intelligent" comments.

thanks once again
Russ
Russ4262
Posts: 952
Joined: Sat Jun 30, 2018 3:22 pm
Location: Oklahoma
Contact:

Re: Proposed Extensions Improvements - PR #4388

Post by Russ4262 »

Evening fellow FreeCADians.
Okay, not going to hold back. I keep wanting to call us "FreeCs" as a fun, FreeCAD-based form of "freaks", but I just cannot do it because we are not abnormal. Nonetheless, the thought has crossed my mind.

Phew... okay now that that is out of my system (no pun intended), I have positive news related to the PR proposed in this thread.

I have fixed the failure to reload the existing extensions list with the new auto-disable feature. Existing active extensions for an operation now are properly displayed when editing an existing operation that has extensions. Basically, this is a fix for a regression introduced due to changes with the new PR.

I also added an internal extension caching feature on the GUI side so that new _Extension() objects are not created when certain conditions change and trigger a recompute of all extensions. This speeds up the overall experience with the new features. The cache is reset if the `Default Length` is changed so as to compute new extensions and their corresponding visuals. This cache helps tremendously when enabling and disabling the overall Extensions feature. Extensions are created once and cached for later access unless the characteristics of extensions require a complete recompute (at least that is the intended behavior).

I have not added the second push button or checkbox to control the new `Extend_Outline` and `Waterline` extensions. This can be added if such a change is desired.

Lastly, since I have not had any usage feedback here, I have opted to change the PR from a Draft to a Regular PR that is ready for review, with the improvements mentioned above. Upon positive review and acceptance by project managers, it will be ready for merger into 0.20_pre if it is deemed a positive, quality improvement to the Path WB.

Have a great night. Thanks for your comments, support, and testing.
Russell
User avatar
freman
Veteran
Posts: 2214
Joined: Tue Nov 27, 2018 10:30 pm

Re: Proposed Extensions Improvements - PR #4388

Post by freman »

Another significant improvement to Path, thanks for all this effort. I'll have to spend some time testing before I can comment much.

3. There is a bug, identified by Sliptonic, in the current Extensions code that is not fixed in this PR. I will likely need MLampert's expertise to track down the critter and squash it out.
Could you elaborate on what that is about ?
Russ4262
Posts: 952
Joined: Sat Jun 30, 2018 3:22 pm
Location: Oklahoma
Contact:

Re: Proposed Extensions Improvements - PR #4388

Post by Russ4262 »

freman wrote: Sat May 15, 2021 7:36 pm ...
3. There is a bug, identified by Sliptonic, in the current Extensions code that is not fixed in this PR. I will likely need MLampert's expertise to track down the critter and squash it out.
Could you elaborate on what that is about ?
Morning sir.
I really do not have much information other than I have verified a bug exists. I have not attempted to track it down, nor the causes thereof. In simple form, there are edges with certain characteristics or relationships that the Extensions feature fails to properly extend geometrically speaking. An incorrect extension shape is returned. The new features presented in this PR appear to be granting access to these problematic edges, at least in preliminary testing.


Cordially,
Russell
Post Reply