Power users hub: Difference between revisions

From FreeCAD Documentation
No edit summary
No edit summary
Line 17: Line 17:


== Scripting in FreeCAD ==
== Scripting in FreeCAD ==
* [[Scripting|Scripting homepage]]: Everything about python scripting in FreeCAD


'''General'''
'''General'''
* [[Introduction to python]]
* [[Introduction to python]] - See also other python tutorials at the bottom of this page
* [[FreeCAD Scripting Basics]]: Well, the basics...
* [[FreeCAD Scripting Basics]]: Well, the basics...
* [[Builtin modules]]: The base tools available to you
* [[Builtin modules]]: The base tools available to you
* [[Mesh Scripting]]: How to interact with the [[Mesh Module]]
* [[Gui Command]] : Adding custom commands to the GUI
* [[Gui Command]] : Adding custom commands to the GUI
* Using mixed [[Units]] in FreeCAD
* Using mixed [[Units]] in FreeCAD

'''Working with Meshes'''
* [[Mesh Scripting]]: How to interact with the [[Mesh Module]]


'''Using OpenCasCade'''
'''Using OpenCasCade'''
Line 41: Line 42:
* [[Embedding FreeCADGui|Using the FreeCAD GUI]] in another Qt application wity PyQt
* [[Embedding FreeCADGui|Using the FreeCAD GUI]] in another Qt application wity PyQt


'''Parametric objects'''
'''Working with parametric objects'''
* [[Scripted objects]]: How to make 100% python-scripted objects in FreeCAD
* [[Scripted objects]]: How to make 100% python-scripted objects in FreeCAD
* [[Drawing Module]]: Automating the 3D-to-2D process
* [[Drawing Module]]: Automating the 3D-to-2D process


'''Examples'''
'''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
* [[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
* [[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
* [[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 ==
== API Functions ==
Line 60: Line 64:
* [[CompileOnWindows|Compiling FreeCAD on Windows]] and [[CompileOnUnix|Compiling FreeCAD on Unix]]
* [[CompileOnWindows|Compiling FreeCAD on Windows]] and [[CompileOnUnix|Compiling FreeCAD on Unix]]
* [[Branding]]: Simple modifications you can do to the source code to change some aspects of FreeCAD
* [[Branding]]: Simple modifications you can do to the source code to change some aspects of FreeCAD
* [[Extra python modules]] : Extend the FreeCAD python interpreter with these powerful modules!

== Python tutorials ==

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

'''Python'''
* [http://docs.python.org/tut/tut.html Official python tutorial] - A very complete tutorial for discovering python
* [http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python Non-programmer tutorial for python] - an excellent wikibook
* [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
* [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/tutorials/pyqt4/firstprograms/ First programs in PyQt4] : A platform-agnostic tutorial showing the interns of python + qt
* [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.

'''Pivy''' - How to interact with FreeCAD's 3D scenes
* [http://pivy.coin3d.org/documentation/pycon Basic Pivy tutorial] : A very simple tutorial form the official Pivy site
* [http://www.google.com.br/url?sa=U&start=3&q=http://studierstube.icg.tu-graz.ac.at/doc/pdf/PivyStudierstubeTutorial.pdf&ei=XyC1Sc2wOeCKmQem_eHnBQ&usg=AFQjCNEYhb-0DcUc6OxFVijAe1epBb-4aA Introducing Pivy into studiersturbe] : A document that is not really a tutorialbut that illustrates well how Pivy works


== Community projects ==
== Community projects ==

Revision as of 15:22, 18 November 2010

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: There is a kind of special object you need but that's not present in the default FreeCAD installation? You can easily create a new object type, either from scratch eiter from 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

Working with Meshes

Using OpenCasCade

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

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

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.