[FEATURE REQUEST] Suggestion of integration (mathematicaly defined curves.)

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
fcaduser
Posts: 448
Joined: Wed Feb 19, 2014 6:53 pm
Location: Near Paris, France

[FEATURE REQUEST] Suggestion of integration (mathematicaly defined curves.)

Post by fcaduser »

Hi FC people.

I would like to submit a suggestion.
I think all the macros within section "Mathematical functions" :
https://www.freecadweb.org/wiki/Macros_recipes

... should be merged in one unique tool, having an interface like this (first screen shot) :
https://www.freecadweb.org/wiki/Macro_3 ... tric_Curve

And this tool could be called from :
menu Part -> Create primitives -> "Curve driven by equations" (or similar expression.)
This is the best place to fit it.

With this features :

Distinction between uniform cubic spline and interpolation of degree 1 (ie polyline = wireframe), chosen with a switch.
(I don't think it's a good thing to split curves of degree 1 or 3, and 2D or 3D, in separate tools.)

Give user the choice between :
Cartesian :
x(t), y(t), z(t)
Cylindrical :
r(t), alpha(t), z(t)
etc.

(and of course : t parameter range, t step, curve closed or not.)

Nota : I'm not a big fan of the second form (with a(t), b(a, t), ...) ; I would prefer a connection between this tool and a spreadsheet, if you want to introduce intermediate parameters, you just need to target three cells with valid mathematical f(t) expression.

And the curve yield would be fully editable.

I think this would be a very useful tool (I routinely need this). What do you think of this ?
Last edited by fcaduser on Fri Jun 05, 2020 2:01 pm, edited 1 time in total.
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: Suggestion of integration (mathematicaly defined curves.)

Post by TheMarkster »

I made some changes to the 3d parametric curve macro. You can now use it with a spreadsheet. The spreadsheet must have these aliases defined:

a_cell
b_cell
c_cell
X
Y
Z
min_t
max_t
interval

Select the spreadsheet you wish to use in the tree, then run the macro with the spreadsheet selected. The macro will detect that you have a spreadsheet selected and add a new button to itself "From sheet". Press the From sheet button to update the macro contents from the spreadsheet. You have to manually update via From sheet button or close the macro and run it again to update its fields.

I also added a stay on top option to keep the macro window on top of other windows. It can still be minimized and the stay on top option can be turned off with a checkbox.
Attachments
3dparamexample.FCStd
(1.57 KiB) Downloaded 39 times
3D_Parametric_Curve(v2).FCMacro
(8.9 KiB) Downloaded 61 times
fcaduser
Posts: 448
Joined: Wed Feb 19, 2014 6:53 pm
Location: Near Paris, France

Re: Suggestion of integration (mathematicaly defined curves.)

Post by fcaduser »

Thank you for this interesting extension.

The point I really like with using a spreadsheet is that user has a full control over how mathematical expressions are generated and he can do all intermediary steps he wants, even document parameters, etc. Whatever it's Cartesian, cylindrical, spherical, etc ; you only need to target three cells with valid f(t) expressions. Very flexible.

Generally speaking, I think a tool generating mathematical (interpolating) curve is far more than anecdotal. Thus my proposition for a future closer integration. I think the general guideline I've submitted is coherent, but I would be pleased to hear suggestions about.
fcaduser
Posts: 448
Joined: Wed Feb 19, 2014 6:53 pm
Location: Near Paris, France

Re: Suggestion of integration (mathematicaly defined curves.)

Post by fcaduser »

Document numérisé0.png
Document numérisé0.png (439.85 KiB) Viewed 800 times
Maybe a quick draft is better to explain what I'm suggesting.
I filled some fields to illustrate with examples.

The user ticks the CS he wants, graying others.

Idem, within the one chosen, the field are disabled or not, depending of he is directly setting the equations or targeting cells.
IMHO the interface should be minimal, if the user wants to do some intermediate "cooking" with mathematical expressions, it's better to relegate this into a spreadsheet, where he can have full latitude.

The choices about angles or dimensions for cylindrical, spherical CS may variate, it's a question of convention ; an explanatory sketch would disambiguate this.
fcaduser
Posts: 448
Joined: Wed Feb 19, 2014 6:53 pm
Location: Near Paris, France

Re: Suggestion of integration (mathematicaly defined curves.)

Post by fcaduser »

PS
"Adaptative" means curvature should be computed when it obviously massively varies throught the curve, thus a constant step is not adequate. (Should be placed closer to step.)
Post Reply