Tutorial |
Topic |
---|
Programming |
Level |
Medium programmer |
Time to complete |
15 minutes |
Authors |
Mario52 |
FreeCAD version |
All |
Example files |
None |
|
.py
extension, FreeCAD macros should have the .FCMacro
extension. A collection of macros written by experienced users is found in the macros recipes page.$ROOT_DIR
is a top level directory searched by FreeCAD on startup.$ROOT_DIR
could be a system wide directory, in which case the macro is installed for all users./usr/share/freecad/
C:Program FilesFreeCAD
/Applications/FreeCAD/
$ROOT_DIR
could be a particular user's directory./home/username/.FreeCAD/
C:UsersusernameApplication DataFreeCAD
/Users/username/Library/Preferences/FreeCAD/
User macros location
./home/username/.FreeCAD/
C:UsersusernameAppDataRoamingFreeCAD
/Users/username/Library/Preferences/FreeCAD/
.FreeCAD/
visible.file:///
prefix in the 'File explorer' for a file on disk.Save image as..
; place the icon in the macros directory. This icon can be used as a shortcut for the macro in a custom toolbar. The default icon is .Macro_Apothem_Based_Prism_GUI
, and press OK..zip
file, tarball .tar.xz
, or other type of archive if it contains several files. If the code is distributed in this way, the archive should be extracted and the files placed in the macros directory.class
) and function definitions (def()
), as well as control structures (if
, while
, for
) should be followed by a block of indented code.Report view
and the Python console
.FreeCAD.Console.PrintMessage()
now print information that appears in the Report view
.print()
function of Python redirects its output correctly to the report view.