Surface define by functions to G-code without a mesh

Post Reply
jsryork
Posts: 6
Joined: 12 Nov 2016, 16:01

Surface define by functions to G-code without a mesh

Post by jsryork »

Hello
A month ago I got my Kossel XL kit built and working, and I am having great fun with it. I am designing in OpenSCAD and using KISSlicer (both excellent) for creating G-code.
I am a mathematician by training, but have always worked (up till retirement) with computers.
I am visualising a lot of 3d objects I would like to print. Many if them I think of as surfaces defined by functions, like a twisted prism vase with the scaling and twist varying with Z. For each Z-value there will be a function or algorithm which defines (x,y) in terms of another parameter, typically rotational angle about the Z-axis (assuming radii only cut the surface once).
The steps I am using now are to convert my OpenSCAD to STL (a surface defined by meshes of triangles), and then slice the STL by Z-value to generate G-code (x,y) moves at a specific Z, along with loops, infill, support and printer control.
Is there another route which avoids the time-consuming and potentially inaccurate conversion to a mesh and STL. Is there some slicer which would skip the STL read, and instead give me hook to allow me to provide, for any Z-value, a series of straight lines ( and possibly circular arcs) for the surface section, and then produce the G-code directly. I would still need the loops/infill generated, but for most cases support would nit be needed.
I hope this makes sense - sorry if this is not the right forum/topic to post under.
Best wishes
John
jsryork
Posts: 6
Joined: 12 Nov 2016, 16:01

Re: Surface define by functions to G-code without a mesh

Post by jsryork »

Or can anyone suggest another forum which I can ask ?
Thanks
John
brasshopper
Posts: 7
Joined: 11 Apr 2017, 21:10

Re: Surface define by functions to G-code without a mesh

Post by brasshopper »

Well, one possibility is that Mathematica can work directly from a formula to a surface plot to an STL file.

This code generates an stl file that produces a 3D model of a hyperbolic paraboloid. If you purchase a Raspberry Pi to run octoprint, say, you can get a free licensed copy of Mathematica. This is from https://math.okstate.edu/people/segerma ... sation.pdf

Code: Select all

f [ u_, v_] := {u , v , u^2 − v ^ 2 };
scale = 4 0;
radius = 0.75 ;
numPoints = 24;
gridSteps = 10;
curvesU = Table [scale∗f[u,i],{i,−1,1, 2/gridSteps}] ;
curvesV = Table [scale∗f[j,v],{j,−1,1,2/gridSteps}] ;
tubesU = ParametricPlot3D [ curvesU , {u , −1, 1 } , PlotStyle −> Tube [radius , PlotPoints −> numPoints ] , PlotRange −> All ] ;
tubesV = ParametricPlot3D [ curvesV , {v , −1, 1 } , PlotStyle −> Tube [radius, PlotPoints −> numPoints ] , PlotRange −> All ] ;
corners = Graphics3D [ Table [ Sphere [scalef[i,j ], radius], { i, −1, 1,2}, { j,−1,1,2 } ] , PlotPoints −> numPoints ] ;
output = Show[ tubesU , tubesV , corners]
Export [ "MathematicaParametricSurface.stl" , output ]
The problem would be that you would still need a slicer to do the conversion from the model to the physics of the printer - if a slicer could take your mathematical formula and convert it to gcode it would need to arrive at a physical representation to slice - somehow. All you would be doing is hiding the hat.
Post Reply