Salome HOME
Update presentations
[modules/med.git] / src / MEDCalc / cmp / MEDPresentationVectorField.cxx
index 48cc1371a5d8182ad1ece723dcd762064e297031..f8d94a5e8792e60e1095a116b3a6075b15af5fbe 100644 (file)
@@ -1,7 +1,25 @@
 #include "MEDPresentationVectorField.hxx"
-#include "MEDFactoryClient.hxx"
 
 void
 MEDPresentationVectorField::internalGeneratePipeline()
 {
+  PyGILState_STATE _gil_state = PyGILState_Ensure();
+
+  std::string cmd = std::string("import pvsimple as pvs;");
+  cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
+  cmd += std::string("__disp1 = pvs.Show(__obj1);");
+  cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
+  cmd += std::string("pvs.GetActiveViewOrCreate('RenderView').ResetCamera();");
+  cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
+  cmd += std::string("__disp1.SetRepresentationType('3D Glyphs');");
+
+  //std::cerr << "Python command:" << std::endl;
+  //std::cerr << cmd << std::endl;
+  PyRun_SimpleString(cmd.c_str());
+  // Retrieve Python object for internal storage:
+  PyObject * obj = getPythonObjectFromMain("__obj1");
+  PyObject * disp = getPythonObjectFromMain("__disp1");
+  pushInternal(obj, disp);
+
+  PyGILState_Release(_gil_state);
 }