# How to create 3D shape via a math function?

*How to create 3D shape via a math function?*was created by

*steve714*

The equation is in 2D, and it needs to be set up along the x and z axis, then rotated symmetrically around the z-axis in the x-y plane to create the 3D image. The result would look like a sombrero hat.

It may be possible to create the 3D image in another program like MathCad, but how could I get it into AXiS (or PythonVCP)?

Please Log in or Create an account to join the conversation.

*BigJohnT*on topic

*Re:How to create 3D shape via a math function?*

Inkscape has a plug in to create g-code do a search on the forum for it... it might do what you want.

John

Please Log in or Create an account to join the conversation.

*steve714*on topic

*Re:How to create 3D shape via a math function?*

Steve

Please Log in or Create an account to join the conversation.

*andypugh*on topic

*Re:How to create 3D shape via a math function?*

**steve714 wrote:**

I wish to machine a math sculpture in 3d, for example, a sinc function [z=(sin(x)/(x)].

The equation is in 2D, and it needs to be set up along the x and z axis, then rotated symmetrically around the z-axis in the x-y plane to create the 3D image. The result would look like a sombrero hat.

With a milling machine, and centred at (0,0)

#1 = 0.01

O100 while [#1 LT 1800]

G0 Z1

G0 X[#1 / 400]

G1 F1 Z[SIN[#1]/#1]

G3 F1 I0 J0

#1 = [#1 + 5]

O100 ENDWHILE

M2

(Never underestimate the power of raw G-code)

Please Log in or Create an account to join the conversation.

*steve714*on topic

*Re:How to create 3D shape via a math function?*

It took awhile to try your code, but I could not get AXIS to stop complaining about the G3 line of code.

I also tried G3 F12 X0 Y0 I0 J0 which generated a new set of errors. Other attempts at displaying the toolpaths in NCPlot, CamBamFree and Discriminator did not succeed either.

Still a GCODE newbie, but having fun trying! Steve

Please Log in or Create an account to join the conversation.

*BigJohnT*on topic

*Re:How to create 3D shape via a math function?*

John

Please Log in or Create an account to join the conversation.

*Rick G*on topic

*Re:How to create 3D shape via a math function?*

#1 = 0.01

;O100 while [#1 LT 1800]

O100 while [#1 LT 180]

G0 Z1

G0 X[#1 / 400]

G1 F100 Z[SIN[#1]/#1]

;G3 F100 I0 J0

G3 F100 I0.5 J0.5

#1 = [#1 + 5]

O100 ENDWHILE

M2

Please Log in or Create an account to join the conversation.

*dgarrett*on topic

*Re:How to create 3D shape via a math function?*

Please Log in or Create an account to join the conversation.

*andypugh*on topic

*Re:How to create 3D shape via a math function?*

**steve714 wrote:**

I should have pointed out that it was untested code, written off the top of my head, with no access to a CNC machine at the time.It took awhile to try your code, but I could not get AXIS to stop complaining about the G3 line of code.

The problem is that I forgot that IJ format arcs are incremental by default. The code I showed will work if you put G90.1 at the beginning. Alternatively make the G3 line say

G3 F1 I [#1 / -400]

Please Log in or Create an account to join the conversation.

*Rick G*on topic

*Re:How to create 3D shape via a math function?*

That looks cool. I may just have to add that to my machine!

Rick G

Please Log in or Create an account to join the conversation.