Command/ro

O comandă FreeCAD este ceea ce este executat când apăsați un buton din bara de instrumente sau apăsați o scurtătură din tastatură. Poate fi o acțiune foarte simplă, cum ar fi schimbarea nivelului de zoom al vizualizării 3D sau rotirea punctului de vedere sau un sistem complex care va deschide casetele de dialog și va aștepta ca utilizatorul să îndeplinească anumite sarcini.

Each FreeCAD command has a unique name, that appears in the Category:Command_Reference page. Commands can be launched by a toolbar button, a menu item, or from a python script or the python console, by running:

FreeCADGui.runCommand("my_Command_Name")

Comenzile FreeCAD sunt definite prin Atelier/workbench. Workbenches will normally add their command definitions at FreeCAD init time, so the command exists and is available as soon as FreeCAD is started, no matter if the corresponding workbench has been activated yet or not. In some cases, however, the workbench author might have decided, to not overload too much the FreeCAD startup process, to load the command definitions only at workbench init. In those cases, the command will only be available after the workbench has been activated (you have switched to it at least once with the workbench selector).

Deoarece majoritatea dintre ele necesită interacțiune cu utilizatorul, comenzile FreeCAD sunt disponibile numai în modul GUI și nu în modul consola. However, for convenience, most FreeCAD commands will either have a corresponding python function (like Part.makeBox or Draft.makeLine), or will execute code that is very easy to replicate in a python script.

Commands can be defined either in C++ or in Python.

Example of a C++ command definition (usually defined in /Mod/ModuleName/Gui/Command.cpp):

and a similar command in python (no rule for where it must be done, each python workbench does as it sees fit...)