Community
Fusion Design, Validate & Document
Stuck on a workflow? Have a tricky question about a Fusion (formerly Fusion 360) feature? Share your project, tips and tricks, ask questions, and get advice from the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating a Helix around a 3D Curve with Fusion 360 & Python

22 REPLIES 22
SOLVED
Reply
Message 1 of 23
dinocoglitore
13267 Views, 22 Replies

Creating a Helix around a 3D Curve with Fusion 360 & Python

Header2-Helix2.png

The Origin of the Idea  

Here I am (on the right) with my favorite teacher, Dario (left).

Dino-bio.png

I am a teacher of Information and Communications Technologies (ICT) at a secondary technical school in Palermo (Italy). Like the other teachers, I had to be trained before training other people. In the case of Fusion 360, my teacher was Autodesk Expert Elite Dario Passariello @passariello (Digital3D), Autodesk Academic Partner and Certified Instructor. 

A Spark That Lit

During the course which I followed I made a model of a robotic arm which currently sits in a school lab.

1.pngOne part of the mechanical arm has some electrical cables with the shape of a spiral.

2-Mechanical arm.jpg

In the construction of the model, I left this detail for last, thinking that Fusion would provide for tools to handle the modelling of the component in a simple way. Then, I found out that this could be done only with other Autodesk software (3DSMax and Inventor) which I did not know or with software from competing companies (Rhino and Solidworks), not with Fusion. So I tried to develop a script which may help. 

 

Introduction
Observing the various forum posts regarding Fusion 360, the question on the making of a HELIX is quite debated. The keywords I used for my research were spiral, coil and helix.


There are different approaches to the making of a 3D helix. The simplest is the one that uses the coil; the most complex is the analytical one. While the first approach allows us to use the UI (user interface) easily, the second requires script programming or the use of additional tools as spreadsheets to create a CSV file that can be imported into Fusion with ImportSplineCSV script.

 

If the point of view from the construction of mechanical components of the coil solves many problems, it also presents some limitations that are highlighted in the requests found in the Fusion 360 forum posts.


If we want to examine the possibility of using a helix from the point of view of the artistic design where less precision but higher versatility is required, the coil can be used only partially. The difficulties, as it is understood from the forum posts, are related to the fact that it is impossible to define an axis different from the linear one (despite the coil can be projected on a surface) and that a customized profile is impossible to define.

 

On the contrary, the analytical approach has the peculiarity to be very quickly processed, but it only solves the problems with a mathematical model which not everyone is familiar with. Moreover I could not find any solution except Patrick Rainsberry’s. @prainsberry has developed the Add-in HelixGenerator which builds a perfect helix with a linear axis.

 

This article attempts to follow an empirical approach to the topic and because I am a novice of Fusion API and Python programming, I have tried to cope with the programming using the basic elements that I know.

The purpose of this Add-in is to create a helix following a precise path from a 3D spline.

 

Empirical approach
The empirical approach proposed here solves many problems but has the side effects of being heavy from a computing point of view and this slows it down. My purpose for the development of the add-in was a learning one so that I could improve my mastery of the different functionalities of Fusion API.


Therefore I put little care to the efficiency of the software which may have bugs and can be further developed and improved.


Basic idea
The starting step of the construction of the helix is to choose a curve which represents its revolution axis.
Its length defines the helix dimension and the starting point of the curve defines the plane from which the helix starts. In the picture, I have chosen a linear axis for simplicity.

 

The software is based on the construction of successive planes built orthogonally to the axial path. This can be simply linear or can follow a spline.

3-Spline.pngThe number of planes depends on the number of points chosen to define one cycle of the helix.
4-Helix.png

The planes are built using the following code:
planeInput.setByDistanceOnPath( sketchCurveOne, offset )
planes.add( planeInput )

 

The offset parameter defines the distance of the plane from the origin of the path and equals 0 on the first plane and 1 on the plane corresponding to the last point of the helix.

 

On each plane I drew a sketch containing:
- a circle which has the same radius as the helix
- a line which origins from the revolution axis and gradually rotates as we go up from one plane to the next one.

 

The intersection of these two elements defines a series of points which, joined by a spline, build the 3D helix .

4-3D Helix.png

The number of points of each helix cycle is defined by the user and is fixed to 12 as a default value. According to this value each line, belonging to one plane, is rotated by 30° to the line of the previous plane.


The User Interface

Since the approach is, as I mentioned, a learning one, I did not take care of the user interface, which is therefore extremely simplified.

5-UI.png

The main fields are:
- the Select field which allows to select the curve of the helix axis
- the Division Number per helix cycle (that is the number of planes in a cycle)
- the helix Radius
- the Cycles Number that the helix must perform around the axis

 

In the further development of the add-in other functionalities had been added:
- the possibility for the helix to start from an angle different to 0
- the possibility to create an anticlockwise helix (the default being a clockwise)
- the possibility to keep building planes and the sketches which generate the helix

 

