/src/contrib/geom-5.1.2.7/src/ExchangeVRML/ExchangeVRML_Export.cpp

http://pythonocc.googlecode.com/ · C++ · 58 lines · 30 code · 7 blank · 21 comment · 0 complexity · 0ad36b01bf4352c3a76a4d1a0e32dcec MD5 · raw file

  1. // This library is free software; you can redistribute it and/or
  2. // modify it under the terms of the GNU Lesser General Public
  3. // License as published by the Free Software Foundation; either
  4. // version 2.1 of the License.
  5. //
  6. // This library is distributed in the hope that it will be useful
  7. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9. // Lesser General Public License for more details.
  10. //
  11. // You should have received a copy of the GNU Lesser General Public
  12. // License along with this library; if not, write to the Free Software
  13. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  14. //
  15. // File: VrmlExport.cxx
  16. // Author: Sioutis Fotis
  17. #include "utilities.h"
  18. #include <VrmlAPI_Writer.hxx>
  19. #include <TCollection_AsciiString.hxx>
  20. #include <TopoDS_Shape.hxx>
  21. #ifdef WNT
  22. #define SALOME_WNT_EXPORT __declspec(dllexport)
  23. #else
  24. #define SALOME_WNT_EXPORT
  25. #endif
  26. //=============================================================================
  27. /*!
  28. *
  29. */
  30. //=============================================================================
  31. extern "C"
  32. {
  33. SALOME_WNT_EXPORT
  34. int Export(const TopoDS_Shape& theShape,
  35. const TCollection_AsciiString& theFileName,
  36. const TCollection_AsciiString& theFormatName)
  37. {
  38. MESSAGE("Export VRML into file " << theFileName.ToCString());
  39. try
  40. {
  41. VrmlAPI_Writer aWriter;
  42. aWriter.Write(theShape, theFileName.ToCString()) ;
  43. return 1;
  44. }
  45. catch(Standard_Failure)
  46. {
  47. Standard_Failure::Raise("Could not export in VRML format");
  48. }
  49. return 0;
  50. }
  51. }