Команда "Отправить в консоль Python"

From FreeCAD Documentation
Revision as of 10:17, 15 December 2021 by FuzzyBot (talk | contribs) (Updating to match new version of source page)
Jump to navigation Jump to search
Other languages:
Deutsch • ‎English • ‎français • ‎italiano • ‎polski • ‎русский • ‎한국어

Std SendToPythonConsole.svg Отправить в консоль Python

Системное название
Std_SendToPythonConsole
Расположение в меню
Правка → Отправить в консоль Python
Верстаки
Все
Быстрые клавиши
Ctrl+Shift+P
Представлено в версии
0.19
См. также
Нет

Описание

The Std SendToPythonConsole command creates a variable in the Python console referencing a selected object. If a subshape of the object is selected two additional variables are created, one referencing the shape of the object and the other referencing the subshape itself. The variables and the code involved can be used to development Python code.

>>> ### Begin command Std_SendToPythonConsole
>>> obj = App.getDocument("Unnamed").getObject("Box")
>>> shp = App.getDocument("Unnamed").getObject("Box").Shape
>>> elt = App.getDocument("Unnamed").getObject("Box").Shape.Edge8
>>> ### End command Std_SendToPythonConsole

Example output: an edge of a Part Box was selected

Применение

  1. Select a single object.
  2. There are several ways to invoke the command:
    • Select the Edit → Std SendToPythonConsole.svg Send to Python Console option from the menu.
    • Select the Std SendToPythonConsole.svg Send to Python Console option from the Tree view context menu or 3D view context menu.
    • Use the keyboard shortcut: Ctrl+Shift+P.
  3. If required the Python console opens. introduced in version 0.20
  4. The Python console receives the keyboard focus. introduced in version 0.20