I’m trying to create parameterized sketches in Fusion (Personal version) of various size/shaped super-ellipses (Lame curves).
The equations in question are:
where t(min) = 0 and t(max) = 2*pi, a is the major axis (overall X length/2) and b is the minor axis (overall Y length/2).
I want to create a project where I can use user defined variables to define a, b, n, t(min), t(max, and interval/# of data points to create different shapes and sizes of the super-ellipse curves for various components
I was able to do all of this in FreeCAD using an available plug-in/script, but I finally gave up on FreeCAD and migrated to Fusion (Personal).
Apparently there is no existing add-in for Fusion that can draw super-ellipse curves (reportedly there used to be one, but it is “no longer published”). I have been advised by users on the AutoDesk forum to create an API in Fusion.
Unfortunately my Fusion knowledge level is pretty low, and my Python programming knowledge is pretty much zero. The AutoDesk forum isn’t a warm and fuzzy place for newbies, so I haven’t had much success in getting much help there.
Is there anybody on this forum that is knowledgeable enough with Fusion, API and Python that could walk me through the process of creating and using a super-ellipse API to create sketches using a database of user defined variables (probably over PMs)?
Well I made some progress. Using a template from a user on the Autodesk forum as a starting point, I was able to create a sketch from t_00 through t_90 (with 5 degree increments) using the super-ellipse formulas for x and y. I then used the Mirror function to populate the other three quadrants.
I can modify the n parameter to create different shaped curves, and I can modify the a and b parameters to create different sizes of the curve.
This method, however, is fairly tedious, repetitive, and labor intensive. Each point, x and y position must be manually created in the parameters database, and then those positions must be individually assigned to each point using the sketch dimension tool.
Given that I need to re-create this type of curve about 8 or 9 times in the project (both as construction lines and as the inner and outer edges of several components, I need to find a way to duplicate these curves in various sizes in a more streamlined manner. I’m looking into API next,
With the help of ChatGPT, I was able to create an API that would draw a super-ellipse closed curve using the equations
t = 2 * math.pi * i / (num_points - 1) # Parametric step from 0 to 2π
x = a * math.copysign(1, math.cos(t)) * abs(math.cos(t))(2/n)
y = b * math.copysign(1, math.sin(t)) * abs(math.sin(t))(2/n)
This will allow me to control the shape and size of the curve as it is being drawn using User Parameters (a, b, n).
However, unlike FreeCAD, such curves drawn in Fusion are NOT parametric after they are drawn. In other words, while I could create a series of curves in FreeCAD and then edit the values of a, b and/or n to modify the finished model, the same functionality is not available in Fusion.
Whoulda thunk that FreeCAD is better at some things than a program that costs several thousand dollars per year to use?
The truth isn’t that simple. Most proprietary software is polish on the front and crap in the back. That’s because they get paid based on what customers see. Open source software is the opposite. Because people who volunteer their time (or accept way less pay) want the back to be good so they can work there. They don’t have as much incentive to make the front better.
There is also a background pull towards where the users are. I would guess a greater number of freecad users are writing plugins than fusion users. Open source attracts a lot more software developer minded people. In general, the number of users greatly increases the quality. Users will complain and push on things that developers can’t see. So a feature or project with a lot more users will have higher quality, regardless of price or business model.
This is exactly my experience with Fusion and FreeCAD. I initially found the User Interface and workflow on Fusion far easier to use, while FreeCAD’s UI and workflow was non-intuitive and frustrating. But when you dig into the depths while pursuing some obscure tasks like parametric control of spline points, FreeCAD has ways to do it (somewhat convoluted, but possible), while Fusion is just a hard no.
I’ve been thinking about ways to work around the limitation. I think that I may be able to create a series of User Parameters to create the various size curves that I need for my project, based on one fixed shape and overall size (a1, b1 for one component, a2, b2 for a smaller second component, etc., with the parameters linked to master a and b parameters). Then I will create a series of APIs, one for each component that use the different linked parameters.
If I want to change the master parameters after the components are created, I will have to go back in the time line and delete/re-create the sketches using the APIs with the updated parameters. Hopefully that won’t break too many items later in the time line.
I am now using Fusion (not that much anymore, actually, only for threads), Inventor (which I find to be really smooth for making 3D-Models, but it can’t, in the year 2024, do threads… that’s where the export to Fusion comes in Handy), OnShape (because all the cool kids use it, also, assemblies are soooo much easier in OnShape than in Inventor (Inventor looks like it was made by my Grandma), and for 2D stuff AutoCAD. On the iPad Shapr3D is incredible. It is build for the iPad and makes it a breeze to draw 3D stuff on the fly. (Disclaimer: I have the full versions for all of these because I am a teacher.)
What baffles me most is that Autodesk hasn’t managed to implement features that are useful in all of their programs. Want to draw a square that starts from the midpoint? Suck it, only Inventor can do it. Want to make a slot? Lol no say AutoCAD and Fusion. The list goes on. Really, really stupid.
Want to convert an STL? Use FreeCAD. Fusion is a joke. Inventor can’t really do it. OnShape lets you kinda work with it.