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: 

How to take pictures of the different faces of a cube on Fusion 360 (using an Add-in or a Script)

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
201933238
146 Views, 3 Replies

How to take pictures of the different faces of a cube on Fusion 360 (using an Add-in or a Script)

I am really new with Fusion 360 and I would like to create an Add-in or a Script that would allow me to take pictures of the different faces of a 3D object and save them. I've made something that seems like it could work, but Visual studio keep telling me that I can't use the command AppearanceCapture and AppearanceCaptureOptions. While later I would like to make a program that could work with any 3D shape, for now I simply want to be able to get pictures of the different faces of a cube (baby steps).

 

Could any one of you help me with my problem or give me idea on how I could do this?

Linked to this post is the code I've made.

 

Thank you in advance!

3 REPLIES 3
Message 2 of 4
Jorge_Jaramillo
in reply to: 201933238

Hi,

 

I wrote the following function to capture images of different views (you can call it from script's run() function):

 

def save_view_images():
    WIDTH = 400
    HEIGHT = 300

    app = adsk.core.Application.get()
    des: adsk.fusion.Design = adsk.fusion.Design.cast(app.activeProduct)

    for nv in des.namedViews:
        nv.apply()
        app.activeViewport.saveAsImageFile(f'/99tmp/views/{nv.name}.png', WIDTH, HEIGHT)

 

 

It reads the custom views you have defined in the current design:

Jorge_Jaramillo_0-1695346353582.png

 

And save an image of every view. This is the result:

Jorge_Jaramillo_1-1695346551250.png

 

I hope this could help you out.

 

Regards,

Jorge Jaramillo

Software Engineer

 

Message 3 of 4
201933238
in reply to: Jorge_Jaramillo

Hi,

 

Thank you very much for helping me with this matter. The solution you gave me is miles beyond what I was originally thinking of doing.

 

I added your solution to a new fusion 360 script however it doesn't seem to be working (the fault is most likely that I forgot to add something).

 

Sans titre.png

 

201933238_0-1695609856392.png

When I try to run the script I am met with this :

Sans titre2.png

Again, I am certain the problem is linked to the fact that I forgot something. Could you help me understand what I am missing please.

 

Regards,

A student who is interested in learning python

 

 

Message 4 of 4
Jorge_Jaramillo
in reply to: 201933238

Hi @201933238 ,

 

The Design.namedViews property is new in September-2023 updated version:

Jorge_Jaramillo_0-1695616160682.png

 

Make sure you have the latest Fusion 360 update and it will run without errors.

I'm running on this version:  app.version='2.0.17244'

 

Regards,

Jorge Jaramillo

Software Engineer

 

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