API to assign equation dimensions to spline points
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'll start out by saying that I am pretty much a noob at Fusion, and a complete noob at API and Python. Please be gentle...
In another thread, I was attempting to create a super-ellipse curve using User Parameters.
With the help of ChatGPT I was able to create an API to draw a full super-ellipse curve (simplified to 9 points) that was not fully parametric (it is drawn using parameters, but will not respond to parameter changes after it is drawn):
In order to make it fully parametric, I then went in and manually added dimensions with the equations as expressions to the points. I used construction lines as the distance reference , and I used coincident constraints where X=0 and Y = 0, rather than equations.
The sign issue (sign (-1) = 0) reared it's head when the equation should have resulted in a negative value (X in quadrant II and III, Y in quadrant III & IV). For those points, I used the corresponding positive dimension's name as the equation.
This curve is now fully parametric, in that I can change the shape and size of the curve using User Parameters a, b, & n. It produces a very rough approximation of a true super-ellipse curve. A more accurate representation of a super-ellipse curve would be possible if the number of spline points is increased, but for now I'm sticking with 9 points until all of the bugs are worked out.
Question #1 - is it possible to (and how do I ) use an equation for those dimensions where the sign formula currently doesn't produce a valid equation in Fusion? (In other words, what is the correct equation to use in these locations?)
Question #2 - how do I modify the API program to assign parameterized dimensions (equations) to these points?
Question #2.1 - should the approach be to assign dimensions after they are drawn as a separate API, or should the approach be to create the dimensions as part of the API that draws the curve.
Question #2.2 - Where can I find specific examples of successful implementations of assigning parameterized dimensions to spline points. Examples I have found so far all produce duplicate points, run errors, or sketches that are not fully parametric.
Any hints or suggestions as to how to make the API assign parameterized dimensions to the spline points is much appreciated.