Message 1 of 2
Revolve Profile from a Sketch Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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 Profiles
Then will create two different bodies as:
Fig 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!