FreeCAD Workbench Python Programming: Difference between revisions

From Open Source Ecology
Jump to navigation Jump to search
 
(54 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Introduction=
=Introduction=
This page is meant as a comprehensive collection of resources for how to create a FreeCAD workbench using Python programming.
This page is meant as a comprehensive collection of resources for how to create a FreeCAD workbench using Python programming.
= Target Audience =
This page is meant for people who are comfortable with Python Programming already.
Please refer to other resources for '''Programming''' or '''Python''', and do not include them here.


=Environment Setup=
=Environment Setup=
==VSCode==
==1. Install FreeCAD==
See [[FreeCAD]] for instructions.
==2. Setting up a Modern Code Editor - VS Code==
<html><iframe width="560" height="315" src="https://www.youtube.com/embed/1Pn2ok_22O8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></html>
<html><iframe width="560" height="315" src="https://www.youtube.com/embed/1Pn2ok_22O8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></html>


'''Related Blog Article:''' https://pythoncvc.net/?p=869
'''Related Blog Article:''' [https://pythoncvc.net/?p=869 FreeCAD External Editor With Code – OSS]


The above resources cover how to enable auto-completion and debugging features.
The above resources cover how to enable auto-completion and debugging features.
* [https://code.visualstudio.com/ Visual Studio Code]
* [https://marketplace.visualstudio.com/items?itemName=ms-python.python VS Code Python Extension]


* [https://forum.freecadweb.org/viewtopic.php?t=16267 FreeCAD Forum - Using Visual Studio as Python editor]
* [https://forum.freecadweb.org/viewtopic.php?t=16267 FreeCAD Forum - Using Visual Studio as Python editor]


* [https://wiki.freecadweb.org/Debugging#Visual_Studio_Code_.28VS_Code.29 FreeCAD Wiki - Debugging (VSCode)
* [https://wiki.freecadweb.org/Debugging#Visual_Studio_Code_.28VS_Code.29 FreeCAD Wiki - Debugging (VSCode)]
 
* [https://forum.freecadweb.org/viewtopic.php?f=8&t=40673 FreeCAD Forum - Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD]
 
* [https://forum.freecadweb.org/viewtopic.php?t=26474 FreeCAD Forum - VSCode / Pylint question]
 
* [https://forum.freecadweb.org/viewtopic.php?f=22&t=39032 FreeCAD Forum - FreeCAD python type definitions, code documentation]
 
* [https://forum.freecadweb.org/viewtopic.php?f=22&t=41174 FreeCAD Forum - How to set up a scripting environment in Visual Studio Code]
 
* [https://forum.freecadweb.org/viewtopic.php?f=10&t=39439&p=335054&hilit=vscode#p335054 FreeCAD Forum - vscode, pipenv, and and environment variables...]
 
* [https://forum.freecadweb.org/viewtopic.php?f=22&t=35332&p=298099&hilit=vscode#p298099 FreeCAD Forum - A few question about Wiki Script Object examples: "VSCode is good and has python support ... Maybe I should add a section like that to the documentation."]
 
* [https://forum.freecadweb.org/viewtopic.php?f=22&t=35532&hilit=vscode FreeCAD Forum - VSCode / Pylint on Windows]


===
* [https://forum.freecadweb.org/viewtopic.php?f=36&t=25276&p=217505&hilit=vscode#p217505 FreeCAD Forum - video tutorial Create a Workbench]


=Where to Learn=
=Where to Learn=
'''TODO:''' Begin grouping links into related sub-sections.
==Introduction to Scripting in FreeCAD==
 
===Articles===
* [https://wiki.freecadweb.org/index.php?title=Python_scripting_tutorial FreeCAD Wiki - Python scripting tutorial]
* [https://wiki.freecadweb.org/index.php?title=Python_scripting_tutorial FreeCAD Wiki - Python scripting tutorial]
* [https://wiki.freecadweb.org/index.php?title=FreeCAD_Scripting_Basics FreeCAD Wiki - FreeCAD Scripting Basics]
* [https://wiki.freecadweb.org/index.php?title=FreeCAD_Scripting_Basics FreeCAD Wiki - FreeCAD Scripting Basics]
* [https://wiki.freecadweb.org/Scripted_objects FreeCAD Wiki - Scripted objects]
 
* [https://wiki.freecadweb.org/Topological_data_scripting FreeCAD Wiki - Topological data scripting]
===Videos===
* [https://wiki.freecadweb.org/Placement FreeCAD Wiki - Placement]
<html>
<iframe width="560" height="315" src="https://www.youtube.com/embed/_vpDwS4cMB4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</html>
 
<html>
<iframe width="560" height="315" src="https://www.youtube.com/embed/A6DL3FL5YZo" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</html>
 
==Getting Started with Workbench Programming==
* [https://wiki.freecadweb.org/Workbench_creation FreeCAD Wiki - Workbench Creation]
* [https://wiki.freecadweb.org/Module_Creation#Setting_up_a_new_module_manually FreeCAD Wiki - Module Creation: Setting up a new module manually]
* [https://github.com/felipe-m/tutorial_freecad_wb GitHub - Tutorials on how to create your own Python workbench in FreeCAD]
* [https://github.com/skaiser/FreeCAD_Workbench_Starter GitHub - (skaiser) Example for getting a basic FreeCAD workbench started]
* [https://github.com/FreeCAD/freecad.workbench_starterkit GitHub - (official) FreeCAD Workbench-Starterkit (NOT COMPATIBLE WITH FREECAD 16)]
 
==FeaturePython, Scripted, or Custom Objects==
* [https://wiki.freecadweb.org/FeaturePython_Objects FreeCAD Wiki - FeaturePython objects]
* [https://wiki.freecadweb.org/FeaturePython_Objects FreeCAD Wiki - FeaturePython objects]
* [https://wiki.freecadweb.org/Creating_a_FeaturePython_Box,_Part_II FreeCAD Wiki - Creating a FeaturePython Box, Part II]
* [https://wiki.freecadweb.org/App_FeaturePython FreeCAD Wiki - App FeaturePython]
* [https://wiki.freecadweb.org/App_FeaturePython FreeCAD Wiki - App FeaturePython]
* [https://wiki.freecadweb.org/Creating_a_FeaturePython_Box,_Part_II FreeCAD Wiki - Creating a FeaturePython Box, Part II]
* [https://wiki.freecadweb.org/Scripted_objects FreeCAD Wiki - Scripted objects]`
* [https://wiki.freecadweb.org/Property FreeCAD Wiki - Property]
* [https://wiki.freecadweb.org/FeaturePython_Custom_Properties FreeCAD Wiki - FeaturePython Custom Properties]
* [https://wiki.freecadweb.org/Scripted%20objects%20saving%20attributes FreeCAD Wiki - Scripted objects saving attributes]
* [https://wiki.freecadweb.org/Viewprovider FreeCAD Wiki - Viewprovider]
 
==Reference==
* [https://wiki.freecadweb.org/Placement FreeCAD Wiki - Placement]
* [https://wiki.freecadweb.org/Command FreeCAD Wiki - Command]
* [https://wiki.freecadweb.org/App_GeoFeature FreeCAD Wiki - App GeoFeature]
* [https://wiki.freecadweb.org/App_DocumentObject FreeCAD Wiki - App DocumentObject]
* [https://wiki.freecadweb.org/Embedding_FreeCAD FreeCAD Wiki - Embedding FreeCAD]
* [https://wiki.freecadweb.org/Matrix_API FreeCAD Wiki - Matrix API]
* [https://wiki.freecadweb.org/Category:API FreeCAD Wiki - API Documentation]
 
===GUI===
* [https://wiki.freecadweb.org/PySide FreeCAD Wiki - PySide]
* [https://wiki.freecadweb.org/Dialog_creation FreeCAD Wiki - Dialog Creation]
* [https://wiki.freecadweb.org/Dialog_creation FreeCAD Wiki - Dialog Creation]
* [https://wiki.freecadweb.org/PySide FreeCAD Wiki - PySide]
 
===Advanced GUI===
* [https://wiki.freecadweb.org/Scenegraph FreeCAD Wiki - Scenegraph]
* [https://wiki.freecadweb.org/Pivy FreeCAD Wiki - Pivy]
 
===Part===
* [https://wiki.freecadweb.org/Part_API FreeCAD Wiki - Part API]
* [https://wiki.freecadweb.org/Part_scripting FreeCAD Wiki - Part scripting]
* [https://wiki.freecadweb.org/Part_Module FreeCAD Wiki - Part Module]
* [https://wiki.freecadweb.org/Topological_data_scripting FreeCAD Wiki - Topological data scripting]
* [https://wiki.freecadweb.org/Part_TopoShape FreeCAD Wiki - Part TopoShape]
* [https://wiki.freecadweb.org/TopoShape_API FreeCAD Wiki - TopoShape API]
* [https://wiki.freecadweb.org/Part_Feature FreeCAD Wiki - Part Feature]
* [https://wiki.freecadweb.org/Part_Primitives FreeCAD Wiki - Part Primitives]
* [https://wiki.freecadweb.org/Std_Part FreeCAD Wiki - Std Part]
* [https://wiki.freecadweb.org/Constructive_solid_geometry FreeCAD Wiki - Constructive solid geometry]
 
===Part Attachment===
* [https://wiki.freecadweb.org/Part_Attachment FreeCAD Wiki - Part Attachment]
* [https://forum.freecadweb.org/viewtopic.php?f=22&t=24794 FreeCAD Forum - Parametric attachment of scripted object]
* [https://forum.freecadweb.org/viewtopic.php?f=10&t=18978&start=10 FreeCAD Forum - Port attachment to be an extension]


=Where to Get Help=
=Where to Get Help=
* [https://forum.freecadweb.org/viewforum.php?f=22 FreeCAD Forums - Python scripting and macros]
* [https://forum.freecadweb.org/viewforum.php?f=22 FreeCAD Forums - Python scripting and macros]
* [[OSE Slack Channel]]
* [[OSE Slack Channel]]
=Links=
*[[FreeCAD Workbench Programming 101]]
*[[FreeCAD Programming]]
[[Category:FreeCAD]][[Category:Collaboration Architecture]]

Latest revision as of 21:03, 2 January 2021

Introduction

This page is meant as a comprehensive collection of resources for how to create a FreeCAD workbench using Python programming.

Target Audience

This page is meant for people who are comfortable with Python Programming already.

Please refer to other resources for Programming or Python, and do not include them here.

Environment Setup

1. Install FreeCAD

See FreeCAD for instructions.

2. Setting up a Modern Code Editor - VS Code

Related Blog Article: FreeCAD External Editor With Code – OSS

The above resources cover how to enable auto-completion and debugging features.

Where to Learn

Introduction to Scripting in FreeCAD

Articles

Videos

Getting Started with Workbench Programming

FeaturePython, Scripted, or Custom Objects

Reference

GUI

Advanced GUI

Part

Part Attachment

Where to Get Help

Links