|
|
| Menu location |
|---|
| Edit → Send to Python Console |
| Workbenches |
| All |
| Default shortcut |
| Ctrl+Shift+P |
| Introduced in version |
| 0.19 |
| See also |
| None |
The Std SendToPythonConsole command creates variables in the Python Console referencing selected objects and selected subobjects, along with some other useful variables. They can be used in the development of Python code.
The following variables are created:
| Variable | Referenced object(s) |
|---|---|
sels |
A list of selection objects (one for each selected object) |
sel |
The last item in sels (belonging to the last selected object)
|
doc |
The document containing the selected objects |
objs |
A list with an item for each selected object: The selected object itself (if it is not a Link) |
obj |
The last item in objs (belonging to the last selected object)
|
lnks |
A list with an item for each selected object: The selected object itself (if it is a Link) |
lnk |
The last item in lnks (belonging to the last selected object)
|
shps |
A list with an item for each obj in objs:The |
shp |
The last item in shps (belonging to the last item in objs)
|
subs |
A list with the selected subobjects. The list is empty if no subobjects have been selected. |
sub |
The last item in subs, or None if subs is empty.
|
names |
A list with a tuple for each selected object. Each tuple contains the names of the subobjects belonging to that object. The tuple is empty if no subobjects have been selected for the object. |
name |
The last item in the last tuple in names, or None if that tuple is empty.
|
App::Link) and whose linked object has a Shape, the item in shps will be the shape of the linked object. If the Links have been transformed or scaled and you want to access the scaled/transformed shapes, you can do so with this code:lnk_shps = [Part.getShape(l) if l else None for l in lnks]
lnk_shp = Part.getShape(lnk) if lnk else None