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:

## Think Outside the Box: Create An Ellipse Model using Fusion & Python

3 REPLIES 3
Message 1 of 4
3508 Views, 3 Replies

## Think Outside the Box: Create An Ellipse Model using Fusion & Python

ORIGINAL INSPIRATION

In Palermo, Italy, I'm an active member of a Yoga Center. We decided to create an artistic panel to decorate one of the walls of the Center. Our tea room has many ellipse-shaped volumes.

So I designed a panel with the same pattern to propose to the Yoga group using Fusion 360. This is a draft I created with the Fusion User Interface:

It should be made up of a certain number of ellipses that are inside one another but tangent in two points and rotating at a certain angle. They should create an illusion of a spiral!

The idea is to build this panel with a laser printer to carve it into wood.

I liked the idea so much that I decided to write a script to make it into a precise form. I thought I would be simple work !

If you look at the picture carefully, you can see some errors due to the use of the Fusion User Interface. Can you spot them?

The ellipses do not touch each other (this can generate problems during the print phase). So I tried to solve these mistakes using some solutions through the script, trying to find the exact tangent points.

Rotated Ellipse

The construction of the whole panel derives from the building of a set of ellipses rotated and enlarged to become internal tangents to the previous ellipse. The tilt (ALPHA) of the ellipses depends on the number of ellipses that one wants to create in a cycle of 360°.

Therefore the first step was to implement a function using the Cartesian equation of an ellipse whose major axis is rotated of a certain angle to the Cartesian axes. In other words, it was necessary to use the mathematical equation to obtain the information needed for the construction of an ellipse inside the Python script with the method: sketchEllipses_var.add(centerPoint, majorAxisPoint, point).

Such method requires the center of the ellipse, the point which represents the major axis and a generic point of the ellipse (I chose the point connected to the minor axis). The rotated ellipse is built on a new sketch. The two ellipses have been named EL1 and EL2.

Almost tangent ellipse

What we want to realize now is the construction of an ellipse with the same tilt of the rotated ellipse EL2  but tangent to the previous ellipse EL1.

To find a solution from the mathematical point of view is rather difficult, so I tried to solve the problem using the computer graphics tools provided by the Fusion API and Python scripting.

As far as I know, building an ellipse concentric and tangent to EL1, starting from EL2, is not possible, because Fusion changes the direction of the axis and does not change its dimension. So it superimposes the two ellipses.

We need to maintain the axis of the ellipse fixed and enlarge its dimension until it becomes tangent to the original ellipse. All this has been developed using the Offset method of the Sketch Object, applied to the rotated ellipse EL2: sketch_var.offset(curves, directionPoint, offset).

The ellipses EL1 and EL2 intersect in 4 points. With a 'for cycle' and an offset operation we can extend the ellipse EL2 until there will be no more  points of intersection with EL1. In this way we build an ellipse that is an approximation of an ellipse tangent to EL1.

The problem seems to be solved! I just need to delete all the intermediate ellipses and leave only the last one and the game is done … but it is not so easy!

There are two more questions:

1. The outer ellipse (that I will call SFS1), created with subsequent offsets, is not really tangent to the ellipse EL1. It can be very near to EL1 (it depends on the step of the offset that I choose), but it is not actually tangent.
2. The curve, which looks like an ellipse and which is built with the offset operation, has the shape of an ellipse, but it is NOT a SketchEllipse: it is a SketchFittedSpline

SketchFittedSpline

The second observation, particularly, forced me to better analyze the curves that I created.

A SketchFittedSpline, which looks like an ellipse, doesn’t have the same features:

• It does not have axes
• It does not have vertices
• I cannot make it tangent to EL1 ellipse (!!!)

To create a curve tangent to EL1 ellipse I need to convert the SketchFittedSpline SFS1 to a SketchEllipses. This has been done extracting the main features of SFS1 so that I could use the sketchEllipses_var.add(centerPoint, majorAxisPoint, point) method.

In order to find the major axis vertex, I found the intersection of SFS1 with the ellipse axis. The other necessary point was found as an intersection of SPS1 with the X axis. In this way I can approximate the SFS1 with a SketchEllipse (EL3)

