Developing for Path - sliptonic/FreeCAD GitHub Wiki
Developing Operations
Think twice before creating a new operation. More often than not, it's preferable to add functionality to existing operations rather than build a new one.
Guidelines for creating new operations:
-
The new operation meets a different kind of user intent. New tool paths for meeting the same intent should probably be implemented as improvements to existing operations. eg. We have operations for clearing a pocket. A new way of clearing a pocket should be an improvement to pocket rather than a new operation.
-
I want to say something here about machine types but don't know what
-
All operations should have a task panel
-
All operations should have a unique icon
Files
The following files must be (c)reated or (m)odified
(c) FreeCAD/src/Mod/Path/Gui/Resources/panels/PageOpXYZEdit.ui
This is the task panel edit page for the operation. New ops will have one or more of these. Edit with QT Designer
(c) FreeCAD/src/Mod/Path/Gui/Resources/icons/Path-XYZ.svg
This is the icon that will display in the menu or on the toolbar. Edit with inkscape. FreeCAD has some standards for icon design. Search the forum or ask.
(c) FreeCAD/src/Mod/Path/PathScripts/PathXYZGui.py
This is the GUI for the operation. GUI handling is built on a set of subclasses. Investigate the existing operations thoroughly or ask for help.
(c) FreeCAD/src/Mod/Path/PathScripts/PathXYZ.py
This is the main file for the operation. It defines the logic for generating the actual tool path.
(m) FreeCAD/src/Mod/Path/PathScripts/PathSelection.py
This controls how selection is handled. New operations will require a selection gate. Follow the standard
(m) FreeCAD/src/Mod/Path/CMakeLists.txt
Modify this file to include the various files that need to be installed on the client machine. Just follow the standard. New entries should be in alphabetical order.
(m) FreeCAD/src/Mod/Path/InitGui.py
This file is modified to register the gui commands in the toolbars and menus.
(m) FreeCAD/src/Mod/Path/Gui/Resources/Path.qrc
This file directs the creation of the resource file which contains all the gui elements to be loaded dynamically at run time. Your .ui file and icons need to be added here to be available at run.
(m) FreeCAD/src/Mod/Path/PathScripts/PathGUIINit.py
add your GUI file here to the import list
Developing Dressups
Dressups are easier to develop than operations. The guidelines for whether a dressup is appropriate:
- Does the proposed logic modify an existing path?
- Does the proposed logic compensate for some real-world limitation of the material, machine, or tool?
- Is it conceivable that the same modification could be applied to more than one operation type?
Files
(c) FreeCAD/src/Mod/Path/PathScripts/PathDressupABC.py
This is the main dressup file. It contains the logic for modifying the base path.
(m) FreeCAD/src/Mod/Path/CMakeLists.txt
Modify this file to include the various files that need to be installed on the client machine. Just follow the standard. New entries should be in alphabetical order.
(m) FreeCAD/src/Mod/Path/InitGui.py
This file is modified to register the gui commands in the toolbars and menus.
Developing Post Processors
FreeCAD/src/Mod/Path/PathScripts/post/foo_post.py