Revolve Profile from a Sketch Script

Revolve Profile from a Sketch Script

michwisn9898
Observer Observer
291 Views
1 Reply
Message 1 of 2

Revolve Profile from a Sketch Script

michwisn9898
Observer
Observer

Hello I am trying to create a script that will  select multiple profiles from a single sketch and revolve around an axis (Max Y or Min Y). 

 

Fig 1. Single Sketch, Multiple ProfilesFig 1. Single Sketch, Multiple Profiles

 

Then will create two different bodies as: 

Fig 2, Separate bodies createdFig 2, Separate bodies created

 

This should create separate bodies from the profile. 

 

I have already created the code, however I am having issues with the revolve aspect of the code.

 

"""This file acts as the main module for this script."""

import traceback
import adsk.core
import adsk.fusion
# import adsk.cam

# Initialize the global variables for the Application and UserInterface objects.
app = adsk.core.Application.get()
ui  = app.userInterface


def run(_context: str):
    """This function is called by Fusion when the script is run."""

    try:

        design = app.activeProduct
        rootComp = design.rootComponent

        profiles = adsk.core.ObjectCollection.create()

        while 1: 
            selection = ui.selectEntity("Select Profiles","Profiles")
            if selection:
                ui.messageBox("Selected")
                profiles.add(selection.entity)
                revolves = rootComp.features.revolveFeatures
                #Take profile revolve around a selected plane
                #Create new body
                #Name body (i.e A1, A2, ... , Z10)

            else:
                #break if shortcut is hit
                break


        if profiles.count > 0:
            ui.messageBox(str(profiles))

        
    except:  #pylint:disable=bare-except
        ui.messageBox("Failed")
        # Write the error message to the TEXT COMMANDS window.
        app.log(f'Failed:\n{traceback.format_exc()}')

 

If I could pointed in the right direction that would be great. Thank you. 

Much help is appreciated! 

 

 

0 Likes
292 Views
1 Reply
Reply (1)
Message 2 of 2

RohitMane_
Autodesk
Autodesk

Hello @michwisn9898 

You can refer to the Revolve feature example mentioned below for more details :
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-407f1b28-fd08-11e4-a671-3417ebd3d5be 

0 Likes