API to Extrude a specific Profile from an existing Sketch, and Join to all other bodies

API to Extrude a specific Profile from an existing Sketch, and Join to all other bodies

info83PHN
Advocate Advocate
498 Views
1 Reply
Message 1 of 2

API to Extrude a specific Profile from an existing Sketch, and Join to all other bodies

info83PHN
Advocate
Advocate

Need to Extrude one specific Profile from an existing Sketch ( contains 2 profiles ) and Join to all other bodies.

 

So :

1. how to identify the Profiles in an existing Sketch ? Is there some list that can be loop'd thru to display the Profile names / item numbers, and then thru trial & error, identify the Profile that I want extruded ( and then modify the code to Extrude only that profile ) ?

 

2. How to either :

a) set the Extrude to 'Join', or

b) after the Extrude, Combine all Bodies in the design

 

Regards

0 Likes
Accepted solutions (1)
499 Views
1 Reply
Reply (1)
Message 2 of 2

j.han97
Advocate
Advocate
Accepted solution

Hi,

 

1. If you know where your sketches are, you can locate them using API. Let's say they are at under rootComponent, you can access them with:

sketches = rootComp.sketches #Access the list of sketches in rootComponent
sketch = sketches[0] #Get the first sketch
profile = sketch[0] #Get the first profile

 You can loop through the list of sketches/profiles and filter them using your own criteria.

 

2. a) The specific line of code you want should be:

operation = adsk.fusion.FeatureOperations.JoinFeatureOperation

 This will set the operation mode of the extrude function to be 'Join'. For more information, please read this example for the steps of defining an extrude operation: Fusion 360 Help | Extrude Feature API Sample | Autodesk

 

b) If the extrusion 'touches' the bodies, I believe the extrude operation will join them together automatically. If not, you can use the Combine Feature here: Fusion 360 Help | CombineFeatures Object | Autodesk. The steps to setup a Combine Feature are very s...