Tangent Ellipse

Now it's possible to make EL3 (defined with the variable real_ellipse in the script) perfectly tangent to the EL1 ellipse. To do so,first  I need to constrain EL3 to be concentric to EL1 with sketch2.geometricConstraints.addConcentric(real_ellipse, ellipse1) method, second I need to fix EL1  with ellipse1.isFixed = True and last I need to make EL3 tangent to EL1 with sketch2.geometricConstraints.addTangent(real_ellipse, ellipse1) method .

In the following picture, the constraints used to constrain EL3 to be concentric and tangent to EL1 are visible:

Panel Construction

The basic work is completed. Now I need to repeat the whole process in a loop so that the ellipse EL3 will become the new EL1, starting point for the next step. At the end I will have as many sketches as the created ellipses.

In each sketch there are two ellipses: the copy of the original ellipse (EL1), green colored because it is fixed, and the tangent ellipse EL3, built to the i-th step.

Selection and Extrusion

What is left is to create the panel selecting the profiles that I am interested in. I chose to select the external profiles for each ellipse, skipping one every other step.

The very last step is the extrusion of all the profiles with the desired thickness so that I can obtain the final result.I can act on the number of ellipses to obtain a denser or more transparent panel. The final effect is to obtain a couple of more or less detailed spirals. The spirals  that I have obtained are of a logarithm type.

I chose to create only one 360° cycle, but I could  implement the algorithm with more cycles obtaining more complex spirals.

Another choice has been to relate the major axis with the minor axis through the golden number 0.618. I can avoid using this relation making the first ellipse more distorted and elongated and unbalancing the relationship between the major and the minor axes. In this way I obtain a panel more elongated in a direction.

One of the examples has been rendered attributing the Mahogany-Glossy material:

3D Projection

At the moment, the model has only a small third dimension (almost 1 cm) because the panel has only a 2D pattern.

I also tried to project it in a 3D space to see other effects and here are a couple of examples.This last phase was not implemented inside the script since the original main goal was to create a decorative panel.

For the construction of the 3D models you can refer to the article I authored where you can see the extrusion and intersection with a solid of revolution created with a revolve operation applied to the geometry of a vertical sketch:

http://forums.autodesk.com/t5/autodeskhelp/using-fusion-360-with-python-how-to-create-the-seventh-ch...

These are the sketches with which I built the previous examples.

My name is Dino Coglitore. I am a teacher of ICT at a secondary technical school in Palermo (Sicily-Italy) - ITI Vittorio Emanuele III

I started working with Fusion some months ago. With the help of Dario Passariello of  Digital3D (Autodesk Academic Partner e Certified Instructor, Autodesk Expert Elite). I did the work of solid modelling. My passion for programming and graphics convinced me to use Python and the Fusion API to try and express my creativity.

Special Thanks

I want to thank @ekinsb and @yqliu who let me better understand the difference between SketchEllipse and SketchFittedSpline objects. One more thank you to @ekinsb who helped me to use the API to find the ellipses intersections.

A special thank you goes out to Claudia Di Stefano who is my 'translation advisor'. Thank you Claudia.

If you have questions or any doubt about the script development, please do not hesitate to contact me here on Autodesk Community ( @dinocoglitore )

I would be glad if my experience could be of any use for the community.

I would really appreciate any suggestions, criticisms, comments and proposals for further improvements.
The Python code and the proposed 3D models are available to anyone who might be interested. Please post a comment below and I will send the link to access the Python script code. You may also reach out to me directly.

All the best from Palermo. I look forward to your thoughts and comments!

Dino Coglitore

Tags (3)
Labels (1)
3 REPLIES 3
Message 2 of 4
in reply to: dinocoglitore

Works

Message 3 of 4
in reply to: dinocoglitore

Great insights in creating ellipses. Also I'm interested in scripting ellipses with Python could you share your code, it's hard to find coding examples.

Message 4 of 4
in reply to: dinocoglitore

Ellipses can be made tangent to each other now in Fusion 360, however the ratio between the major and minor axes may not be honored.

ETFrench

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