FUSION API: SPECIFYING OCCURENCE SURFACE AFTER INSERT FOR EXTRUDE TO ENTITY

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am having difficulties with trying to acquire features of an occurrence after inserting the occurrence to a current design. I am currently working on a wind turbine design where I would like to automate:
1. Inserting the blade file into the hub file (a cylinder - the centre piece that joins all blades together)
2. Move the blade to the correct position
3. Extrude to entity from the blade root to the hub
4. Pattern both the extrude entity and blades around the hub
The code below assumes that I already have the hub and blade CADs ready with both saved. The blade CAD is simply a blend of aerofoil sketches. Currently what I have are points (1) and (2) achieved and I have difficulties with (3) - specifically how can I specify that I want the first sketch plane of the blade to extrude to entity onto the circular hub surface?
I have also attached my blade and hub CADs below. Thanks in advance.
import adsk.core, adsk.fusion, adsk.cam, traceback import math def run(context): ui = None try: app = adsk.core.Application.get() ui = app.userInterface product = app.activeProduct design = adsk.fusion.Design.cast(product) root = design.rootComponent; # locate blade file BladeFile = None for file in project.rootFolder.dataFiles: if file.name == 'blade': BladeFile = file break # add blade in with transformation transform = adsk.core.Matrix3D.create() vector = adsk.core.Vector3D.create(0.1*100,0.0,0.187*100) transform.translation = vector blade = root.occurrences.addByInsert(BladeFile,transform,True) except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))