Hi, everyone! As a newer to the macro script, I want to export the 3D color surface as .obj file. Although the script can give the 3D view as manual operation step-by-step, no file is saved. And there is no error in the console. The code is listed as follows:

I’m not familiar with the “3D color surface” plugin but I can comment on saving as .obj:

There is another simple way to save a binary image as .obj mesh: Activate the image, then choose: File > Save As > Wavefront .OBJ.
You can select the downscampling factor, and a threshold for binarization (relevant if your image is not binary, if it is a label image, choose a number smaller than your smallest label id, e.g. 0.5). This plugin is also macro-recordable.

Note that different labelled objects get merged into one .obj file. So if you want the meshes of different regions separately you would have to export each label-region separately. I don’t whether the .obj exporter in the 3D viewer handles this differently.