Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So I have uploaded a CAD Model to fusion and opened the File. I would like to make a copy of the components body and then split the body to get a sketch profile and then revolve that sketch profile. This is my long term goal but I am stuck on the first part which is trying to copy a body of a component.
I am very new to this so I am learning along the way and reading lots. I keep getting this error "Bad Index Parameter" when running this code. Any help would be appreciated.
import adsk.core, adsk.fusion, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
product = app.activeProduct
design = adsk.fusion.Design.cast(product)
if not design:
ui.messageBox('No active Fusion design', 'No Design')
return
# Get the root component of the active design.
rootComp = design.rootComponent
features = rootComp.features
# Get the first sub component
occs = rootComp.occurrences
subComp1 = occs.item(0).component
# Get the first body in sub component 1
baseBody = subComp1.bRepBodies.item(0)
baseBody.name = "Stick_1"
# Copy/paste bodies
subComp1.features.copyPasteBodies.add(baseBody)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Solved! Go to Solution.