Start up and Configuration: Difference between revisions

From FreeCAD Documentation
m (template fr)
No edit summary
 
(129 intermediate revisions by 16 users not shown)
Line 1: Line 1:
<languages/>
<translate>

<!--T:41-->
{{Docnav
|[[Import_Export_Preferences|Import Export Preferences]]
|[[Scripting_and_macros|Scripting and macros]]
}}

<!--T:88-->
{{VeryImportantMessage|In FreeCAD version 0.20 the default location of the program's configuration, data and cache files was changed for Linux.<br>
See [[Release_notes_0.20#Core|Release notes 0.20]] for more information. This page has not yet been updated accordingly.}}

</translate>
{{TOCright}}
<translate>

==Overview== <!--T:85-->

<!--T:1-->
This page shows the different ways to start FreeCAD and the most important configuration features.
This page shows the different ways to start FreeCAD and the most important configuration features.


== Starting FreeCAD from the Command line ==
== Starting FreeCAD from the Command line == <!--T:2-->


<!--T:3-->
FreeCAD can be started normally, by double-clicking on its desktop icon or selecting it from the start menu, but it can also be started directly from the command line. This allows you to change soem of the default startup options.
FreeCAD can be started normally by double-clicking on its desktop icon or selecting it from the start menu, but it can also be started directly from the command line. This allows you to change some of the default startup options.


=== Command line options ===
=== Using command line options without a command line shell === <!--T:86-->


<!--T:40-->
The command line options are subject of frequent changes, therefore it is a good idea to check the current options by typing:
* On Ubuntu you can create a desktop icon and edit its properties. Add the command line options separated by spaces behind the program name in the "Command" field.
FreeCAD --help
* On Windows create a shortcut and edit the properties. Add the command line options separated by spaces to "Target" field.


=== Command line options === <!--T:4-->
From the response you can read the possible parameters:


<!--T:5-->
Usage:
The command line options are subject to frequent changes.Therefore, it is a good idea to check the current options by typing:
FreeCAD [options] File1 File2 .....
Allowed options:
Generic options:
-v [ --version ] print version string
-h [ --help ] print help message
-c [ --console ] start in console mode
Configuration:
-l [ --write-log ] arg write a log file
-t [ --run-test ] arg test level
-M [ --module-path ] arg additional module paths
-P [ --python-path ] arg additional python paths
--response-file arg can be specified with '@name', too


</translate>
=== Response and config files ===
FreeCAD --help
<translate>


<!--T:6-->
FreeCAD can read some of these options from a config file. This file must be in the bin path and must be named FreeCAD.cfg. Be aware that options specified in the command line override the config file!
From the response you can read the possible parameters:


</translate>
Some operating system have very low limit of the command line length. The common way to work around those limitations is using response files. A response file is just a configuration file which uses the same syntax as the command line. If the command line specifies a name of response file to use, it's loaded and parsed in addition to the command line:
Usage: FreeCAD [options] File1 File2 ...
Allowed options:
Generic options:
-v [ --version ] Prints version string
-h [ --help ] Prints help message
-c [ --console ] Starts in console mode
--response-file arg Can be specified with '@name', too
--dump-config Dumps configuration
--get-config arg Prints the value of the requested configuration key
Configuration:
-l [ --write-log ] Writes a log file to:
/home/username/.FreeCAD/FreeCAD.log
--log-file arg Unlike --write-log this allows logging to an
arbitrary file
-u [ --user-cfg ] arg User config file to load/save user settings
-s [ --system-cfg ] arg System config file to load/save system settings
-t [ --run-test ] arg Test case - or 0 for all
-M [ --module-path ] arg Additional module paths
-P [ --python-path ] arg Additional python paths
--single-instance Allow to run a single instance of the application
<translate>


<!--T:53-->
FreeCAD @ResponseFile.txt
In the following table, selected options are described in more detail:


<!--T:54-->
or:
{| border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;"
|-
FreeCAD --response-file=ResponseFile.txt
! Long option !! Corresponding [[#Configuration_set|config var name]] !! Synopsis
|-
| {{incode|--user-cfg <filename>}} || UserParameter || Filename or relative path that ends with a filename. Defaults to {{incode|user.cfg}}.
|-
| {{incode|--module-path <dir>}} || Prepends to AdditionalModulePaths || Directory that contains modules. This option can be given repeatedly to specify multiple directories.
|-
| {{incode|--get-config <config-var-name>}} || most || Outputs the requested value in a popup dialog. Exits upon confirmation with {{KEY|OK}}. Cannot be used repeatedly. If an unknown/illegal variable name is used, the response is empty. The {{incode|--console}} flag is not honored.
|}
Options can written in two forms: {{incode|--long-option arg}} and {{incode|--long-option<nowiki>=</nowiki>arg}}.


=== Hidden options ===
=== Response and config files === <!--T:7-->


<!--T:8-->
There are a couple of options not visible to the user. These options are e.g. the X-Window parameters parsed by the Windows system:
FreeCAD can read some of these options from a config file. This file must be in the bin path and must be named {{FileName|FreeCAD.cfg}}. Be aware that options specified in the command line override the config file!
* -display display, sets the X display (default is $DISPLAY).
* -geometry geometry, sets the client geometry of the first window that is shown.
* -fn or -font font, defines the application font. The font should be specified using an X logical font description.
* -bg or -background color, sets the default background color and an application palette (light and dark shades are calculated).
* -fg or -foreground color, sets the default foreground color.
* -btn or -button color, sets the default button color.
* -name name, sets the application name.
* -title title, sets the application title.
* -visual TrueColor, forces the application to use a TrueColor visual on an 8-bit display.
* -ncols count, limits the number of colors allocated in the color cube on an 8-bit display, if the application is using the QApplication::ManyColor color specification. If count is 216 then a 6x6x6 color cube is used (i.e. 6 levels of red, 6 of green, and 6 of blue); for other values, a cube approximately proportional to a 2x3x1 cube is used.
* -cmap, causes the application to install a private color map on an 8-bit display.


<!--T:9-->
Some operating systems have a very low limit of characters on the command line. The common way to work around those limitations is using response files. A response file is just a configuration file which uses the same syntax as the command line. If the command line specifies a response file, it's loaded and parsed in addition to the command line:


</translate>
== Running FreeCAD without User Interface ==
<pre>
FreeCAD @ResponseFile.txt
</pre>
<translate>


<!--T:10-->
FreeCAD normally starts in GUI mode, but you can also force it to start in console mode by typing:
or:


</translate>
FreeCAD -c
<pre>
FreeCAD --response-file=ResponseFile.txt
</pre>
<translate>


<!--T:55-->
from the command line. In console mode, no user interface will be displayed, and you will be presented with a python interpreter prompt. From that python prompt, you have the same functionality as the python interpreter that runs inside the FreeCAD GUI, and normal access to all modules and plugins of FreeCAD, excepted the FreeCADGui module. Be aware that modules that depend on FreeCADGui might also be unavailable.
or:


</translate>
<pre>
FreeCAD --response-file ResponseFile.txt
</pre>
<translate>


=== Hidden options === <!--T:11-->
== Running FreeCAD as a python module ==


<!--T:12-->
FreeCAD can also be used to run as a python module inside other applications that use python or from an external python shell. For that, the host python application must know where your FreeCAD libs reside. The best way to obtain that is to temporarily append FreeCAD's lib path to the sys.path variable. The following code typed from any python shell will import FreeCAD and let you run it the same way as in console mode:
There are a couple of options not visible to the user. These options are e.g. the X-Window parameters parsed by the Windows system:
* ''-display'' - Sets the X display (default is $DISPLAY).
* ''-geometry'' - Sets the client geometry of the first window that is shown.
* ''-fn'' or ''-font'' - Defines the application font. The font should be specified using an X logical font description.
* ''-bg'' or ''-background'' - Sets the default background color and an application palette (light and dark shades are calculated).
* ''-fg'' or ''-foreground'' - Sets the default foreground color.
* ''-btn'' or ''-button'' - Sets the default button color.
* ''-name'' - Sets the application name.
* ''-title'' - Sets the application title.
* ''-visual'' - Forces the application to use a TrueColor visual on an 8-bit display.
* ''-ncols'' - Limits the number of colors allocated in the color cube on an 8-bit display, if the application is using the QApplication::ManyColor color specification. If count is 216 then a 6x6x6 color cube is used (i.e. 6 levels of red, 6 of green, and 6 of blue); for other values, a cube approximately proportional to a 2x3x1 cube is used.
* ''-cmap'' - Causes the application to install a private color map on an 8-bit display.


=== Running FreeCAD without GUI (headless) === <!--T:13-->
<code python>
import sys
sys.path.append("path/to/FreeCAD/lib") # change this by your own FreeCAD lib path
import FreeCAD
</code>


<!--T:14-->
Once FreeCAD is loaded, it is up to you to make it interact with your host application in any way you can imagine!
FreeCAD is usually built with two executables: a GUI-capable one called {{FileName|FreeCAD}} or {{FileName|freecad}}, and a headless one, called {{FileName|FreeCADCmd}} or {{FileName|freecadcmd}}.
FreeCAD can be used in console mode using the {{incode|--console}} switch (which is the default behavior of {{FileName|FreeCADCmd}}):


</translate>
== The Config set ==
FreeCAD --console
<translate>


<!--T:15-->
On every Startup FreeCAD examines its surrounding and the command line parameters. It builds up a '''configuration set''' which holds the essence of the runtime information. This information is later used to determine the place where to save user data or log files. It is also very important for post postmortem analyzes. Therefore it is saved in the log file.
In console mode, no graphical user interface will be displayed, and you will be presented with a Python interpreter prompt: {{incode|>>>}}. From that prompt, you have the same functionality as the Python interpreter that runs inside the FreeCAD GUI, and access to all modules and plugins of FreeCAD, except the FreeCADGui module. Be aware that modules that depend on FreeCADGui might also be unavailable.


<!--T:56-->
=== User related information===
To read more about console or headless mode, refer to [[Headless_FreeCAD|Headless FreeCAD]].


=== Running modules, macros and scripts === <!--T:49-->

<!--T:50-->
{| border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;"
{| border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;"
! File type !! System !! Command line example
|+ User config entries
|-
|-
| Module ||Windows || {{incode|"C:\Program Files\FreeCAD\bin\FreeCAD.exe" -M "C:\FreeCAD\Mod\Draft"}}
! Config var name !! Synopsis !! Example M$ !! Example Posix (Linux)
|-
|-
| ||Linux || {{incode|FreeCAD_0.19 -M ~/.FreeCAD/Mod/Draft}}
| UserAppData || Path where FreeCAD stores User Related application data. || C:\Documents and Settings\username\Application Data\FreeCAD ||/home/username/.FreeCAD
|-
|-
| ||Linux (AppImage) || {{incode|path/to/FreeCADXXX.AppImage -M ~/.FreeCAD/Mod/Draft}}
| UserParameter || File where FreeCAD stores User Related application data. || C:\Documents and Settings\username\Application Data\FreeCAD\user.cfg ||/home/username/.FreeCAD/user.cfg
|-
|-
|-
| SystemParameter || File where FreeCAD stores Application Related data. || C:\Documents and Settings\username\Application Data\FreeCAD\system.cfg ||/home/username/.FreeCAD/system.cfg
| .FCMacro or .py ||Windows || {{incode|"C:\Program Files\FreeCAD\bin\FreeCAD.exe" "C:\Users\userName\AppData\Roaming\FreeCAD\Mod\WorkFeature\start_WF.FCMacro"}}
|-
|-
| UserHomePath || Home path of the current user || C:\Documents and Settings\username\My Documents ||/home/username
| ||Linux || {{incode|FreeCAD_0.19 ~/.FreeCAD/Mod/WorkFeature/start_WF.FCMacro}}
|-
| ||Linux (AppImage) || {{incode|path/to/FreeCADXXX.AppImage ~/.FreeCAD/Mod/WorkFeature/start_WF.FCMacro}}
|}
|}


<!--T:57-->
=== Command line arguments ===
See [[Macro_at_Startup|Macro at Startup]] on how to set up a macro to automatically run at FreeCAD startup.


== Environment variables == <!--T:58-->

<!--T:59-->
FreeCAD supports the following environment variables, which can be used to configure directories: {{Version|0.19}}
{| border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;"
{| border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;"
|+ User config entries
|-
|-
! Environment variable !! Corresponding [[#Configuration_set|config var name]] !! Synopsis
! Config var name !! Synopsis !! Example
|-
|-
| {{incode|FREECAD_USER_HOME}} || UserHomePath || FreeCAD's "base" directory for keeping local user data.
| LoggingFile || 1 if the logging is switched on || 1
|-
|-
| {{incode|FREECAD_USER_DATA}} || UserAppData || If not set, defaults to {{incode|FREECAD_USER_HOME/.FreeCAD}}, but only if {{incode|FREECAD_USER_HOME}} is set.
| LoggingFileName || File name where the log is placed || C:\Documents and Settings\username\Application Data\FreeCAD\FreeCAD.log
|-
|-
| {{incode|FREECAD_USER_TEMP}} || AppTempPath || If not set, defaults to {{incode|FREECAD_USER_HOME/temp}}, but only if {{incode|FREECAD_USER_HOME}} is set.
| RunMode || This indicates how the main loop will work. '''"Script"''' means that the given script is called and then exit. '''"Cmd"''' runs the command line interpreter. '''"Internal"''' runs an internal script. '''"Gui"''' enters the Gui event loop. '''"Module"''' loads a given python module. || "Cmd"
|-
| FileName || Meaning depends on the RunMode ||
|-
| ScriptFileName || Meaning depends on the RunMode ||
|-
| Verbose || Verbosity level of FreeCAD || "" or "strict"
|-
| OpenFileCount ||Holds the number of files opened through command line arguments || "12"
|-
| AdditionalModulePaths||Holds the additional Module paths given in the cmd line || "extraModules/"
|}
|}
If the specified path does not exist, the setting is ignored!


<!--T:60-->
=== System related ===
The above environment variables are meant to be used to realize a ''portable'' FreeCAD environment. For an example how environment variables can be used from the command line on Linux refer to the [[Download#Notes_for_GNU.2FLinux_users|notes for Linux users on the downloads page]].


=== {{incode|HOME}} === <!--T:61-->
{| border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;"
|+ User config entries
|-
! Config var name !! Synopsis !! Example M$ !! Example Posix (Linux)
|-
| AppHomePath || Path where FreeCAD is installed || c:/Progam Files/FreeCAD_0.7|| /user/local/FreeCAD_0.7
|-
| PythonSearchPath || Holds a list of paths which python search modules. This is at startup can change during execution || ||
|}


<!--T:62-->
Some libraries need to call system environment variables. Sometimes when there is a problem with a FreeCAD installation, it is because some environment variable is absent or set wrongly. Therefore, some important variables get duplicated in the Config and saved in the log file.
FreeCAD uses [[Third_Party_Libraries#Qt|Qt]], which does honor the {{incode|HOME}} environmental variable. Thus, setting {{incode|HOME}} can be used to specify the base directory of Qt-related configuration files ({{incode|.config/FreeCAD/FreeCAD.conf}}).


<!--T:63-->
'''Python related environment variables:'''
FreeCad itself does not honor the {{incode|HOME}} environmental variable (because it determines the user's home directory from a lower-level system API). Use {{incode|FREECAD_USER_HOME}} for this pupose.

=== {{incode|TMPDIR}} === <!--T:64-->

<!--T:65-->
The default temporary directory is {{FileName|/tmp/}}. The {{incode|TMPDIR}} environmental variable can be used to override the default. (''Editor: precedence?'').

=== Libraries === <!--T:87-->

<!--T:27-->
Some libraries need to call system environment variables. Sometimes when there is a problem with a FreeCAD installation, it is because some environment variable is absent or incorrect. Therefore, some important variables get duplicated in the Config and saved in the log file.

<!--T:28-->
'''Python'''

</translate>
* PYTHONPATH
* PYTHONPATH
* PYTHONHOME
* PYTHONHOME
* TCL_LIBRARY
* TCL_LIBRARY
* TCLLIBPATH
* TCLLIBPATH
<translate>

<!--T:29-->
'''OpenCascade'''


</translate>
'''OpenCascade related environment variables:'''
* CSF_MDTVFontDirectory
* CSF_MDTVFontDirectory
* CSF_MDTVTexturesDirectory
* CSF_MDTVTexturesDirectory
Line 154: Line 236:
* CSF_IGESDefaults
* CSF_IGESDefaults
* CSF_STEPDefaults
* CSF_STEPDefaults
<translate>


== Configuration set == <!--T:19-->
'''System related environment variables:'''
* PATH


<!--T:20-->
=== Build related information===
On every startup FreeCAD examines its surrounding and the command line parameters. It builds up a '''configuration set''' which holds the essence of the runtime information. This information is later used to determine the place where to save user data or log files. It is also very important for postmortem analyzes. Therefore it is saved in the log file.


=== User related information=== <!--T:21-->
The table below shows the availible informations about the Build version. Most of it comes from the Subversion repository. This stuff is needed to exactly rebuild a version!


<!--T:22-->
{| border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;"
|-
! Config var name !! Synopsis !! Example Windows !! Example Linux
|-
| UserAppData || Path where FreeCAD stores User Related application data. || {{FileName|C:\Documents and Settings\username\AppData\FreeCAD}}<hr />''Short path : ''{{FileName|%APPDATA%\FreeCAD}} || {{FileName|/home/username/.FreeCAD}}<hr />''Short path : ''{{FileName|~/.FreeCAD}}
|-
| UserParameter || File where FreeCAD stores User Related application data. || {{FileName|C:\Documents and Settings\username\AppData\FreeCAD\user.cfg}}<hr />''Short path : ''{{FileName|%APPDATA%\FreeCAD\user.cfg}} || {{FileName|/home/username/.config/FreeCAD/user.cfg}}<hr />''Short path : ''{{FileName|~/.config/FreeCAD/user.cfg}} or {{FileName|$HOME/.config/FreeCAD/user.cfg}}
|-
| SystemParameter || File where FreeCAD stores Application Related data. || {{FileName|C:\Documents and Settings\username\AppData\FreeCAD\system.cfg}}<hr />''Short path : ''{{FileName|%APPDATA%\FreeCAD\system.cfg}} || {{FileName|/home/username/.config/FreeCAD/system.cfg}}<hr />''Short path : ''{{FileName|~/.FreeCAD/system.cfg}} or {{FileName|$HOME/.FreeCAD/system.cfg}}
|-
| UserHomePath || Home path of the current user || {{FileName|C:\Documents and Settings\username}}<hr />''Short path : ''{{FileName|%USERPROFILE%}} || {{FileName|/home/username}}<hr />''Short path : ''{{FileName|~}}
|}

<!--T:66-->
Note: For Linux distributions, an additional configuration file that relates to [[Third_Party_Tools#Qt-Toolkit|Qt]] may exist at path {{FileName|/home/username/.config/FreeCAD/FreeCAD.conf}}.

=== Command line arguments === <!--T:23-->

<!--T:24-->
{| border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;"
|-
! Config var name !! Synopsis !! Example
|-
| LoggingFile || 1 if the logging is switched on || 1
|-
| LoggingFileName || File name where the log is placed || {{FileName|C:\Documents and Settings\username\AppData\FreeCAD\FreeCAD.log}}
|-
| RunMode || This indicates how the main loop will work. '''"Script"''' means that the given script is called and then exit. '''"Cmd"''' runs the command line interpreter. '''"Internal"''' runs an internal script. '''"Gui"''' enters the Gui event loop. '''"Module"''' loads a given python module. || "Cmd"
|-
| FileName || Meaning depends on the RunMode ||
|-
| ScriptFileName || Meaning depends on the RunMode ||
|-
| Verbose || Verbosity level of FreeCAD || "" or "strict"
|-
| OpenFileCount ||Holds the number of files opened through command line arguments || "12"
|-
| AdditionalModulePaths||Holds the additional Module paths given in the cmd line || "extraModules/"
|}

=== System related === <!--T:25-->

<!--T:26-->
{| border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;"
|-
! Config var name !! Synopsis !! Example Windows !! Example Linux
|-
| AppHomePath || Path where FreeCAD is installed || {{FileName|c:/Progam Files/FreeCAD_0.19}} || {{FileName|/user/local/FreeCAD_0.19}}
|-
| PythonSearchPath || Holds a list of paths which python search modules. This is at startup can change during execution || ||
|-
| AppTempPath || Path of the temporary directory. Can be given with {{incode|TMPDIR}} environment variable, or with the [[Image:Std_DlgParameter.svg|16px]] [[Std_DlgParameter|Parameter Editor]]: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → General → TempPath}} || || {{FileName|/tmp/}} (default)
|}

=== Build related information=== <!--T:31-->

<!--T:32-->
The table below shows the available information about the Build version. Most of it comes from the Subversion repository. This stuff is needed to exactly rebuild a version!

<!--T:33-->
{| border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;"
{| border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;"
|+ User config entries
|-
|-
! Config var name !! Synopsis !! Example
! Config var name !! Synopsis !! Example
|-
|-
| BuildVersionMajor || Major Version number of the Build. Defined in src/Build/Version.h.in || 0
| BuildVersionMajor || Major Version number of the Build. Defined in {{FileName|src/Build/Version.h.in}} || 0
|-
|-
| BuildVersionMinor || Minor Version number of the Build. Defined in src/Build/Version.h.in || 7
| BuildVersionMinor || Minor Version number of the Build. Defined in {{FileName|src/Build/Version.h.in}} || 7
|-
|-
| BuildRevision || SVN Repository Revision number of the src in the Build. Generated by SVN || 356
| BuildRevision || SVN Repository Revision number of the src in the Build. Generated by SVN || 356
|-
|-
| BuildRevisionRange || Range of differnt changes || 123-356
| BuildRevisionRange || Range of different changes || 123-356
|-
|-
| BuildRepositoryURL || Repository URL || https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk/src
| BuildRepositoryURL || Repository URL || https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk/src
Line 179: Line 322:
| BuildRevisionDate || Date of the above Revision || 2007/02/03 22:21:18
| BuildRevisionDate || Date of the above Revision || 2007/02/03 22:21:18
|-
|-
| BuildScrClean || Indicates if the source was changed ager checkout ||Src modified
| BuildScrClean || Indicates if the source was changed after checkout ||Src modified
|-
|-
| BuildScrMixed || || Src not mixed
| BuildScrMixed || || Src not mixed
|}
|}
=== Branding related ===


=== Branding related === <!--T:34-->
These Config entries are related to the branding mechanism of FreeCAD. See [[Branding]] for more details.


<!--T:35-->
These Config entries are related to the branding mechanism of FreeCAD. See [[Branding|Branding]] for more details.

<!--T:36-->
{| border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;"
{| border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;"
|+ User config entries
|-
|-
! Config var name !! Synopsis !! Example
! Config var name !! Synopsis !! Example
|-
|-
| ExeName || Name of the build Executable file. Can diver from FreeCAD if a different main.cpp is used. || FreeCAD.exe
| ExeName || Name of the build Executable file. Can differ from FreeCAD if a different {{FileName|main.cpp}} is used. || {{FileName|FreeCAD.exe}}
|-
|-
| ExeVersion || Over all Version shows up at start time || V0.7
| ExeVersion || Over all Version shows up at start time || "0.19"
|-
|-
| AppIcon || Icon which is used for the Executable, shows in Application MainWindow. || "FCIcon"
| AppIcon || Icon which is used for the Executable, shows in Application MainWindow. || "FCIcon"
Line 203: Line 347:
| SplashPicture || Name of the Icon used for the Splash Screen || "FreeCADSplasher"
| SplashPicture || Name of the Icon used for the Splash Screen || "FreeCADSplasher"
|-
|-
| SplashAlignment || Alignment of the Text in the Splash dialog || "Bottom|Left"
| SplashAlignment || Alignment of the Text in the Splash dialog || "Bottom" or "Left"
|-
|-
| SplashTextColor || Color of the splasher Text || "#000000"
| SplashTextColor || Color of the splasher Text || "#000000"
|-
|-
| StartWorkbench || Name of the Workbech which get started automaticly after Startup || "Part design"
| StartWorkbench || Name of the Workbench which get started automatically after Startup || "Part Design"
|-
|-
| HiddenDockWindow || List of dockwindows (separated by a semicolon) which will be disabled || "Property editor"
| HiddenDockWindow || List of dockwindows (separated by a semicolon) which will be disabled || "Property editor"
|}
|}


=== Querying the configuration === <!--T:67-->
{{docnav|Third Party Tools|FreeCAD Build Tool}}

<!--T:68-->
'''From FreeCAD's Python console'''

<!--T:69-->
Entries of the configuration set can be queried with the '''config var name''' (see tables above) from the [[Python_console|Python console]]. For example:
>>> FreeCAD.ConfigGet("ExeVersion")
'0.19'
If the name is not found, an empty string is returned.

<!--T:70-->
'''From command line'''

<!--T:71-->
Use the {{incode|--get-config <config-var-name>}} option to query a single name. Not all names are supported. For example:
FreeCAD --get-config ExeVersion

<!--T:72-->
Use the {{incode|--dump-config}} option to get a list of names and their values. Not all names are supported.

<!--T:73-->
'''From FreeCAD console'''

<!--T:74-->
Start FreeCAD in console mode with {{incode|--console}} and query with Python code. For example:
$ FreeCAD --console
[FreeCAD Console mode <Use Ctrl-D (i.e. EOF) to exit.>]
>>> FreeCAD.ConfigGet("ExeVersion")
'0.19'
>>> exit()

<!--T:75-->
For Linux (bash shell) you can modify the following command line to suit your needs:
$ FreeCAD --console <<EOF
print( "FREECAD_USER_HOME: " + ( "not set" if ( os.environ.get('FREECAD_USER_HOME') is None ) else os.environ.get('FREECAD_USER_HOME') ) )
print( "UserHomePath: " + FreeCAD.ConfigGet("UserHomePath") )
exit()
EOF

== Starting FreeCAD from the desktop == <!--T:76-->

=== Linux: Creating an additional start option === <!--T:77-->

<!--T:78-->
The following assumes that your desktop is configured such that you can launch FreeCAD from it. Depending on your Linux distribution and desktop environment, you may have to adapt the following steps:
# Copy the freedesktop entry file for FreeCAD from {{FileName|/usr/share/applications/freecad.desktop}} to {{FileName|~/.local/share/applications}}.
# Change the name from {{FileName|freecad.desktop}} to something else (e.g. {{FileName|MyFreeCADConfig.desktop}}).
# Open the file with a text editor and change how FreeCAD is invoked by modifying the line starting with {{incode|Exec}}.
# As a result, an additional entry in your start menu/application launcher is available. This way, you can have multiple FreeCAD entries with various launch options.

== Starting FreeCAD from a portable USB medium == <!--T:79-->

<!--T:81-->
'''Windows'''

<!--T:82-->
Put the FreeCAD executable, {{FileName|FreeCAD.exe}}, on the USB medium. Create a batch file, {{FileName|FreeCAD.bat}}, and put it into the same directory as {{FileName|FreeCAD.exe}}. Inside the batch file write:
</translate>

{{Code|code=
set CURRENTDIR=%cd%
set FREECAD_USER_HOME=%CURRENTDIR%
start FreeCAD.exe -u FreeCAD/user.cfg -s FreeCAD/system.cfg --write-log
}}

Or with {{incode|FREECAD_USER_DATA}} ([https://forum.freecadweb.org/viewtopic.php?f=12&t=54784&start=60#p474759 see]):

{{Code|code=
set CURRENTDIR="%cd%"
set FREECAD_USER_DATA=%CURRENTDIR%/..
start FreeCAD.exe -u %FREECAD_USER_DATA%/user.cfg -s %FREECAD_USER_DATA%/system.cfg}}
<translate>

<!--T:84-->
With the batch in the root of the USB medium:

</translate>
{{Code|code=
set CURRENTDIR=%cd%
set FREECAD_USER_DATA=%CURRENTDIR%FreeCAD\
start %cd%FreeCAD\bin\FreeCAD.exe -u %FREECAD_USER_DATA%user.cfg -s %FREECAD_USER_DATA%system.cfg
}}
<translate>

<!--T:83-->
Now double-click the batch file to start FreeCAD. ([https://forum.freecadweb.org/viewtopic.php?f=4&t=49028 see])



<!--T:37-->
{{languages | {{es|Start up and Configuration/es}} {{fr|Start up and Configuration/fr}} {{it|Start up and Configuration/it}} {{ru|Start up and Configuration/ru}} {{se|Start up and Configuration/se}} }}
{{Docnav
|[[Import_Export_Preferences|Import Export Preferences]]
|[[Scripting_and_macros|Scripting and macros]]
}}


</translate>
[[Category:Developer Documentation]]
{{Userdocnavi{{#translation:}}}}
[[Category:Developer Documentation{{#translation:}}]]

Latest revision as of 11:08, 28 January 2024

In FreeCAD version 0.20 the default location of the program's configuration, data and cache files was changed for Linux.
See Release notes 0.20 for more information. This page has not yet been updated accordingly.

Overview

This page shows the different ways to start FreeCAD and the most important configuration features.

Starting FreeCAD from the Command line

FreeCAD can be started normally by double-clicking on its desktop icon or selecting it from the start menu, but it can also be started directly from the command line. This allows you to change some of the default startup options.

Using command line options without a command line shell

  • On Ubuntu you can create a desktop icon and edit its properties. Add the command line options separated by spaces behind the program name in the "Command" field.
  • On Windows create a shortcut and edit the properties. Add the command line options separated by spaces to "Target" field.

Command line options

The command line options are subject to frequent changes.Therefore, it is a good idea to check the current options by typing:

FreeCAD --help

From the response you can read the possible parameters:

 Usage: FreeCAD [options] File1 File2 ...
 
 Allowed options:
 
 Generic options:
   -v [ --version ]          Prints version string
   -h [ --help ]             Prints help message
   -c [ --console ]          Starts in console mode
   --response-file arg       Can be specified with '@name', too
   --dump-config             Dumps configuration
   --get-config arg          Prints the value of the requested configuration key
 
 Configuration:
   -l [ --write-log ]        Writes a log file to:
                             /home/username/.FreeCAD/FreeCAD.log
   --log-file arg            Unlike --write-log this allows logging to an 
                             arbitrary file
   -u [ --user-cfg ] arg     User config file to load/save user settings
   -s [ --system-cfg ] arg   System config file to load/save system settings
   -t [ --run-test ] arg     Test case - or 0 for all
   -M [ --module-path ] arg  Additional module paths
   -P [ --python-path ] arg  Additional python paths
   --single-instance         Allow to run a single instance of the application

In the following table, selected options are described in more detail:

Long option Corresponding config var name Synopsis
--user-cfg <filename> UserParameter Filename or relative path that ends with a filename. Defaults to user.cfg.
--module-path <dir> Prepends to AdditionalModulePaths Directory that contains modules. This option can be given repeatedly to specify multiple directories.
--get-config <config-var-name> most Outputs the requested value in a popup dialog. Exits upon confirmation with OK. Cannot be used repeatedly. If an unknown/illegal variable name is used, the response is empty. The --console flag is not honored.

Options can written in two forms: --long-option arg and --long-option=arg.

Response and config files

FreeCAD can read some of these options from a config file. This file must be in the bin path and must be named FreeCAD.cfg. Be aware that options specified in the command line override the config file!

Some operating systems have a very low limit of characters on the command line. The common way to work around those limitations is using response files. A response file is just a configuration file which uses the same syntax as the command line. If the command line specifies a response file, it's loaded and parsed in addition to the command line:

FreeCAD @ResponseFile.txt 

or:

FreeCAD --response-file=ResponseFile.txt

or:

FreeCAD --response-file ResponseFile.txt

Hidden options

There are a couple of options not visible to the user. These options are e.g. the X-Window parameters parsed by the Windows system:

  • -display - Sets the X display (default is $DISPLAY).
  • -geometry - Sets the client geometry of the first window that is shown.
  • -fn or -font - Defines the application font. The font should be specified using an X logical font description.
  • -bg or -background - Sets the default background color and an application palette (light and dark shades are calculated).
  • -fg or -foreground - Sets the default foreground color.
  • -btn or -button - Sets the default button color.
  • -name - Sets the application name.
  • -title - Sets the application title.
  • -visual - Forces the application to use a TrueColor visual on an 8-bit display.
  • -ncols - Limits the number of colors allocated in the color cube on an 8-bit display, if the application is using the QApplication::ManyColor color specification. If count is 216 then a 6x6x6 color cube is used (i.e. 6 levels of red, 6 of green, and 6 of blue); for other values, a cube approximately proportional to a 2x3x1 cube is used.
  • -cmap - Causes the application to install a private color map on an 8-bit display.

Running FreeCAD without GUI (headless)

FreeCAD is usually built with two executables: a GUI-capable one called FreeCAD or freecad, and a headless one, called FreeCADCmd or freecadcmd. FreeCAD can be used in console mode using the --console switch (which is the default behavior of FreeCADCmd):

FreeCAD --console

In console mode, no graphical user interface will be displayed, and you will be presented with a Python interpreter prompt: >>>. From that prompt, you have the same functionality as the Python interpreter that runs inside the FreeCAD GUI, and access to all modules and plugins of FreeCAD, except the FreeCADGui module. Be aware that modules that depend on FreeCADGui might also be unavailable.

To read more about console or headless mode, refer to Headless FreeCAD.

Running modules, macros and scripts

File type System Command line example
Module Windows "C:\Program Files\FreeCAD\bin\FreeCAD.exe" -M "C:\FreeCAD\Mod\Draft"
Linux FreeCAD_0.19 -M ~/.FreeCAD/Mod/Draft
Linux (AppImage) path/to/FreeCADXXX.AppImage -M ~/.FreeCAD/Mod/Draft
.FCMacro or .py Windows "C:\Program Files\FreeCAD\bin\FreeCAD.exe" "C:\Users\userName\AppData\Roaming\FreeCAD\Mod\WorkFeature\start_WF.FCMacro"
Linux FreeCAD_0.19 ~/.FreeCAD/Mod/WorkFeature/start_WF.FCMacro
Linux (AppImage) path/to/FreeCADXXX.AppImage ~/.FreeCAD/Mod/WorkFeature/start_WF.FCMacro

See Macro at Startup on how to set up a macro to automatically run at FreeCAD startup.

Environment variables

FreeCAD supports the following environment variables, which can be used to configure directories: introduced in version 0.19

Environment variable Corresponding config var name Synopsis
FREECAD_USER_HOME UserHomePath FreeCAD's "base" directory for keeping local user data.
FREECAD_USER_DATA UserAppData If not set, defaults to FREECAD_USER_HOME/.FreeCAD, but only if FREECAD_USER_HOME is set.
FREECAD_USER_TEMP AppTempPath If not set, defaults to FREECAD_USER_HOME/temp, but only if FREECAD_USER_HOME is set.

If the specified path does not exist, the setting is ignored!

The above environment variables are meant to be used to realize a portable FreeCAD environment. For an example how environment variables can be used from the command line on Linux refer to the notes for Linux users on the downloads page.

HOME

FreeCAD uses Qt, which does honor the HOME environmental variable. Thus, setting HOME can be used to specify the base directory of Qt-related configuration files (.config/FreeCAD/FreeCAD.conf).

FreeCad itself does not honor the HOME environmental variable (because it determines the user's home directory from a lower-level system API). Use FREECAD_USER_HOME for this pupose.

TMPDIR

The default temporary directory is /tmp/. The TMPDIR environmental variable can be used to override the default. (Editor: precedence?).

Libraries

Some libraries need to call system environment variables. Sometimes when there is a problem with a FreeCAD installation, it is because some environment variable is absent or incorrect. Therefore, some important variables get duplicated in the Config and saved in the log file.

Python

  • PYTHONPATH
  • PYTHONHOME
  • TCL_LIBRARY
  • TCLLIBPATH

OpenCascade

  • CSF_MDTVFontDirectory
  • CSF_MDTVTexturesDirectory
  • CSF_UnitsDefinition
  • CSF_UnitsLexicon
  • CSF_StandardDefaults
  • CSF_PluginDefaults
  • CSF_LANGUAGE
  • CSF_SHMessage
  • CSF_XCAFDefaults
  • CSF_GraphicShr
  • CSF_IGESDefaults
  • CSF_STEPDefaults

Configuration set

On every startup FreeCAD examines its surrounding and the command line parameters. It builds up a configuration set which holds the essence of the runtime information. This information is later used to determine the place where to save user data or log files. It is also very important for postmortem analyzes. Therefore it is saved in the log file.

User related information

Config var name Synopsis Example Windows Example Linux
UserAppData Path where FreeCAD stores User Related application data. C:\Documents and Settings\username\AppData\FreeCAD
Short path : %APPDATA%\FreeCAD
/home/username/.FreeCAD
Short path : ~/.FreeCAD
UserParameter File where FreeCAD stores User Related application data. C:\Documents and Settings\username\AppData\FreeCAD\user.cfg
Short path : %APPDATA%\FreeCAD\user.cfg
/home/username/.config/FreeCAD/user.cfg
Short path : ~/.config/FreeCAD/user.cfg or $HOME/.config/FreeCAD/user.cfg
SystemParameter File where FreeCAD stores Application Related data. C:\Documents and Settings\username\AppData\FreeCAD\system.cfg
Short path : %APPDATA%\FreeCAD\system.cfg
/home/username/.config/FreeCAD/system.cfg
Short path : ~/.FreeCAD/system.cfg or $HOME/.FreeCAD/system.cfg
UserHomePath Home path of the current user C:\Documents and Settings\username
Short path : %USERPROFILE%
/home/username
Short path : ~

Note: For Linux distributions, an additional configuration file that relates to Qt may exist at path /home/username/.config/FreeCAD/FreeCAD.conf.

Command line arguments

Config var name Synopsis Example
LoggingFile 1 if the logging is switched on 1
LoggingFileName File name where the log is placed C:\Documents and Settings\username\AppData\FreeCAD\FreeCAD.log
RunMode This indicates how the main loop will work. "Script" means that the given script is called and then exit. "Cmd" runs the command line interpreter. "Internal" runs an internal script. "Gui" enters the Gui event loop. "Module" loads a given python module. "Cmd"
FileName Meaning depends on the RunMode
ScriptFileName Meaning depends on the RunMode
Verbose Verbosity level of FreeCAD "" or "strict"
OpenFileCount Holds the number of files opened through command line arguments "12"
AdditionalModulePaths Holds the additional Module paths given in the cmd line "extraModules/"

System related

Config var name Synopsis Example Windows Example Linux
AppHomePath Path where FreeCAD is installed c:/Progam Files/FreeCAD_0.19 /user/local/FreeCAD_0.19
PythonSearchPath Holds a list of paths which python search modules. This is at startup can change during execution
AppTempPath Path of the temporary directory. Can be given with TMPDIR environment variable, or with the Parameter Editor: Tools → Edit parameters... → BaseApp → Preferences → General → TempPath /tmp/ (default)

Build related information

The table below shows the available information about the Build version. Most of it comes from the Subversion repository. This stuff is needed to exactly rebuild a version!

Config var name Synopsis Example
BuildVersionMajor Major Version number of the Build. Defined in src/Build/Version.h.in 0
BuildVersionMinor Minor Version number of the Build. Defined in src/Build/Version.h.in 7
BuildRevision SVN Repository Revision number of the src in the Build. Generated by SVN 356
BuildRevisionRange Range of different changes 123-356
BuildRepositoryURL Repository URL https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk/src
BuildRevisionDate Date of the above Revision 2007/02/03 22:21:18
BuildScrClean Indicates if the source was changed after checkout Src modified
BuildScrMixed Src not mixed

Branding related

These Config entries are related to the branding mechanism of FreeCAD. See Branding for more details.

Config var name Synopsis Example
ExeName Name of the build Executable file. Can differ from FreeCAD if a different main.cpp is used. FreeCAD.exe
ExeVersion Over all Version shows up at start time "0.19"
AppIcon Icon which is used for the Executable, shows in Application MainWindow. "FCIcon"
ConsoleBanner Banner which is prompted in console mode
SplashPicture Name of the Icon used for the Splash Screen "FreeCADSplasher"
SplashAlignment Alignment of the Text in the Splash dialog "Bottom" or "Left"
SplashTextColor Color of the splasher Text "#000000"
StartWorkbench Name of the Workbench which get started automatically after Startup "Part Design"
HiddenDockWindow List of dockwindows (separated by a semicolon) which will be disabled "Property editor"

Querying the configuration

From FreeCAD's Python console

Entries of the configuration set can be queried with the config var name (see tables above) from the Python console. For example:

 >>> FreeCAD.ConfigGet("ExeVersion")
 '0.19'

If the name is not found, an empty string is returned.

From command line

Use the --get-config <config-var-name> option to query a single name. Not all names are supported. For example:

 FreeCAD --get-config ExeVersion

Use the --dump-config option to get a list of names and their values. Not all names are supported.

From FreeCAD console

Start FreeCAD in console mode with --console and query with Python code. For example:

 $ FreeCAD --console
 [FreeCAD Console mode <Use Ctrl-D (i.e. EOF) to exit.>]
 >>> FreeCAD.ConfigGet("ExeVersion")
 '0.19'
 >>> exit()

For Linux (bash shell) you can modify the following command line to suit your needs:

 $ FreeCAD --console <<EOF
 print( "FREECAD_USER_HOME: " + ( "not set" if ( os.environ.get('FREECAD_USER_HOME') is None ) else os.environ.get('FREECAD_USER_HOME') ) )
 print( "UserHomePath: " + FreeCAD.ConfigGet("UserHomePath") )
 exit()
 EOF

Starting FreeCAD from the desktop

Linux: Creating an additional start option

The following assumes that your desktop is configured such that you can launch FreeCAD from it. Depending on your Linux distribution and desktop environment, you may have to adapt the following steps:

  1. Copy the freedesktop entry file for FreeCAD from /usr/share/applications/freecad.desktop to ~/.local/share/applications.
  2. Change the name from freecad.desktop to something else (e.g. MyFreeCADConfig.desktop).
  3. Open the file with a text editor and change how FreeCAD is invoked by modifying the line starting with Exec.
  4. As a result, an additional entry in your start menu/application launcher is available. This way, you can have multiple FreeCAD entries with various launch options.

Starting FreeCAD from a portable USB medium

Windows

Put the FreeCAD executable, FreeCAD.exe, on the USB medium. Create a batch file, FreeCAD.bat, and put it into the same directory as FreeCAD.exe. Inside the batch file write:

set CURRENTDIR=%cd%
set FREECAD_USER_HOME=%CURRENTDIR%
start FreeCAD.exe -u FreeCAD/user.cfg -s FreeCAD/system.cfg --write-log

Or with FREECAD_USER_DATA (see):

set CURRENTDIR="%cd%"
set FREECAD_USER_DATA=%CURRENTDIR%/..
start FreeCAD.exe -u %FREECAD_USER_DATA%/user.cfg -s %FREECAD_USER_DATA%/system.cfg

With the batch in the root of the USB medium:

set CURRENTDIR=%cd%
set FREECAD_USER_DATA=%CURRENTDIR%FreeCAD\
start %cd%FreeCAD\bin\FreeCAD.exe -u %FREECAD_USER_DATA%user.cfg -s %FREECAD_USER_DATA%system.cfg

Now double-click the batch file to start FreeCAD. (see)