TypeError in recorded macro when adding to "parts"

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
llll
Posts: 173
Joined: Fri Nov 12, 2021 1:56 am

TypeError in recorded macro when adding to "parts"

Post by llll »

App.getDocument(f'{name}').getObject('Parts').ViewObject.dropObject(App.getDocument(f'{name}').getObject('Box'),None,'',[])
<class 'TypeError'>: argument 2 must be App.DocumentObject, not None

Not sure what is meant to be in place of "None", as it comes from recorded macro.

MRE attached

ty

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git)
Build type: Release
Branch: releases/FreeCAD-0-20
Hash: 68e337670e227889217652ddac593c93b5e8dc94
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.2
Attachments
beforeassembly.FCStd
(8.71 KiB) Downloaded 25 times
beforeassembly_macro.FCMacro
(2.03 KiB) Downloaded 25 times
Last edited by llll on Tue Jul 19, 2022 9:34 am, edited 2 times in total.
chrisb
Veteran
Posts: 53928
Joined: Tue Mar 17, 2015 9:14 am

Re: TypeError in recorded macro when adding to "parts"

Post by chrisb »

Is this rather a Python question? Which Assembly workbench do you use?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
llll
Posts: 173
Joined: Fri Nov 12, 2021 1:56 am

Re: TypeError in recorded macro when adding to "parts"

Post by llll »

chrisb wrote: Mon Jul 18, 2022 3:58 pm Is this rather a Python question? Which Assembly workbench do you use?
Sure, it's a python question for assembly3, probably a good idea to move forums
chrisb
Veteran
Posts: 53928
Joined: Tue Mar 17, 2015 9:14 am

Re: TypeError in recorded macro when adding to "parts"

Post by chrisb »

llll wrote: Tue Jul 19, 2022 12:39 am question for assembly3,
In that case I would rather leave it here. I doubt that the Assembly3 gurus all watch the Python forum.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
llll
Posts: 173
Joined: Fri Nov 12, 2021 1:56 am

Re: TypeError in recorded macro when adding to "parts"

Post by llll »

llll wrote: Mon Jul 18, 2022 12:27 pm .
My mistake, didn't realise this was a development forum

It was simple...

Code: Select all

('Box'))#,None,'',[])

Code: Select all

Gui.doCommand('asm3AddLocked')
Although not confirmed, still wondering how to import assembly3.
marioalexis
Posts: 124
Joined: Wed Jun 19, 2019 7:44 pm

Re: TypeError in recorded macro when adding to "parts"

Post by marioalexis »

The error was already reported here: https://forum.freecadweb.org/viewtopic.php?f=20&t=69777
Tomorrow I will send a PR that includes the correction of this regression.
Post Reply