Bug in products.itemByProductType with FusionDrawingProductType as parameter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I just open one design file and one drawing file
Now let's count how many document are opened:
>>> app.documents.count 3
Three ? Really ?
>>> for doc in app.documents: ... print(doc.name) ... B v2 B v2 B Drawing v1
OK…
Now let's check products in each document:
>>> for doc in app.documents: ... print(doc.products.count) ... 1 1 1
>>> for doc in app.documents: ... print(doc.products.itemByProductType('DesignProductType')) ... <adsk.fusion.Design; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::fusion::Design > *' at 0x000000000C2A99C0> > <adsk.fusion.Design; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::fusion::Design > *' at 0x000000000C2A99C0> > None
>>> for doc in app.documents: ... print(doc.products.itemByProductType('FusionDrawingProductType')) ... None None Traceback (most recent call last): File "<string>", line 2, in <module> File "C:/Users/jerome/AppData/Local/Autodesk/webdeploy/production/2fc56ab2b960a23a37c37a3688c13a7f7fa1ecc7/Api/Python/packages\adsk\core.py", line 11473, in itemByProductType return _core.Products_itemByProductType(self, *args) RuntimeError: 2 : InternalValidationError : res During handling of the above exception, another exception occurred: SystemError: <built-in function delete_Documents> returned a result with an error set
Same thing when trying to access the first item in each collection:
>>> for doc in app.documents: ... print(doc.products.item(0)) ... <adsk.fusion.Design; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::fusion::Design > *' at 0x000000000C2A99C0> > <adsk.fusion.Design; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::fusion::Design > *' at 0x000000000C2A99C0> > Traceback (most recent call last): File "<string>", line 2, in <module> File "C:/Users/jerome/AppData/Local/Autodesk/webdeploy/production/2fc56ab2b960a23a37c37a3688c13a7f7fa1ecc7/Api/Python/packages\adsk\core.py", line 11463, in item return _core.Products_item(self, *args) RuntimeError: 2 : InternalValidationError : res During handling of the above exception, another exception occurred: SystemError: <built-in function delete_Documents> returned a result with an error set
One last thing:
>>> for doc in app.documents: ... print(doc.classType) ... <built-in function FusionDocument_classType> <built-in function FusionDocument_classType> <built-in function Document_classType>
Jérôme Briot, Freelance engineer - Mechanical design and prototyping
3D Print Plus / Pro | IDF Import | GitHub To Fusion 360 | Tube Bending Data Exchanger | Slice Data Export
Memory Used | Basic Calculator | Check Computer Specifications | Import spline from any CSV file