video tutorial Create a Workbench

A place to share learning material: written tutorials, videos, etc.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
emills2
Posts: 868
Joined: Tue Apr 28, 2015 11:23 pm

Re: video tutorial Create a Workbench

Post by emills2 »

now i wonder if i'm doing mine right...it has a very simple structure, and it works (does what i expect). There is a single toolbar with all my commands in it, which is probably where many people will also start.

init.py is just an empty file
initGui.py imports all necessary scripts and puts them in a menu.

each command looks like this, and to make a new command, i copy it, change the name, icon, and edit the block under

Code: Select all

def Activated(self):
in this case,

Code: Select all

poly=Gui.Selection.getSelection()[0]
a=FreeCAD.ActiveDocument.addObject("Part::FeaturePython","CubicSurface_64")
AN.CubicSurface_64(a,poly)
is the object being added to the document, and

Code: Select all

a.ViewObject.Proxy=0 # just set it to something different from None (this assignment is needed to run an internal notification)
a.ViewObject.DisplayMode = u"Shaded"
a.ViewObject.ShapeColor = (0.33,0.67,1.00)
sets the view properties of the new object

getting the icon path to work was tricky. i got this method using the dummy file from Chris_G (if i remember correctly, lots of people helped at the time)

once it's all set up, the folder with all this stuff sits in my Mod folder...and that's it.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: video tutorial Create a Workbench

Post by Joel_graff »

Regarding the key topic of this thread... is a better tutorial video required for creating work benches? If so, what does it need to include?

Being fairly new to this myself, I've had to learn how to build my own python workbench using other pieces of example code and the wiki how-to on starting a workbench.

From my viewpoint, a good introductory python-specific workbench tutorial video should include:

1. FreeCAD's use of work benches
2. C++ vs Python
3. The basic layout of a workbench
4. Putting together a workbench
5. Putting it up on github
6. Setting up your IDE (like vscode)

Of course, a series of videos may be best, there. But we're talking about basics, of course...
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
Dorantor
Posts: 14
Joined: Wed Aug 15, 2018 1:44 pm

Re: video tutorial Create a Workbench

Post by Dorantor »

I am trying to develop a workbench but I still have very limited Python skills and (in my humble opinion) the Workbench_creation wiki looks a bit intimidating for someone like me (although I really appreciate the time and effort people have put in this wiki!!).

I think some kind of video tutorial could greatly help me. The Workbench tutorial Felipe made looks more clear but I'm not sure if this is the correct way to make one since Looo said this could be 'misleading' in a way?
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: video tutorial Create a Workbench

Post by Joel_graff »

Dorantor wrote: Wed Jul 31, 2019 11:05 pm I think some kind of video tutorial could greatly help me. The Workbench tutorial Felipe made looks more clear but I'm not sure if this is the correct way to make one since Looo said this could be 'misleading' in a way?
I agree a workbench tutorial would be beneficial. I've thought about creating one, at least for the Python side, but it's a bit time consuming to do that, especially since the workbench creation process has changed.

There's a new template for workbench creation - it's not required to be used, but it's designed to better suit the way Python's pip installer works and the github for it provides a little more formal guidance on layout than we've had in the past. I adapted my wb to the new layout and I rather like it.

Otherwise, I think the best thing you can probably do is post here with questions and thoughts. If there's a video to be made, it seems like a thread like this might provide some good source material.

There's no doubt I (and many others) will be willing to help you work through it.

https://github.com/FreeCAD/Workbench-Starterkit
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: video tutorial Create a Workbench

Post by Joel_graff »

While I'm thinking of it, pinging @looo on this since he's probably the resident expert on getting up and going with workbench development:
looo wrote: ping
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
Post Reply