Avvio e Configurazione
Questa pagina descrive i diversi modi per avviare FreeCAD e le principali caratteristiche di configurazione.
Avviare FreeCAD dalla riga di comando
FreeCAD può essere avviato normalmente, facendo doppio clic sulla sua icona sul desktop o selezionandolo dal menu di avvio, ma può anche essere avviato direttamente dalla riga di comando. Ciò consente di modificare alcune delle opzioni di avvio di default.
Le opzioni della riga di comando
Le opzioni della riga di comando sono soggette a frequenti cambiamenti, quindi è bene verificare le opzioni correnti digitando:
FreeCAD --help
Nella risposta sono elencati i parametri utilizzabili:
Usage: 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
Risposta e file di configurazione
FreeCAD può leggere alcune di queste opzioni da un file di configurazione. Questo file deve essere nella directory bin e deve essere nominato FreeCAD.cfg. Tenere presente che le opzioni specificate nella riga di comando sovrascrivono il file di configurazione!
Alcuni sistemi operativi hanno una riga di comando estremamente corta. Il modo più comune per aggirare questa limitazione è quello di usare il file di risposta. Un file di risposta è semplicemente un file di configurazione che utilizza la stessa sintassi della riga di comando. Se la riga di comando specifica un nome di file di risposta da utilizzare, esso viene caricato e analizzato in aggiunta alla linea di comando:
FreeCAD @ResponseFile.txt
oppure:
FreeCAD --response-file=ResponseFile.txt
Opzioni nascoste
Per l'utente esistono alcune opzioni non visibili. Queste opzioni sono, per esempio, i parametri di X-Window analizzati dal sistema Windows:
- -display display, imposta la visualizzazione di X (il valore predefinito è $DISPLAY).
- -geometry geometry, imposta la geometria client della prima finestra che viene visualizzata.
- -fn oppure -font font, definisce il tipo carattere dell'applicazione. Il carattere deve essere specificato utilizzando una descrizione logica dei font di X.
- -bg oppure -background color, imposta il colore di sfondo predefinito e una tavolozza per applicarlo (sono calcolate le tonalità chiare e scure).
- -fg oppure -foreground color, imposta il colore di primo piano predefinito.
- -btn oppure -button color, imposta il colore predefinito dei pulsanti.
- -name name, imposta il nome dell'applicazione.
- -title title, imposta il titolo dell'applicazione.
- -visual TrueColor, forza l'applicazione a utilizzare una visualizzazione TrueColor su un display a 8-bit.
- -ncols count, limita il numero di colori allocati nel cubo di colori su un display a 8 bit, se l'applicazione sta usando la specifica di colore QApplication::ManyColor. Se count è 216 allora è utilizzato un cubo di colori di 6x6x6 (vale a dire 6 livelli di rosso, 6 di verde, e 6 di blu), per altri valori viene utilizzato un cubo approssimativamente proporzionale a un cubo 2x3x1.
- -cmap, obbliga l'applicazione a installare una mappa privata di colori su un display a 8 bit.
Eseguire FreeCAD senza interfaccia utente
FreeCAD normally starts in GUI mode, but you can also force it to start in console mode by typing:
FreeCAD -c
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.
Running FreeCAD as a python module
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:
import sys
sys.path.append("path/to/FreeCAD/lib") # change this by your own FreeCAD lib path
import FreeCAD
Once FreeCAD is loaded, it is up to you to make it interact with your host application in any way you can imagine!
The Config 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 post postmortem analyzes. Therefore it is saved in the log file.
Config var name | Synopsis | Example M$ | Example Posix (Linux) |
---|---|---|---|
UserAppData | Path where FreeCAD stores User Related application data. | C:\Documents and Settings\username\Application Data\FreeCAD | /home/username/.FreeCAD |
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 |
UserHomePath | Home path of the current user | C:\Documents and Settings\username\My Documents | /home/username |
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\Application Data\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/" |
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 |
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.
Python related environment variables:
- PYTHONPATH
- PYTHONHOME
- TCL_LIBRARY
- TCLLIBPATH
OpenCascade related environment variables:
- CSF_MDTVFontDirectory
- CSF_MDTVTexturesDirectory
- CSF_UnitsDefinition
- CSF_UnitsLexicon
- CSF_StandardDefaults
- CSF_PluginDefaults
- CSF_LANGUAGE
- CSF_SHMessage
- CSF_XCAFDefaults
- CSF_GraphicShr
- CSF_IGESDefaults
- CSF_STEPDefaults
System related environment variables:
- PATH
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!
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 differnt 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 ager checkout | Src modified |
BuildScrMixed | Src not mixed |
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 diver from FreeCAD if a different main.cpp is used. | FreeCAD.exe |
ExeVersion | Over all Version shows up at start time | V0.7 |
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 | Left" |
SplashTextColor | Color of the splasher Text | "#000000" |
StartWorkbench | Name of the Workbech which get started automaticly after Startup | "Part design" |
HiddenDockWindow | List of dockwindows (separated by a semicolon) which will be disabled | "Property editor" |