The latest feature was fundamental during the development and test phase of the add-in. It is important to keep it active if we want to use it to build further reference planes for more complex models.

 

Deleting the construction planes and the related sketches was done at first with for loops which scanned the elements of the construction. This method revealed time consuming.

 

This function was remarkably simplified with @liujac's helpful tips which define a sub-component to which all the sketches and construction planes are associated with during the construction phase. The deletion of the sub-component is immediate and the script is quickened (thank you liujac!).

 

I would also like to thank @ekinsb whose help allowed to manage the multiple selection of the axes so that more helixes could be built with the same command.

 

All this allows to obtain as complex models as our imagination can devise.

 

Simple examples
The functionalities implemented in the add-in have permitted to generate these simple examples:

 

A helix around an inclined axis in the space       |       A helix around a 3D spline (this was the main goal of the article)

7-Inclined Axis.png8-3D Spline.png


Two helixes oriented clockwise and anticlockwise    |    A helix around a helix

9-2 Helix.png10-HelixX2.png


A double helix around a spline which resembles the DNA double helix | Helixes with variable starting angles

11-Helix DNA double.png12-Helix with var.png

The helix can be used to build something more complex using the Loft function 

13-Horn.png

An elliptical toroid built inside the helix which is built around the toroid axis. The toroid was built from the starting and final helix construction sketches

using the Loft function. Note that the toroid is open!

14-Toroid.png 


A helicoidal ramp starting from sketches in succession for each helix cycle that are references profiles for Loft sequencing operations

15-Helicoidal.png
The add-in structure allows to make two vertically unaligned helixes which can be used as a path for a construction on a vertical plane, using Loft.

16-Add-in structure.png

Finally I tried to compare the helix which originates from the add-in, to a coil created with Fusion interface and it seems the two line up, except for an error which I am going to discuss later on.

17-Coil.png

Forum Discussions
When I started to write the code, my intention was to try and solve a problem paying little care about such issues as time or the community’s interest in the solution. My goal was to verify if my initial idea was feasible.

 

Then, after developing the main part of my project, I wondered if the problem had already been dealt with and possibly resolved.

My research was not successful until I found this little note from @TrippyLighting in the post: ‘coil along path or bend coil

Note: I had assumed you have a long coil with many windings and the windings are coiling along a curved path. That can actually be done, but it's a lot of manual work. It involves many construction planes along a path - the spline in your case. One sketch on each construction on plane and lastly one 3D spline which will be the path you'd extrude your spring wire along. It will then be a solid body. I personally would probably do this in Blender much, much quicker and then import the .obj and convert it into a T-Spline.

 

This is very similar to what I have tried to do! Thank you TrippyLighting.


Mistakes
Any development presents errors and some of them are evident in the script.
In the first and last part of the helix there is a gap from the circular path which needs correction.

20-Mistake.png

Another problem I have been unable to solve so far can be observed when the spline, the helix axis, is closed. The script cannot close the helix correctly and creates a disarranged helix. 

If solutions have already been found in the community, I welcome them.


Conclusion
Eventually my goal was reached (even with some additional mistakes which need correction). Now I can finish the model of the mechanical arm.


I hope that my experience will be useful for the community, despite the unresolved mistakes. All the suggestions, criticisms and proposals for further improvements are welcomed. I am willing to clarify any doubts about the script development which I have not discussed in detail here for space sake. It could be the topic for another research tutorial. I do welcome your comments and feedback.

21-CONCLUSION.png

All the proposed models are available to the community as well as the add-in code HERE

Thank you for your time! Please reach out to me in the comments section below or PM me at Autodesk Forums.

 

All the best, 
Dino Coglitore (aka @dinocoglitore)

 

Labels (2)
22 REPLIES 22
Message 2 of 23
passariello
in reply to: dinocoglitore

O_o

 

Really impressive.....

I hope to have your script directly in Fusion 360 in near future! ... we need this great stuff!

 

Best best!

 

PS: Dino, you are a great teacher a valid mentor!!!!!!!

 

Dario Passariello

Autodesk 3ds Max Master
Autodesk Certified Instructor
Autodesk Expert Elite
On LinkedIn
Message 3 of 23
Anonymous
in reply to: dinocoglitore

Dino, my dear, I think you are  a great teacher! The concept is simply brilliant.

Keep going!!!

Message 4 of 23
audaysami
in reply to: dinocoglitore

Great effort to cover the gap in the Helix command

Message 5 of 23
dinocoglitore
in reply to: audaysami

I thank you a lot. I wrote these articles just only to learn Python and the Fusion API. I am very happy that my work can be useful to someone. It is very strange that Fusion team did not resolve the gap that you talk about.

Thanks

Dino

Message 6 of 23
pauliust
in reply to: dinocoglitore

Hello,

