mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
py visualization
This commit is contained in:
parent
34b90d5254
commit
c1935691e2
@ -21,6 +21,7 @@ geom = CSGeometry()
|
||||
geom.Add (all)
|
||||
|
||||
|
||||
|
||||
vis = VS(geom)
|
||||
# vis.Draw()
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
from netgen.csg import *
|
||||
import netgen.meshing as meshing
|
||||
import libvisual
|
||||
|
||||
from OpenGL.GL import *
|
||||
from OpenGL.GLU import *
|
||||
@ -9,18 +10,22 @@ from OpenGL.GLUT import *
|
||||
|
||||
sp1 = Sphere (Pnt(0,0,0), 0.2)
|
||||
sp2 = Sphere (Pnt(0.5,0,0), 0.2)
|
||||
sp3 = Sphere (Pnt(0,0,0.5), 0.2)
|
||||
sp4 = Sphere (Pnt(0,0.2,0.7), 0.2)
|
||||
sp5 = Sphere (Pnt(0,0,0.3), 0.2)
|
||||
|
||||
|
||||
all = sp1+sp2+sp3+sp4+sp5
|
||||
all = sp1+sp2
|
||||
|
||||
|
||||
geom = CSGeometry()
|
||||
geom.Add (all)
|
||||
|
||||
|
||||
param = meshing.MeshingParameters()
|
||||
param.maxh = 0.1
|
||||
m1 = GenerateMesh (geom, param)
|
||||
|
||||
|
||||
|
||||
vismesh = libvisual.meshvis.VS(m1)
|
||||
|
||||
vis = VS(geom)
|
||||
# vis.Draw()
|
||||
|
||||
@ -44,7 +49,8 @@ def myMotionHandler( x, y ):
|
||||
MouseMove(vis,xold,yold, x,y, mode) # 'm','z'
|
||||
xold = x
|
||||
yold = y
|
||||
mydraw()
|
||||
glutPostRedisplay()
|
||||
# mydraw()
|
||||
|
||||
def myPassiveMotionHandler( x, y ):
|
||||
global xold, yold
|
||||
@ -90,6 +96,16 @@ glMatrixMode(GL_MODELVIEW);
|
||||
glutMainLoop()
|
||||
|
||||
|
||||
# import threading
|
||||
# threading.start_new_thread (glutMainLoop, [])
|
||||
|
||||
|
||||
# from threading import Thread
|
||||
# thread = Thread(target = glutMainLoop)
|
||||
# thread.start()
|
||||
# thread.join()
|
||||
|
||||
|
||||
|
||||
# param = meshing.MeshingParameters(maxh=0.2)
|
||||
# mesh = GenerateMesh (geom, param)
|
||||
|
@ -2,7 +2,8 @@ from netgen import __platform
|
||||
if __platform.startswith('linux') or __platform.startswith('darwin'):
|
||||
# Linux or Mac OS X
|
||||
from libcsg.csg import *
|
||||
from libcsgvis.csgvis import *
|
||||
import libcsgvis.csgvis as csgvis
|
||||
from libcsgvis.csgvis import MouseMove
|
||||
import libmesh.meshing
|
||||
# from libmesh.meshing import *
|
||||
if __platform.startswith('win'):
|
||||
@ -10,3 +11,13 @@ if __platform.startswith('win'):
|
||||
from nglib.csg import *
|
||||
from nglib.csgvis import *
|
||||
from nglib.meshing import *
|
||||
|
||||
|
||||
|
||||
|
||||
CSGeometry.VS = csgvis.VS
|
||||
del csgvis
|
||||
|
||||
def VS (obj):
|
||||
return obj.VS()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user