Std SendToPythonConsole/de: Difference between revisions

From FreeCAD Documentation
No edit summary
No edit summary
Line 3: Line 3:
{{Docnav/de
{{Docnav/de
|[[Std_Delete/de|Löschen]]
|[[Std_Delete/de|Löschen]]
|[[Std_Placement/de|Platzierung]]
|[[Std_Placement/de|Positionierung]]
|[[Std_Edit_Menu/de|Bearbeitungsmenü]]
|[[Std_Edit_Menu/de|Std Menü Bearbeiten]]
|IconL=Std_Delete.svg
|IconL=Std_Delete.svg
|IconR=Std_Placement.svg
|IconR=Std_Placement.svg

Revision as of 13:22, 14 April 2022

Std SendeAnPythonKonsole

Menüeintrag
Bearbeiten → Sende an Python Konsole
Arbeitsbereich
Alle
Standardtastenkürzel
Ctrl+Shift+P
Eingeführt in Version
0.19
Siehe auch
Keiner

Beschreibung

Der Std SendeAnPythonKonsole Befehl erstellt eine Variable in der Python Konsole, die auf ein ausgewähltes Objekt verweist. Wenn eine Unterform des Objekts ausgewählt wird, werden zwei zusätzliche Variablen erstellt, von denen eine auf die Form des Objekts und die andere auf die Unterform selbst verweist. Die Variablen und der damit verbundene Code können zur Entwicklung von Python Code verwendet werden.

Depending on the selected object and its selected subshapes, if any, the following variables are created:

Variable name Referenced object(s)
doc The document containing the selected object
lnk The selected Link object (only created if the selected object is a Link)
obj Depending on the selected object:

The selected object itself (if the selected object is not a Link)
The Linked object (if the selected object is a Link)

shp Depending on the type of obj:

The Shape property of obj (for objects derived from the Part::Feature class)
The Mesh property of obj (for Mesh objects)
The Points property of obj (for Points objects)

sub The first selected subshape (only created if at least one subshape is selected)
subs A list containing all subshapes (only created if two or more subshapes are selected)
>>> ### Begin command Std_SendToPythonConsole
>>> try:
>>>     del(doc,lnk,obj,shp,sub,subs)
>>> except Exception:
>>>     pass
>>> 
>>> doc = App.getDocument("Unnamed")
>>> lnk = doc.getObject("Link")
>>> obj = lnk.getLinkedObject()
>>> shp = obj.Shape
>>> sub = obj.getSubObject("Edge10")
>>> subs = [obj.getSubObject("Edge10"),obj.getSubObject("Face3"),obj.getSubObject("Vertex5"),]
>>> ### End command Std_SendToPythonConsole

Beispielausgabe: eine Kante eines Part Quaders wurde ausgewählt

Verwendung

  1. Wähle ein einzelnes Objekt aus.
  2. Es gibt mehrere Wege, den Befehl aufzurufen:
    • Wähle die Bearbeiten → Sende an Python Konsole Option aus dem Menü.
    • Wähle die Option Template:MenuCommand/de Option aus dem Baumansicht Kontextmenü oder 3D Ansicht Kontextmenü.
    • Verwende die Tastaturkürzel: Strg+Shift+P.

Notes

  • All previously created variables are deleted each time the command is run.