Power users hub/en: Difference between revisions

From FreeCAD Documentation
(Importing a new version from external source)
(Importing a new version from external source)
Line 82: Line 82:
* [http://npt.cc.rsu.ru/user/wanderer/ODP/Python_for_Newbies.htm Python for newbies] - one big tutorial covering all the basics
* [http://npt.cc.rsu.ru/user/wanderer/ODP/Python_for_Newbies.htm Python for newbies] - one big tutorial covering all the basics


'''PyQt''' - How to create and manage FreeCAD's Qt UI interface from python
'''PySide''' - How to create and manage FreeCAD's Qt UI interface from python
* [http://www.cs.usfca.edu/~afedosov/qttut/ Basic PyQt tutorial] : A simple and short linux-based tutorial that will explain how to work with PyQt and Qt Designer
* [http://zetcode.com/gui/pysidetutorial/ PySide tutorial] : A platform-agnostic tutorial showing the usage of PySide with examples
* [http://zetcode.com/tutorials/pyqt4/firstprograms/ First programs in PyQt4] : A platform-agnostic tutorial showing the interns of python + qt
* [http://www.pythoncentral.io/series/python-pyside-pyqt-tutorial/ PySide/PyQt tutorial] : A easy to read tutorial that covers PySide and PyQt with examples
* [http://qt-project.org/wiki/PySideDocumentation PySide documentation] : from the Qt Project (the people who wrote it all)
* [http://vizzzion.org/?id=pyqt programming Qt applications in python] : A more in-depth tutorial covering all the process of working with qt and python.
* [http://qt-project.org/wiki/QtCreator_and_PySide Using QtCreator in PySide] : also from the Qt Project
* [http://srinikom.github.io/pyside-docs/index.html PySide reference] : endless detail on the minutiae of PySide and Qt, a reliable reference source
* [http://nullege.com/codes/search?cq=PySide PySide code snippets] : a searchable database of PySide code snippets


The following two references are PyQt specific (not PySide) but may offer some information of use:
The following two references are PyQt specific (not PySide) but may offer some information of use:

Revision as of 13:03, 10 February 2015

150
150

This is the place to come if you want to have a deeper insight into FreeCAD. Here you can learn about customizing FreeCAD for your needs.

These pages are in early stage of development. If you can't find the information you are looking for, or have found useful information somewhere we have not linked to, then please leave a comment on the talk page, or, why not? Add some more content here yourself!

One of the nicest features of FreeCAD is that you can script and extend it extremely far without the need to compile anything or touch the source code. All the scripting part is done in Python, a very powerful but simple programming language. With simple Python scripts, you have total access to about any part of FreeCAD. For example, you can:

  • Create and modify geometry: Is there a special object you need that's not present in the default FreeCAD installation? You can easily create a new object type, either from scratch or by adapting an existing type.
  • Create custom tools and commands: At the moment, FreeCAD already has extensive functionality, but there aren't many convenient tools and commands for the final user yet. But it is already easy to create your own sets of tools.
  • Modify the interface: The FreeCAD user interface is still very basic at this stage. But everything is there for you to extend it to your needs. You can, for example, create toolbars to put your own tools, create special panels for interacting with your tools, etc.
  • Modify the scene representation: FreeCAD has separate processes for building up and computing the geometry and displaying that geometry on your screen. You have full access to the way the scene contents are displayed on screen, therefore you can modify that representation, interact with it, or add all kinds of custom behaviours and screen widgets, like information, draggers, anchors or temporary entities.

Customizing FreeCAD

Scripting in FreeCAD

General

Modules

As the functionality of FreeCAD is separated in Modules which deal with special data types and applications. FreeCAD has built-in modules and Extension Modules (plug-ins). Once plugin modules are installed, they become availible to you as easily as the built-in modules. The modules described below are the default modules, includeed in every FreeCAD installation.

  • The Builtin modules are the principal FreeCAD modules. They contain tools for manipulating general FreeCAD configurations, documents and their contents.

Working with Meshes

Working with Parts

Accessing the Coin scenegraph

Controlling the Qt interface

Working with parametric objects

Examples

  • Code snippets : A collection of pieces of FreeCAD Python code, to serve as ingredients in your scripts...
  • Line drawing function: How to build a simple tool to draw lines
  • Dialog creation: How to construct dialogs with Qt designer, and use them in FreeCAD
  • Embedding FreeCAD: How to import FreeCAD as a Python module in other applications
  • The Draft Module adds basic 2d drawing functions to freecad. It is written entirely in Python, so it can be a good example if you want to write your own modules.
  • FreeCAD vector math library : A couple of handy functions to manipulate FreeCAD vectors. This library is also included in the Draft module.

API Functions

The complete API description can be found here. Note that it can be incomplete, since we still didn't find a way to include it automatically on this wiki. For more accurate information, browse the modules directly from FreeCAD.

Advanced modification

Python tutorials

These are good generic tutorials, not specific to FreeCAD, that might interest you if you are totally new to python.

Python

PySide - How to create and manage FreeCAD's Qt UI interface from python

The following two references are PyQt specific (not PySide) but may offer some information of use:

Pivy - How to interact with FreeCAD's 3D scenes

Community projects

On the Community portal, you can find other FreeCAD-based projects run by the FreeCAD users community. If you are starting a new FreeCAD project, be sure to list it there! We also have a page with things you can do if you would like to Help FreeCAD.