I am trying to create a helix curve around a 3D spline. Somehow I am getting an error related to finding of the reference plane. Can you help me with this? Can you help me?

Helix_error.PNG

Message 7 of 23
dinocoglitore
in reply to: pauliust

Hi  remigijus2L9H6, I'm sorry for the delay. Can you tell me in more detail in which case the error happen ? Can you post a picture of the spline or can you screencast all the sequence that leads to the error ?

Thanks

Dino

Message 8 of 23
aelkommos46
in reply to: dinocoglitore

I would love to use your add-in if possible, however when i went to download it off of box, it was removed. any way you could upload it with a link?

Message 9 of 23
dinocoglitore
in reply to: aelkommos46

Hi aelkommos46, I don't know why Autodesk decided to remove the file from the link. I will try to send the script through a personal message.

Thanks

Dino

Message 10 of 23
jodom4
in reply to: dinocoglitore

Hey dinocoglitore,

Thanks again for this awesome post! We've discontinued use of Box as our cloud storage tool. You're welcome to send me a zipped folder and I can host them for you and give you a link for everyone's convenience. 


Jonathan Odom
Community Manager + Content Creator
Oregon, USA

Become an Autodesk Fusion Insider



Message 11 of 23
dinocoglitore
in reply to: jodom4

Hi jodom4, thank you very much for your message and for your availability. I am attaching the file rar containing the script for the generation of the Helix. Maybe someone finds it useful.

Many thanks

Tags (1)
Message 12 of 23

Some years have past since your post but I feel like I needed to add my input to your fantastic approach. I have recently been tasked with creating a variable helix that has an x amount of turns in a constant pitch that blends into a increasing variable pitch in x amount of turns along a given distance. I have worked out a solution I think in my head but was having some trouble putting it into practice. Like you, I opted to script the solution in python. I wouldn't consider the start and end sections of your helix (where it is a straight line) a mistake rather than 'room for improvement'. I too came across this behavior and one approach I thought of was to extend the start and end points by a bit and 'trim' the coil after it has been generated. The problem is that, you are using nurbs/splines and they rely heavily on control points. Since the start and end points terminate on a single point, there isn't a control 'line' that forces it to become tangent to anything since that reference is missing.

 

Message 13 of 23

Another option without a script is use sweep in the surface tab with a twist angle. It is mentioned later in the linked thread in the first post. After creating the surface just use its edge as a path for a pipe or sweep.

image.png

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Message 14 of 23

That probably won't work for him since he's trying to vary the number of turns on a gradient as he approaches one end.

Message 15 of 23


@laughingcreek wrote:

That probably won't work for him since he's trying to vary the number of turns on a gradient as he approaches one end.


Yes I know was being lazy. Just wanted to add the example to the thread for anyone else searching for help.

 

Mark

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Message 16 of 23

Hi erniepeters1, sorry for the delay with which I reply. Thank you very much for your message, for the compliments and for your contribution. I am well aware of the errors you are talking about when building Helix and I mentioned it in the article itself. Your solution to lengthen the propeller a few points seems to me correct and it is what I had thought of (but not made).

A couple of extra construction planes could be added beyond the start and end of the axis and cut the spline appropriately (as you suggest yourself).

 

As for the other part of the message, if I understand your problem well (my English leaves something to be desired) you would like to create a helix that has a variable pitch.

From a qualitative point of view, I faced the problem some time ago, but I was unable to publish an article on it. Here are some examples of the work done but not yet completed:

 

I should review the code already written to give you more explanations.

I hope it is useful for the continuation of your work.

Thank you

Dino

 

Message 17 of 23

Here are the examples I forgotten:

multiple_cycle_helix_profile.PNGammortizzatore_piani.PNGcono_crescente.PNG

You can find other examples in my Fusion gallery.

Thanks

Message 18 of 23

Hi @HughesTooling, thank you for the suggestion you gave to @erniepeters1.

Your solution is extremely fast, powerful and requires no programming effort. I would like to ask you if you have any memory of when it was introduced by the Fusion team in the surface tab.

 

I'd like to understand if the helix being constructed can have a variable shape or is always kept equidistant from the path defined by the spline.

 

I ask you if with the method you suggest you can also create something like this:

modulation v12.png4_helix_spline_outline v11.png

In this way I would avoid using the scripts that I developed and I would only use the Fusion interface.

Thank you

Dino

Message 19 of 23

@dinocoglitore  Not sure when t was introduced, by the way it is also available in the solid sweep as well.

 

You can use revolve, extrude, sweep etc. set to intersect to create something similar to your examples.

image.png

File's attached. Not there is a bug at the moment that means the profile and path curves need to be on different planes. So profile on XY and path on XZ.

image.png

Mark

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Message 20 of 23

Hi, thank you very much for your reply. I see that there is the possibility of solving the problems, that I have asked myself, also through the UI. I tried to solve them using Python and it was useful for understanding the API.

Many thanks.

Dino

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report