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 fusion 360 python api related to drawings

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
jeremy.herbert
345 Views, 3 Replies

Bug in fusion 360 python api related to drawings

Hi,

 

I'm trying to add a centermarks to a grid of about ~300 holes in a drawing. There doesn't seem to be a way to do this without clicking on every single hole individually (although I'd love to be proven wrong), so of course, I thought it would be a good idea to write a script to do it. Unfortunately there is no documentation on using python inside the drawing mode of fusion 360 (as far as I can see), and I quickly came across a showstopper bug. To replicate:

 

Create a model with any body (even a cube will do), then create a drawing from it and place the model in the drawing. Then go to the scripting area and run the following python:

 

import adsk.core
app = adsk.core.Application.get()
print(app.activeDocument.products.count())  # should print out '1'

prod = app.activeDocument.products.item(0)  # raises exception:
# Traceback (most recent call last):
#   File "<string>", line 1, in <module>
#   File "/Users/jeremy/Library/Application Support/Autodesk/webdeploy/production/11badf998e664af8a6c8e3ef3d0a55f18ae8cb3c/Autodesk Fusion 360.app/Contents/Api/Python/packages/adsk/core.py", line 9509, in item
#     return _core.Products_item(self, *args)
# RuntimeError: 2 : InternalValidationError : res

prod = app.activeDocument.products[0]  # doesn't raise an exception, but...
print(type(prod))  # prints: '<class 'NoneType'>', which means that something bad happened

Is there any information on how to use scripting within the drawing view of fusion 360 ? 

 

Thanks,

Jeremy

3 REPLIES 3
Message 2 of 4
ekinsb
in reply to: jeremy.herbert

There is currently not any API support for the Fusion drawing functionality. It is something we plan to do but there isn't a scheduled timeframe when it will be available which means it will still be quite a while. We should fix this so you can at least tell when a drawing is open

Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 4
jesse
in reply to: ekinsb

Not sure if this should be in a reply or in a separate thread, but I would also really love to see a drawing API for Fusion 360 (for me, specifically, I want to be able to create custom tables and auto populate them with plugin information).  Any way to push this up the priority list?

 

--

Jesse Rosalia

Founder, Bommer

Message 4 of 4
ekinsb
in reply to: jesse

The best thing would be to create a request in the Idea Station.  That's what will be the most visible to the product managers that decide the priorities and what work will get done.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog

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