OK, I'll back to my original question with an example.
Problem
I have a surface in the form rho = f(phi,z) using a cylindrical co-ordinate systems as defined here :
https://en.wikipedia.org/wiki/Cylindric ... ate_system . I need to convert this into an IGES or STEP file so that I can import it into the meshing software ANSYS ICEM CFD.
Solution 1
As suggested by Chris_G. I generate a point cloud from my function f above in x,y and z co-ordinates. I can then import this into FreeCAD and use the approximate B-spline surface function in the reverse engineering toolbox.
To test this I have imported a point cloud which corresponds to a unit cylinder and half a unit cylinder in Cartesian space (in case there were any issues with the surface having to be closed). I have attached two figures which show the surfaces which is generated (Fig 1 and Fig 2). Neither of which achieves the desired result. This examples use 15 poles in each direction with cubic splines. I have tried using more poles but this does not improve the situation. Perhaps I need to make use of the option to specify the directions of u and v? The most sensible directions would be the z axis and the unit radial vector. Would it be possible in FreeCAD to specify a radial direction which is a function of the azimuthal angle (phi)?
Solution 2
I could create a B-spline surface in python, define this in FreeCAD and then export this surface to an IGES file.
My first thought on this is to define a spline surface as a function of f(phi,z) and then import into FreeCAD. I am using the following function from SciPy to create my B-splines (this is based on the methods and nomenclature of Dierckx ) :
https://docs.scipy.org/doc/scipy/refere ... pline.html
My knots and coefficients for a unit cylinder would be:
coefficients : [ 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
knots in the z direction [ 0., 0., 0., 0., 1., 1., 1., 1.]
knots in the array([ 0., 0., 0., 0., 360., 360., 360., 360.])) (when I import these into FreeCAD I normalised them to be zero and 1)
If I create a B-spline using these knots of course I get a xy plane (see Fig 3). Can FreeCAD work in cylindrical co-ordinates? As instead of a plane I need have a cylinder.
Alternatively, I can create a b-spline as z= g(x,y).
coefficients : [ -7.28486197e-16 3.06984542e-15 -2.57586262e-15 4.76655891e-16
2.40824265e-15 -1.05812646e-14 1.13357146e-14 -2.23686939e-15
-1.73698400e-15 8.62344871e-15 -1.21159909e-14 2.00040788e-15
6.70568863e-17 7.43619156e-16 1.30309124e-15 -1.22220084e-16]
knots in x direction [ 0., 0., 0., 0., 1., 1., 1., 1.]
knots in y direction [-0.99794539, -0.99794539, -0.99794539, -0.99794539, 1. , 1. , 1. , 1. ]
At which point my knowledge of B-splines breaks down, and my resultant surface looks like Fig.4 . Not a cylinder. Perhaps this method has some potential if I implement it correctly.