not at the moment. My goal is to provide packages for linux (ubuntu/ arch) first.
I did not know this. So the latest freecad won’t work with python2.7 in windows?
As far as I know, there is no official pyside for python3.5 in windows… So maybe we will have to wait until pyside2 is working and freecad has ported to python3 and qt5…
In the lib packs Peterl94 has compiled python2.7 with VC12. This is where the version hassle that ickby was referring to comes from. All of the readily accessible compiled extensions are compiled with VC9 and hence don’t work with current Freecad. It should work with 0.16 x86 release FreeCAD as this was compiled with VC9.
NETGENPlugin_NETGEN_3D.cpp:(.text+0x2fb9): Nicht definierter Verweis auf `netgen::mparam'
NETGENPlugin_NETGEN_3D.cpp:(.text+0x3052): Nicht definierter Verweis auf `vtable for netgen::NgException'
NETGENPlugin_NETGEN_3D.cpp:(.text+0x333f): Nicht definierter Verweis auf `netgen::multithread'
NETGENPlugin_NETGEN_3D.cpp:(.text+0x33e3): Nicht definierter Verweis auf `netgen::NgException::~NgException()'
NETGENPlugin_NETGEN_3D.cpp:(.text+0x3408): Nicht definierter Verweis auf `netgen::NgException::~NgException()'
NETGENPlugin_NETGEN_3D.cpp:(.text+0x342c): Nicht definierter Verweis auf `netgen::multithread'
I think nglib has to be patched to support OCCT7/SMESH7. wmayer provides the patch for Netgen 5.1 here: http://forum.freecadweb.org/viewtopic.php?f=17&p=127000#p126997
I tried to compile the Netgen master branch on Win because it has similar changes but I was unsuccessful, and I’m back to trying with 5.1.
vejmarie also posted a patched branch that was successful on linux Netgen 5.3 I think. I’ll find the link.
cmake choose the wrong headers(system instead of conda). But now I see why you have switched to an older version of netgen .
anaconda/conda-bld/work/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cpp:478:90: error: invalid initialization of reference of type ‘std::shared_ptr<netgen::Mesh>&’ from expression of type ‘netgen::Mesh*’
err = netgen::OCCGenerateMesh(occgeom, ngMesh, netgen::mparam, startWith, endWith);
Had some time to work on conda builds again. It seems the smesh build is working now, but the compilation now stops at the fem-module.
This is the error:
In file included from ~/anaconda/conda-bld/._1473004468427/work/src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp:45:0:
~/anaconda/conda-bld/._1473004468427/work/src/3rdParty/salomesmesh/inc/NETGENPlugin_Mesher.hxx:40:19: fatal error: nglib.h: Datei oder Verzeichnis nicht gefunden
compilation terminated.
src/Mod/Fem/App/CMakeFiles/Fem.dir/build.make:426: die Regel für Ziel „src/Mod/Fem/App/CMakeFiles/Fem.dir/FemMeshShapeNetgenObject.cpp.o“ scheiterte
The nglib headers are in include/netgen/nglib/nglib.h. Is it necessary to tell cmake to include this directory for the fem wb?
But I can’t mesh with netgen. A mesh object is created, but nothing is displayed on the 3d-view. There is no error message or warning. Netgen does work outside of freecad (with setting NETGENDIR to the dir containing ng.tcl.) Any ideas what is missing?
Can anyone point me to the file (fem or Mesh) where the netgen-mesher is called.
My question is: mesh_ptr is used only to satisfy the function attributes. After this function call the mesh_ptr isn’t used any more. So it is deleted after the function call? And then the ngMesh is also deleted? Could this be the reason why no mesh is shown?
Is there a way to delete the shared_ptr without deleting the *pointer ?
You don’t delete a shared ptr, it gets deleted automatically when it goes out of scope (when you leave your function). The purpose of this shared ptr is Reference counting: when the Last one gets out of scope it deletes the internal Pointer.
This means the Mesh stays valid as long as netgen internally holds one of those shared ptr s. It don’t tjink it does from your Small Code slipped. Hence you need to Store the shared ptr somewhere to ensure that at least one of those survives the whole livetime it is needed.
The problem starts because netgen::OCCGenerateMesh has changed its interface where the second parameter is now a shared_ptr instead of Mesh*. This affects the code throughout the Netgen plugin of smesh.
Important to know when working with shared_ptr is that once it holds an object you must adjust the interface of functions to replace a Mesh* with shared_ptr too when it internally expects a shared_ptr because otherwise you confuse the reference counter and get a dangling pointer in the calling instance. But this will likely cause a crash and not an empty mesh.
Example:
class Mesh
{
public:
Mesh()
{
i=0;
}
~Mesh()
{
}
void func()
{
i++;
}
private:
int i;
};
void useMesh(Mesh* p)
{
std::shared_ptr<Mesh> u(p);
u->func();
} // <<== here the Test object will be destroyed
int main()
{
std::shared_ptr<Mesh> t(new Mesh);
Mesh*p = t.get();
useMesh(p);
Mesh*q = t.get(); // <<== t holds a dangling pointer now
q->func();
}
So, in the smesh netgen code there are a few classes that internally only has a Mesh* and this must also be replaced with a shared_ptr.
Last weekend I was also working to improve the Netgen cmake checks and therefore had to try netgen v6. I made the same experience that the mesh is empty and stumbled across the same issue as you. For testing purposes I added an “exit(0);” at this code bloc but FreeCAD didn’t terminate. So, this means the code part is never executed and there must be other reasons for the empty mesh.
A backtrace from creating a mesh with mesh-design workbench and netgen6:
#0 0x00007fff579f3b7b in netgen::OCCGenerateMesh (geom=..., mesh=..., mparam=..., perfstepsstart=1, perfstepsend=1)
from /home/lo/anaconda/envs/fc_2/lib/././libocc.so
#1 0x00007fff5de1dd17 in NETGENPlugin_Mesher::Compute (this=0x7fffffff9ee0) from /home/lo/anaconda/envs/fc_2/lib/./libNETGENPlugin.so
#2 0x00007fff5de52030 in NETGENPlugin_NETGEN_2D::Compute (this=0x2cbe1e0, aMesh=..., aShape=...)
from /home/lo/anaconda/envs/fc_2/lib/./libNETGENPlugin.so
#3 0x00007fff5d0c7d2e in SMESH_subMesh::ComputeStateEngine (this=0x2cbe6c0, event=1) from /home/lo/anaconda/envs/fc_2/lib/./libSMESH.so
#4 0x00007fff5cf68f96 in SMESH_Gen::Compute (this=0x2ccaa50, aMesh=..., aShape=..., aShapeOnly=false, anUpward=false, aDim=MeshDim_3D,
aShapesId=0x0) from /home/lo/anaconda/envs/fc_2/lib/./libSMESH.so
#5 0x00007fff5e10769a in MeshPart::Mesher::createMesh (this=0x7fffffffb1b0) from /home/lo/anaconda/envs/fc_2/lib/MeshPart.so
#6 0x00007fff5e0efd92 in MeshPart::Module::meshFromShape (this=0x2b6cc70, args=..., kwds=...) from /home/lo/anaconda/envs/fc_2/lib/MeshPart.so
#7 0x00007fff5e0f5a3f in Py::ExtensionModule<MeshPart::Module>::invoke_method_keyword (this=0x2b6cc70, method_def=0x2b6cee0, args=...,
keywords=...) from /home/lo/anaconda/envs/fc_2/lib/MeshPart.so
Seems the error is somewhere in the libocc.so from netgen.
any ideas how to debug the netgen stuff? I tried to place std::cout in the netgen plugin but nothing got printed. I also have build netgen in debug mode, but gdb doesn’t show anything related to netgen.
Looking at the smesh implementation the shared pointer holds a NULL. Is it a problem to set a member of a shared NULL pointer?
Of course. OCCGenerateMesh expects a pointer to an existing Mesh instance. If it’s a NULL pointer then trying to access a member variable causes a segmentation fault. So, the question is why in NETGENPlugin_Mesher::Compute() is the member “_ngMesh” NULL?