Section analysis

Section analysis

terry_fusion
Advocate Advocate
373 Views
5 Replies
Message 1 of 6

Section analysis

terry_fusion
Advocate
Advocate

Is there a way to set up Fusion to step through a section analysis based upon a pre-set value?

 

For example I have a complex design that I want to create predetermined slices of, create either an animation from,  or a series of snapshots I can stitch together to create a video.

 

I just created a quick and dirty version of what I am looking to do, but with more smoothness and maybe some movement controls.

 

 

Thanks

0 Likes
374 Views
5 Replies
Replies (5)
Message 2 of 6

TimelesslyTiredYouth
Collaborator
Collaborator

Not my area of expertise but as no-one else is replying.

I think this is a task for API fusion...

Now my coding is very off but based off what I've learned through coding over the years from school is something like:

Attempt 30/06/2025

 

import adsk.core, adsk.fusion, traceback

def run(context):
app = adsk.core.Application.get()
ui = app.userInterface
design = adsk.fusion.Design.cast(app.activeProduct)
root = design.rootComponent
viewport = app.activeViewport

# Create section analysis on front (XZ) plane
plane = root.xZConstructionPlane
section = design.analysisManager.sectionAnalyses.add(
design.analysisManager.sectionAnalyses.createInput(plane))

# Settings
folder = 'C:/Temp/' # Make sure this folder exists (Here you actually need to make a folder called this... or a folder of your chopice but the C;/temp would need to be smth else in that case.)
steps = 50 # Number of images
move = 1.0 # Distance between slices

for i in range(steps):
# Move section forward
t = adsk.core.Matrix3D.create()
t.translation = adsk.core.Vector3D.create(0, 0, i * move)
section.transform = t

# Save image
filename = f'{folder}slice_{i:03d}.png'
viewport.saveAsImageFile(filename, 1280, 720)

ui.messageBox(' Done! All images saved.')

Now everything I've written above is very tempermental, and say miraculously it all works, because I don't even know if I've imported all the right Fusion files needed for this as this is only 10 minutes of research and if I was seriously making a code like this for API I would spend a lot longer to find which FUSION API's need to be imported in for this specific task... and say you got this to work. you need a good computer for this to work as it's taking a lot of scs at once

at the point where it says in range(steps) as the in range will keep repeating whatever value steps is. So if your computer isn't great trhen I would advice you trialing and erroring till you find your computer's limit starting with 3 scs.

 

smth like this for example:

 

Attempt 02/07/2025


def run(context):
app = adsk.core.Application.get()
design = adsk.fusion.Design.cast(app.activeProduct)
root = design.rootComponent
view = app.activeViewport
section = design.analysisManager.sectionAnalyses.add(
design.analysisManager.sectionAnalyses.createInput(root.xZConstructionPlane))

for i in range(3):
mat = adsk.core.Matrix3D.create()
mat.translation = adsk.core.Vector3D.create(0, 0, i * 5)
section.transform = mat
view.saveAsImageFile(f'C:/Temp/mini_{i}.png', 800, 600)


I just want to say this, if you do work API, I can only advice for Python all those other scripts in the API section like java script, I couldn't help you there srry, I don't know the first thing about Java, only python. 

 

I hope it helps, I just want to say trust the second piece of code more as I had help making this. While this isn't really what I specialise in as I work more with modelling and simulation tests and electrics, I hoped it helped!

 

Sleepy regards

Ricky

Message 3 of 6

TimelesslyTiredYouth
Collaborator
Collaborator

TimelesslyTiredYouth_0-1751486004721.png

this is what it should look like, makes more sense with colours.

Message 4 of 6

terry_fusion
Advocate
Advocate
Thank you, I very much appreciate your reply. 👍

I will definitely be on this first thing in the morning! 🚧

Thanks 😊
Message 5 of 6

TimelesslyTiredYouth
Collaborator
Collaborator

Good luck man, , there have been many big projects on Fusion forum but this I must say tops it all.

If you are to use this method however by incroperating API scripts, I want to say mine is only a guidline, while it may work to an extent you need to change the values to fit your own needs, like with the move I've set it to 1, so every 1s approx, and step is 50 so for 50s it'll take a snapshot every second, but if you want to distance your snapshots and increase the length of the amount of snapshots, then you need to figure out what values you need. Additionally, I'm no proffesional coder, I'm just presuming that this is a video for a client and this is a compnay project, but I would advice you to get someone with experience in coding to fineline the edges because as you said you made, I made this code very: "Quick and dirty," a project like this requires a lot of trial and error, let me know how it goes and if you need help just give me a PM,

 

Good luck, 

 

Ricky

0 Likes
Message 6 of 6

terry_fusion
Advocate
Advocate

Good morning!

 

Still a bit sleepy eyed myself.

 

I read through your responses and am looking at the code, I have not done any coding in a loooong time, but looks attempt-able (fingers crossed)

 

Appreciate the input and I will work on this and see where it leads me.

 

I get some pretty off the wall ideas, but only because my boss is a lunatic (in a good way)

 

Cheers

0 Likes