Hi Cavendish, the updates to the geom and smesh modules including integration of the netgen mesher are not yet integrated in the official pythonocc distribution.
I created these updates based on the Salome sources for the FE preprocessor application I am developing (btw: very interesting to hear you are working on a similar project! What is the application area you are focusing on ? Are you planning a GUI-based Fe preprocessor? If so which application design are thinking of ? ) The updated smesh, geom sources (including wrappers) are available in the pythonocc git repository in the branch "mb/geom_smesh_updates": https://github.com/tpaviot/pythonocc/tree/mb/geom_smesh_updates It is planned to merge these updates into the main PythonOCC branch and thereby make the latest smesh and geom developments from the Salome project available to pythonocc (including the netgen mesher). Unfortunately due to time constraints (there are always too many things to do ...) this hasn't happen yet. You might consider to work with the files in the mb/geom_smesh_updates branch (I could assist you in setting it up so you can work on your project). Once "mb/geom_smesh_updates" is merged with the main branch you can then switch back to the official pythonocc distro for your developments. Please also note that the module MT ("MeshTools") is my adaption of the python smesh interface available in Salome (which will also be integrated into the official pythonocc distribution). Regards, Mark Am 09.04.2013 um 03:08 schrieb Cavendish McKay: > Hello, > > I'm trying to build a preprocessor for a FE calculation, and I'm running > into a bit of trouble with the mesh generation. Using the smesh module > in Salome, I could do something like this: > > tetra = smesh.Mesh(part, "Sqmesh") > algo1D = tetra.Segment() > algo1D.LocalLength(2.0) > algo2D = tetra.Triangle() > algo2D.MaxElementArea(5.0) > algo3d = tetra.Tetrahedron() > algo3D.MaxElementVolume(25.0) > ret = tetra.Compute() > > From the writeup at > http://www.pythonocc.org/resources/meshing/pythonocc-and-smesh/, it > looks like I ought to be able to do essentially the same thing in > pythonocc, but there seems to be a disconnect between the way the code > in the writeup access the mesh generator and its algorithms (i.e., > meshgen = MT.MeshGen(), etc.) and the module hierarchy present in my > version (0.6-alpha) of pythonocc. In particular, I can't find a module > called MT, and the SMESH module doesn't have all the same parts. > > By looking at the code in the examples directory, I've made a function > to generate a surface mesh for a compound object: > > def mesh_compound(comp): > meshgen = SMESH_Gen() > themesh = meshgen.CreateMesh(0,True) > an1DHypothesis = StdMeshers_Arithmetic1D(0,0,meshgen) > an1DHypothesis.SetLength(0.01, False) > an1DHypothesis.SetLength(1., True) > an1dAlgo = StdMeshers_Regular_1D(1,0,meshgen) > > a2dHypothesis = StdMeshers_QuadranglePreference(2,0,meshgen) > a2dAlgo = StdMeshers_Quadrangle_2D(3,0,meshgen) > > themesh.ShapeToMesh(comp) > # assign hypotheses > themesh.AddHypothesis(comp,0) > themesh.AddHypothesis(comp,1) > themesh.AddHypothesis(comp,2) > themesh.AddHypothesis(comp,3) > #compute > meshgen.Compute(themesh, themesh.GetShapeToMesh()) > return themesh > > My questions are these: > 1. Where is the Netgen mesher located? I can't find it in > OCC.StdMeshers or OCC.SMESH (or anywhere else I've looked, for that matter). > 2. There doesn't seem to be a StdMeshers_Triangle_2D. Is that correct? > 3. Am I missing something? I'd prefer to be able to use the > Salome-style syntax, as it is clearer to me, but I can't figure out how > to do so. > > Again, I'm using OCE version 0.12, pythonocc version 0.6dev, python > 2.7.2 on os X 10.8 > > Thanks, > Cavendish > > _______________________________________________ > Pythonocc-users mailing list > Pythonocc-users@gna.org > https://mail.gna.org/listinfo/pythonocc-users _______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users