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.
- 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.
- 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.
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