I am trying to generate a mesh on half of a torus. I generate the whole torus as a rotational object by following rotational symmetric object.
Then I perform the boolean operation to obtain half of the object, as introduced in half sphere.
Then I encounter the problem. The generated geometry only contains the rotation of the first (maybe) piece of splines. What I want is half of the torus. What am I doing wrong below?
Thanks for your help.
Jiashun
from ngsolve import *
import netgen.gui
from netgen.csg import *
spline = SplineCurve2d() # create a 2d spline
R = 1 # define the major radius
r = 0.2 # define the minor radius
eps = r*1e-2
pnts = [ (0,R-r), (-r+eps,R-r+eps), (-r,R),
(-r+eps,R+r-eps), (0,R+r), (r-eps,R+r-eps), (r,R), (r-eps,R-r+eps) ]
# define the splines using the control points
segs = [ (0,1,2), (2,3,4), (4,5,6), (6,7,0) ]
# add the points and segments to the spline
for pnt in pnts:
spline.AddPoint (*pnt)
for seg in segs:
spline.AddSegment (*seg)
rev = Revolution ( Pnt(-1,0,0), Pnt(1,0,0), spline)
bot = Plane(Pnt(0,0,0), Vec(0,1,0))
finitesphere = rev * bot
geo = CSGeometry()
geo.AddSurface(rev, finitesphere.bc("surface"))
geo.NameEdge(rev, bot, "bottom")
Draw(geo)