- Thank you received: 101
Set Meshing Options with Python?
- christopher
- Offline
- Administrator
Less
More
4 years 1 week ago #3326
by christopher
Replied by christopher on topic Set Meshing Options with Python?
first step = perfstepsstart
last step = perfstepsend
in python
and you can set the message level with
ngsolve.ngsglobals.msg_level = 0
Best
Christopher
last step = perfstepsend
in python
and you can set the message level with
ngsolve.ngsglobals.msg_level = 0
Best
Christopher
4 years 1 week ago #3327
by mariopa
Replied by mariopa on topic Set Meshing Options with Python?
thx very much!
i will try as soon as possible...
i will try as soon as possible...
3 years 11 months ago #3423
by mariopa
Replied by mariopa on topic Set Meshing Options with Python?
Hello,
I just tried the following python script:
from netgen.occ import *
geo = OCCGeometry("//STI01/STIWA/mail/ParM/ng/projects/parm/abc/Schuettblech.stp")
mesh = geo.GenerateMesh(meshsize.very_coarse, perfstepsstart=MESHCONST_ANALYSE, perfstepsend=MESHCONST_OPTSURFACE, curvaturesafety=5)
Draw(Mesh(mesh))
mesh.Export("//.................stl", 'STL Format')
does not work --> 'MESHCONST_ANALYSE' is not defined
what I did wrong?
(should) load python file '\\STI01\STIWA\mail\ParM\ng\projects\parm\abc\tmp.py'
Traceback (most recent call last):
File "<string>", line 2, in <module>
FileNotFoundError: [WinError 3] Das System kann den angegebenen Pfad nicht finden: 'C:\\STI01\\STIWA\\mail\\ParM\ng\\projects'
Number of colours in STEP File: 1
Colour [1] = LIGHTBLUE3 : (0.654902,0.760784,0.788235)
Highest entry in topology hierarchy:
1 solid(s)
Traceback (most recent call last):
File "<string>", line 3, in <module>
NameError: name 'MESHCONST_ANALYSE' is not defined
Finished executing \\....................py
Preparing visualization (deflection = 0.01) ... done
I just tried the following python script:
from netgen.occ import *
geo = OCCGeometry("//STI01/STIWA/mail/ParM/ng/projects/parm/abc/Schuettblech.stp")
mesh = geo.GenerateMesh(meshsize.very_coarse, perfstepsstart=MESHCONST_ANALYSE, perfstepsend=MESHCONST_OPTSURFACE, curvaturesafety=5)
Draw(Mesh(mesh))
mesh.Export("//.................stl", 'STL Format')
does not work --> 'MESHCONST_ANALYSE' is not defined
what I did wrong?
(should) load python file '\\STI01\STIWA\mail\ParM\ng\projects\parm\abc\tmp.py'
Traceback (most recent call last):
File "<string>", line 2, in <module>
FileNotFoundError: [WinError 3] Das System kann den angegebenen Pfad nicht finden: 'C:\\STI01\\STIWA\\mail\\ParM\ng\\projects'
Number of colours in STEP File: 1
Colour [1] = LIGHTBLUE3 : (0.654902,0.760784,0.788235)
Highest entry in topology hierarchy:
1 solid(s)
Traceback (most recent call last):
File "<string>", line 3, in <module>
NameError: name 'MESHCONST_ANALYSE' is not defined
Finished executing \\....................py
Preparing visualization (deflection = 0.01) ... done
3 years 11 months ago #3424
by cwinters
Replied by cwinters on topic Set Meshing Options with Python?
Hi,
having a look at the code, I found a python enum "MeshingStep":
So just use
to generate the mesh.
Best,
Christoph
having a look at the code, I found a python enum "MeshingStep":
Code:
py::enum_<MESHING_STEP>(m,"MeshingStep")
.value("ANALYSE", MESHCONST_ANALYSE)
.value("MESHEDGES", MESHCONST_MESHEDGES)
.value("MESHSURFACE", MESHCONST_OPTSURFACE)
.value("MESHVOLUME", MESHCONST_OPTVOLUME)
;
So just use
Code:
from netgen.meshing import MeshingStep
mesh = geo.GenerateMesh(meshsize.very_coarse, perfstepsstart=MeshingStep.ANALYSE, perfstepsend=MeshingStep.MESHSURFACE, curvaturesafety=5)
Best,
Christoph
3 years 11 months ago #3425
by mariopa
Replied by mariopa on topic Set Meshing Options with Python?
thanks very much!
and is there a enum for MESHCONST_OPTSURFACE and MESHCONST_OPTVOLUME too?
regards, mario
and is there a enum for MESHCONST_OPTSURFACE and MESHCONST_OPTVOLUME too?
regards, mario
3 years 11 months ago #3426
by cwinters
Replied by cwinters on topic Set Meshing Options with Python?
The enum "MeshingStep" contains all these options (ANALYSE, MESHEDGES, MESHSURFACE, MESHVOLUME). I copied the export to python in my last post.
Time to create page: 0.106 seconds