I tried the code below, first.
import os.path
import webbrowser
from netgen.occ import *
from netgen.webgui import Draw
from ngsolve.webgui import WebGLScene
sp = Sphere( (0,0,0), 1)
gtr = gp_GTrsf( (1,0,0, 0,1,0, 0,0,2), (0,0,0))
ell = gtr (sp)
WebGLScene(mesh).GenerateHTML(filename="ell.html")
Draw (ell, filename="ell.html")
webbrowser.open("file://" + os.path.abspath("ell.html"))
However, error message was popped up. In this case, “mesh” was not defined yet.
My operating system is Windows 11 and I use Jupyter notebook via Visual Code.
While waiting the reply, I was finding out how to do what I wanted.
Here are the code currently I compromised. I use “Netgen GUI”.
Inside of Interactive mode(webgui) in Visual Code, I cannot specify what I want easily.
By introducing “clear_output” command, after generating the microstructure, the result will not be shown in the interactive mode and I will be able to see the result via Netgen GUI window.
from netgen.csg import *
from ngsolve.webgui import Draw
from IPython.display import clear_output
import netgen.gui
geo = CSGeometry()
# Sphere(CenterPoint, Radius)
sphere1 = Sphere(Pnt(0,0,0),0.5)
sphere2 = Sphere(Pnt(1,1,1),1)
# "maxh" arguments specifies the desired maximal global mesh-size.
geo.Add(sphere1,maxh=0.2)
geo.Add(sphere2,maxh=0.2)
ngmesh = geo.GenerateMesh(maxh=2)
# for visualization we need a NGSolve mesh
from ngsolve import Mesh
Draw(Mesh(ngmesh))
clear_output()
I have another question.
gp_GTrsf( (1,0,0, 0,1,0, 0,0,2), (0,0,0))
Inside of gp_GTrsf, what does mean (1,0,0, 0,1,0, 0,0,2) and (0,0,0)?
Even in the document about “gp_Gtrsf Class Reference”, I cannot understand easily what it means.