Command/ru

Introduction
Команда это то, что выполняется, когда вы нажимаете кнопку на панели инструментов или набираете комбинацию клавиш. Это может быть очень простое действие, например изменение уровня масштабирования трёхмерного вида или поворот точки зрения или сложная система, которая откроет диалоговые окна и дождитесь, когда пользователь выполнит определенные задачи.

Каждая команда FreeCAD имеет уникальное имя, которое появляется на странице Category:Command_Reference. Команды могут запускаться с помощью кнопки панели инструментов, элемента меню или скрипта python или консоли python, запустив:

Background
FreeCAD commands are defined per 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/burden the FreeCAD startup process and therefore loaded 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).

As most of them require user interaction, FreeCAD commands are only available in GUI-mode, and not in console mode. However, for convenience, most FreeCAD commands will either have a corresponding python function (like or ), or will execute code that is very easy to replicate in a python script and/or macro.

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

Commands defined in C++
Example of a C++ command definition, usually defined following the structure.

Commands defined in Python
Example of a Python command definition, it can be placed in a directory like.

Examples
See Line drawing function.