reset
undo on

#{ r = 3e-3 }
#{ R = 1e-2 }
#{ d = PLATE_DIST }

create Cylinder height { d } radius { r } 
create sphere radius { R } 
subtract body 1 from body 2 keep 
delete Volume 2
webcut volume all with plane yplane offset 0 
delete Volume 4
delete Volume 5
webcut volume all with plane xplane offset 0 
delete Volume 6
delete Volume 7
webcut volume 3  with sheet extended from surface 28  
# imprint & merge to create unique volumes
imprint volume all 
merge volume all 

# mesh
#{ h_fine = 0.2e-3 }
#{ h_coarse = 3*h_fine }

volume all size { h_coarse }
volume 1  size { h_fine }
mesh volume 1
mesh volume all

# regions
block 1 add volume 1 
block 1 name "V_elec"
block 2 add volume 3 9 8 
block 2 name "V_air"
nodeset 1 add surface 31  
nodeset 1 name "S_top"
nodeset 2 add surface 29  
nodeset 2 name "S_bottom"
# export
export ansys cdb "capacitor.cdb"  overwrite 