File: csg.py

package info (click to toggle)
netgen 6.2.2006%2Breally6.2.1905%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 10,552 kB
  • sloc: cpp: 137,165; tcl: 6,266; python: 876; sh: 411; makefile: 41
file content (41 lines) | stat: -rw-r--r-- 1,140 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from netgen.libngpy._csg import *
from netgen.libngpy._meshing import MeshingParameters
from netgen.libngpy._meshing import Pnt
from netgen.libngpy._meshing import Vec
from netgen.libngpy._meshing import Trafo


try:
    import libngpy.csgvis as csgvis
    from libngpy.csgvis import MouseMove
    CSGeometry.VS = csgvis.VS
    SetBackGroundColor = csgvis.SetBackGroundColor
    del csgvis

    def VS (obj):
        return obj.VS()

except:
    pass


def csg_meshing_func (geom, **args):
    if "mp" in args:
        return GenerateMesh (geom, args["mp"])
    else:
        return GenerateMesh (geom, MeshingParameters (**args))
#     return GenerateMesh (geom, MeshingParameters (**args))

CSGeometry.GenerateMesh = csg_meshing_func


unit_cube = CSGeometry()
p1 = Plane(Pnt(0,0,0),Vec(-1,0,0)).bc("back")
p2 = Plane(Pnt(1,1,1),Vec(1,0,0)).bc("front")
p3 = Plane(Pnt(0,0,0),Vec(0,-1,0)).bc("left")
p4 = Plane(Pnt(1,1,1),Vec(0,1,0)).bc("right")
p5 = Plane(Pnt(0,0,0),Vec(0,0,-1)).bc("bottom")
p6 = Plane(Pnt(1,1,1),Vec(0,0,1)).bc("top")
unit_cube.Add (p1*p2*p3*p4*p5*p6, col=(0,0,1))
# unit_cube.Add (OrthoBrick(Pnt(0,0,0), Pnt(1,1,1)))