# Rescaling a section of a ContourPlot3D

So I have the following 3D contour plot:

first = ContourPlot3D[
z Sin[Pi x] == -(( Sqrt[44 + y^2 ] - y) x^2 + y) Cos[Pi x], {x, 0,
1}, {y, -10, 10}, {z, -150, 150}, Axes -> False,
Contours -> Automatic, Boxed -> False,
Method -> {"Extrusion" -> .05}]


The goal is to generate a surface which I will 3D print. As you can see from the axis bounds it is extremely long in the z axis and short in the other two. When I load the surface into my 3d printing software I rescale the axis's so the surface fits nicely within a square. The problem that arises is that when I extrude the plot, it is very thin in the x-axis, see the attached photo. What I am looking to do is extrude evenly the surface relative to the image I attached and not the bounds I used in the contourplot3d code.

• When we set BoxRatios -> Automatic ,we can see that the surface is too narrow. Commented Mar 29, 2023 at 14:25

Rescale your function before applying ContourPlot3D

cont = z Sin[Pi x] + ((Sqrt[44 + y^2] - y) x^2 + y) Cos[Pi x] /.
{z ->150 dz, x -> (dx + 1)/2, y -> dy 10}
ContourPlot3D[ cont == 0, {dx, -1, 1}, {dy, -1 , 1 }, {dz, -1 , 1 },
Contours -> Automatic, Boxed -> False,Method -> {"Extrusion" -> .05} , Axes -> False]


• This worked perfectly, thanks so much! I'd upvote if I could Commented Mar 30, 2023 at 16:08

As noted by Ulrich rescaling the coordinates so that the ranges are similar in three directions fixes the issue.

It turns out re-scaling only the third coordinate (using ScalingFunctions) is sufficient:

ContourPlot3D[z Sin[Pi x] == -((Sqrt[44 + y^2] - y) x^2 + y) Cos[Pi x],
{x, 0, 1}, {y, -10, 10}, {z, -150, 150},
Axes -> False,
Contours -> Automatic, Boxed -> False,
Method -> {"Extrusion" -> .05},
ScalingFunctions -> {"Linear", "Linear",
{Rescale[#, {-150, 150}] &, Rescale[#, {0, 1}, {-150, 150}] &}}]