for example the given parameter are:
base layer distance : 2mm
minimum distance: 1mm
maximum distance: 3mm
smooth level: 5(how many upper and lower layer should be used for smoothing)

seems i need to find new list to be used as contour component Distance.
my try by far, using the fixed layer height at first,able to sort the furthest distance of contours which indicates where it can be applied: adaptive_layer_height.gh (13.0 KB)
any help appreciated.
thanks
edit: i am not think of using graph mapper for smoothing, let mathematically do the calculation not by mouse drag.

thanks for your script.
there is a few things about this script which may show i was unable to describe the challenge correctly at topic.

there is no min and maximum limit for height.

the layer height increase in step not by smooth curve

may i ask why you used average in those curvature?
honestly i am unable to figure the logic for the script for example why you not used “Divide Curve” point for Curvature component directly?

No, of course this script is not even close to what you required. I just thought this might be interesting, so I made the first thing that came to my mind, thinking it might be helpful. It is your job to make the script itself:D I am not even sure it is working properely, I have not tested it.
3. I divided contour curves of your shape, and evaluated curvature on each point. Because points are naturally in lists accordinly to each xy contour, average component works for each list, giving us average curvature for each shape slice.
I did not use points from divide curve because curvature component reqires uv point, which means point within the surface domain. To find it, one needs to use surface closest point first.

Now Define Min Max layer thickness, here 0.3 to 3 mm.
Define Min Max angle => 0° to 90°
I used a graph mapper to link Angle to Thickness, but it could be simple to do it by code, it is also possible to make a curve in Rhinoceros.

Then make some transformation in order to make an integral. Sort of Normalized layer thickness depending of the height. In X it is the height (62 mm), in Y it is a sort of normalized thickness.

Laurent,i knew that you will pull me out of the mud.
this was excellent.one term math college in just 40 component.many many thanks man.

i am so grateful for your effort.i think using curvature it will give the points of where the challenge starts and a Loop will be needed to evaluate new height each time which start from job-done-untill-here. or it could be solved in some component(function) that i am not familiar with.thanks again.

Hi
may i ask how i can emphasize decreasing layer height for high Angles?
furthest horizontal distance of layers is exponentially increase with Angles in the surface of base object.
something like this yellow layer is ideal:

else the extruded path will not touch bottom layer properly in print
graph mapper will affect all layer with proper overall distance.i tried changing graph mapper input range with power of two of Angles (remapped) but it has not such big impact.