netgen/py_tutorials/csg_first_example.py
Joachim Schoeberl 01197e7739 py - tutorials
2014-10-01 13:52:58 +00:00

25 lines
400 B
Python

import sys
sys.path.append("/opt/netgen/lib")
from libcsg.csg import *
from libmesh.meshing import *
sp1 = Sphere (Point3d(1,0,0), 1)
sp2 = Sphere (Point3d(2,0,0), 1)
both = Or(sp1, sp2)
all = And (both, OrthoBrick ( Point3d(0,0,0), Point3d (3,0.5,1)))
geom = CSGeometry()
geom.Add (all)
param = MeshingParameters()
param.maxh = 0.2
mesh = GenerateMesh (geom, param)
mesh.Save ("test.vol")