Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug in products.itemByProductType with FusionDrawingProductType as parameter

0 REPLIES 0
Reply
Message 1 of 1
JeromeBriot
194 Views, 0 Replies

Bug in products.itemByProductType with FusionDrawingProductType as parameter

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>

 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report