View Issue Details

IDProjectCategoryView StatusLast Update
0004481FreeCADBugpublic2021-02-20 11:35
Reporterhiaselhans Assigned To 
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionno change required 
Product Version0.18 
Target Version0.20 
Summary0004481: App.ActiveDocument.ActiveObject is not updated
DescriptionWhen an object is selected from the 3d-view it is being marked in the list on the left ("Model"), however when trying to access it via App.ActiveDocument.ActiveObject the returned model is random.
Steps To ReproduceCreate a new document
Create a Box
Open python console

>>>App.ActiveDocument.ActiveObject.Label
'Würfel'

create cylinder

>>>App.ActiveDocument.ActiveObject.Label
'Zylinder'

select box

>>>App.ActiveDocument.ActiveObject.Label
'Zylinder'

expected: 'Würfel'
TagsNo tags attached.
FreeCAD InformationOS: Arch Linux
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16146 (Git)
Build type: Release
Branch: makepkg
Hash: 980bf9060e28555fecd9e3462f68ca74007b70f8
Python version: 3.8.6
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.4.0
Locale: German/Germany (de_DE)

Activities

wmayer

2021-02-20 11:35

administrator   ~0015372

This is not a bug but the intended behaviour. ActiveObject always refers to the last created object and does not obey on what has been selected.
If you want the selected object then use:
Gui.Selection.getSelection()[0].Label

Issue History

Date Modified Username Field Change
2020-11-01 17:26 hiaselhans New Issue
2021-02-06 06:49 abdullah Target Version => 0.20
2021-02-20 11:35 wmayer Status new => closed
2021-02-20 11:35 wmayer Resolution open => no change required
2021-02-20 11:35 wmayer Note Added: 0015372