How to create a simple cylinder and cone in the API. (Python)

How to create a simple cylinder and cone in the API. (Python)

cortesaMNTB8
Explorer Explorer
1,276 Views
2 Replies
Message 1 of 3

How to create a simple cylinder and cone in the API. (Python)

cortesaMNTB8
Explorer
Explorer

Hello, 

I am new to fusion 360 API, but I have some basic understanding on how things work. I am trying to create a simple cone and cylinder in the API, but I am not sure where to start. I saw some examples, but they are confusing. I just need a simple cone and cylinder. I do not need anything fancy. 

 

0 Likes
Accepted solutions (1)
1,277 Views
2 Replies
Replies (2)
Message 2 of 3

j.han97
Advocate
Advocate

Hello,

 

For me the simplest way would be creating transient cone & cylinder objects and adding them under rootComponent.

 

Creating transient objects is straightforward, you can refer to the guide here:

Fusion 360 Help | Cone.create Method | Autodesk

Fusion 360 Help | Cylinder.create Method | Autodesk

 

To add the bodies, you can use bRepBodies.add() method here:

Fusion 360 Help | BRepBodies.add Method | Autodesk

 

However in my opinion, although your objectives are simple enough, you still require a certain level of understanding on how Fusion 360 API works.   

Message 3 of 3

tykapl.breuil
Advocate
Advocate
Accepted solution

To add to what @j.han97 is saying, the fusion 360 API doesn't directly support creating cylinders through a cylinder feature like the UI does. The other option (aside from the temporary BRepManager) is to use the natural workflow you would use in Fusion 360 to create more complex solids, ie creating a sketch, drawing a circle on it and then extruding it. Here is a sample script that does exactly that :

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-CB1A2357-C8CD-474D-921E-992CA3621D04

 

The learning cruve of the Fusion 360 API is quite steep but it is really rewarding to use, I encourage you to spend a bit of time to understand the sample above and you should be golden.