FreeCAD-addons icon indicating copy to clipboard operation
FreeCAD-addons copied to clipboard

README: Create a section on how to create a Workbench

Open luzpaz opened this issue 5 years ago • 13 comments

Relevant links:

  • https://github.com/FreeCAD/Workbench-Starterkit
  • https://freecadweb.org/wiki/Workbench_creation

luzpaz avatar Sep 29 '18 13:09 luzpaz

CC @looooo

luzpaz avatar Dec 04 '18 18:12 luzpaz

@luzpaz the starter-workbench is not really related to FreeCAD-addons. I guess it should be possible to also integrate pip-installable modules in the addon-manager but I did not had the time to think about this. Something to think about in the next year.

looooo avatar Dec 04 '18 20:12 looooo

It's not related ? Isn't it a template for a workbench ? Addons are workbenches, modules, and macros... seems related to me.

luzpaz avatar Dec 04 '18 21:12 luzpaz

yes it's a template for a work-bench / module. But I don't want to mix this with the old way of creating workbenches, as this will lead to misunderstandings. Currently both ways are supported, but I guess we should think about how to make both ways more compatible as the old-style workbenches won't go away. Also most users that trying to code something for freecad have not enough python background to understand why new way of creating workbenches is better. But yes, I will try to work on documentation if time allows.

looooo avatar Dec 05 '18 10:12 looooo

Many thanks Lorenz (Loooo) and other contributors for all you do for the community !! I am slowly building a DIY router, 5 axis milling, and will very much appreciate the use of FreeCAD for the CAD and CAM once my hardware is ready (slow down by the cost of the parts now). MANY THANKS!

pierrard avatar Dec 05 '18 10:12 pierrard

@looooo I see, thanks for explaining that. I didn't understand there was a 'better' preference. IMHO, we could create documentation for this pre-0.18 so any of the users that 'come in to the fold' of FreeCAD can make a more educated decision.

luzpaz avatar Dec 05 '18 12:12 luzpaz

@pierrard I am only doing what I need / like to work at. There are others like @luzpaz who try to move FreeCAD in the right direction. Best to thank the whole community, which include a lot of smart people fighting for a great project ; ).

@luzpaz yes you are right. I always underestimate the impact of docs : ).

looooo avatar Dec 05 '18 22:12 looooo

@joelgraff perhaps you could weigh in on workbench creation as well at some point ? (i know your todo list is yuuuuge but nonetheless, please consider thanks!!!)

luzpaz avatar Sep 16 '19 13:09 luzpaz

@luzpaz - Thanks for mentioning this. Currently, I've forked the starter kit and am, a little bit at a time, trying to build out a general layout that is maintainable and scalable for small to mid-sized Python workbenches. Specifically, I feel a workbench's functions are best divided across individual "Tasks" and code needs to be organized to reflect that.

For example:

  • init_gui.py should never have anything more than the command class imports and toolbar / context menu / menu layout code.
  • A command class should only setup a task and clean up after it
  • A base task class should do two things: initialize the task panel ui, and kick off the task-specific subclasses, where all of the custom code really belongs.

Of course, there are exceptions (like a command that simply executes an external program, or just opens a file), but for more complex tasks, I really think that sort of structure should be encouraged / enforced where possible.

Without a clear structure in place to mange the various workbench command / task use cases, we cannot write clear, useful developer documentation. I realize it's no good trying to enforce absolute standards, but the goal is to provide a clean and well organized picture of how everything fits together rather than leave new devs to their own devices to hack together something that works, but may become unmaintainable as the workbench scope scales.

joelgraff avatar Sep 16 '19 14:09 joelgraff

@joelgraff
I resonate with everything you wrote and I'm very glad this discussion is progressing. Especially:

Without a clear structure in place to mange the various workbench command / task use cases, we cannot write clear, useful developer documentation. I realize it's no good trying to enforce absolute standards, but the goal is to provide a clean and well organized picture of how everything fits together rather than leave new devs to their own devices to hack together something that works, but may become unmaintainable as the workbench scope scales.

I think I'll pin this issue so it's of priority.

luzpaz avatar Sep 16 '19 16:09 luzpaz

yikes, got to get around to doing this.

luzpaz avatar Mar 10 '21 11:03 luzpaz

I had a framework of my own cobbled together, but I think I lost track of it, too. Joel Graff, P.E.

LinkedIn: https://www.linkedin.com/in/joelcgraff

On Wed, Mar 10, 2021 at 5:41 AM luzpaz [email protected] wrote:

yikes, got to get around to doing this.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/FreeCAD/FreeCAD-addons/issues/104#issuecomment-795295626, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2VMSXEFLKNSY7VVBJRUDLTC5EHJANCNFSM4FYCBWNA .

joelgraff avatar Mar 10 '21 12:03 joelgraff