Outils pour utilisateurs

Outils du site


wiki:tutoriels:freecad_python_script_building

Ceci est une ancienne révision du document !


FreeCAD has been built using the programming language Python. It should be understood that the use of modeling using the Python command line is not required. However, it can be beneficial in certain circumstances:

  • To design surfaces/curves using a specific mathematical formula
  • Importing design features from other python based programs/simulations
  • To create macros/scripts to design parametric libraries for various parts

In this tutorial we will focus on the last of the 3 circumstances. It is our goal to design a macro that allows us to create parametrically designed pullies. The basic pulley has been chosen for it's relative simplicity. Once the overall design/programming principles are understood I would like to create macros for:

  • Internal/External involute gears adapted to laser cutting (this is already included in the FreeCAD package
  • Roller Bearings for the 3Dprinting / laser cutting
  • Cam shafts
  • Screw drives

Setup FreeCAD for Python Script Building:

When we first open FreeCAD you will not have the “Vue Rapport” nor the “Python Console”. So the first step is to learn how to activate these two menus

Open the menu: Edition/Préférences/fenêtre de sortie

  • Select “Rediriger les messages interne Python vers la vue rapport”
  • Select “Rediriger les erreurs internes de Python vers la vue rapport”
  • Select “Appliquer” et “OK”

Next we will activate the menus for the Python Console and the Vue Rapport. To do so we must:

  • Goto the tab menu Affichage/Panneaux
  • Select “Vue Rapport”
  • Select “Vue Combinée”
  • Select “Console Python”
wiki/tutoriels/freecad_python_script_building.1481033653.txt.gz · Dernière modification: 2016/12/06 14:14 de royce