]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Boolean operations created
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 3 Sep 2014 15:02:10 +0000 (19:02 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 3 Sep 2014 15:02:10 +0000 (19:02 +0400)
17 files changed:
src/Config/CMakeLists.txt
src/Config/Config_PropManager.h
src/Events/Events_Loop.cpp
src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp
src/FeaturesPlugin/FeaturesPlugin_Boolean.h
src/FeaturesPlugin/boolean_widget.xml
src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h
src/ModelAPI/ModelAPI_Feature.cpp
src/ModuleBase/ModuleBase_WidgetChoice.cpp
src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/ModuleBase/ModuleBase_WidgetFactory.h
src/ModuleBase/ModuleBase_WidgetFeature.cpp
src/ModuleBase/ModuleBase_WidgetPoint2D.cpp
src/ModuleBase/ModuleBase_WidgetSelector.cpp
src/ModuleBase/ModuleBase_WidgetSelector.h
src/XGUI/XGUI_ViewWindow.cpp

index 1b52cfbb8ab2741236d9036c9ac6fd669beea995..c40289ab9d8771a709549f4605837543c214b12c 100644 (file)
@@ -43,7 +43,9 @@ SET(PROJECT_LIBRARIES
 
 SOURCE_GROUP ("Resource Files" FILES ${XML_RESOURCES})
 
-ADD_DEFINITIONS(-DCONFIG_EXPORTS)
+ADD_DEFINITIONS(-DCONFIG_EXPORTS -D_SCL_SECURE_NO_WARNINGS) 
+# -D_SCL_SECURE_NO_WARNINGS - to disable warnings 4996
+
 ADD_LIBRARY(Config SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES})
 
 TARGET_LINK_LIBRARIES(Config ${PROJECT_LIBRARIES})
index 8f36c3500fadc1939c216d02895b8b3e372de9d6..eae15b1c38a782adae285a479aa6894fc6aea024 100644 (file)
@@ -13,7 +13,7 @@
 #include <vector>
 
 //! Class wihich let to register properties
-class CONFIG_EXPORT Config_PropManager
+class Config_PropManager
 {
  public:
 
@@ -26,32 +26,32 @@ class CONFIG_EXPORT Config_PropManager
    * \param theValue - initial value of the property
    * Returns True if the property succesfully registered
    */
-  static bool registerProp(const std::string& theSection, const std::string& theName,
+  CONFIG_EXPORT static bool registerProp(const std::string& theSection, const std::string& theName,
                            const std::string& theTitle, Config_Prop::PropType theType,
                            const std::string& theValue);
 
-  static Config_Prop* findProp(const std::string& theSection, const std::string& theName);
+  CONFIG_EXPORT static Config_Prop* findProp(const std::string& theSection, const std::string& theName);
 
-  static Config_Properties getProperties();
+  CONFIG_EXPORT static Config_Properties getProperties();
 
   //! Returns list of registered section names.
-  static std::list<std::string> getSections();
+  CONFIG_EXPORT static std::list<std::string> getSections();
 
   //! Returns list of properties by its owner and section.
-  static Config_Properties getProperties(const std::string& theSection);
+  CONFIG_EXPORT static Config_Properties getProperties(const std::string& theSection);
 
   //! Returns value of the property by its owner, section, and name
-  static std::string string(const std::string& theSection, const std::string& theName,
+  CONFIG_EXPORT static std::string string(const std::string& theSection, const std::string& theName,
                             const std::string& theDefault);
-  static std::vector<int> color(const std::string& theSection, const std::string& theName,
+  CONFIG_EXPORT static std::vector<int> color(const std::string& theSection, const std::string& theName,
                                 const std::string& theDefault);
-  static int integer(const std::string& theSection, const std::string& theName,
+  CONFIG_EXPORT static int integer(const std::string& theSection, const std::string& theName,
                      const std::string& theDefault);
-  static double real(const std::string& theSection, const std::string& theName,
+  CONFIG_EXPORT static double real(const std::string& theSection, const std::string& theName,
                      const std::string& theDefault);
 
  private:
-  static Config_Properties myProps;
+  CONFIG_EXPORT static Config_Properties myProps;
 };
 
 #endif
index c8cf0e86e8874d5c71ce14fa4b1094f80c44046c..80f48ef48a0004cfdf509664fb779e36b22439d4 100644 (file)
@@ -25,7 +25,11 @@ Events_ID Events_Loop::eventByName(const char* theName)
   string aName(theName);
   map<string, char*>::iterator aFound = CREATED_EVENTS.find(aName);
   if (aFound == CREATED_EVENTS.end()) {  //not created yet
+#ifdef WIN32
+    aResult = _strdup(theName);  // copy to make unique internal pointer
+#else
     aResult = strdup(theName);  // copy to make unique internal pointer
+#endif
     CREATED_EVENTS[aName] = aResult;
   } else
     aResult = aFound->second;
index 220b4144c6e05edfdfe87eb12124309be7ea5e4f..3161b31c22e9cd1978659f88834d512b6ce8dc9c 100644 (file)
@@ -7,6 +7,7 @@
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Document.h>
 #include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_ResultBody.h>
 #include <GeomAlgoAPI_Boolean.h>
 
@@ -18,7 +19,7 @@ FeaturesPlugin_Boolean::FeaturesPlugin_Boolean()
 
 void FeaturesPlugin_Boolean::initAttributes()
 {
-  data()->addAttribute(FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeReference::type());
+  data()->addAttribute(FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeInteger::type());
   data()->addAttribute(FeaturesPlugin_Boolean::OBJECT_ID(), ModelAPI_AttributeReference::type());
   data()->addAttribute(FeaturesPlugin_Boolean::TOOL_ID(), ModelAPI_AttributeReference::type());
 }
@@ -39,6 +40,12 @@ boost::shared_ptr<GeomAPI_Shape> FeaturesPlugin_Boolean::getShape(const std::str
 
 void FeaturesPlugin_Boolean::execute()
 {
+  boost::shared_ptr<ModelAPI_AttributeInteger> aTypeAttr = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeInteger>(data()->attribute(FeaturesPlugin_Boolean::TYPE_ID()));
+  if (!aTypeAttr)
+    return;
+  int aType = aTypeAttr->value();
+
   boost::shared_ptr<GeomAPI_Shape> aObject = this->getShape(FeaturesPlugin_Boolean::OBJECT_ID());
   if (!aObject)
     return;
@@ -48,6 +55,16 @@ void FeaturesPlugin_Boolean::execute()
     return;
 
   boost::shared_ptr<ModelAPI_ResultBody> aResult = document()->createBody(data());
-  aResult->store(GeomAlgoAPI_Boolean::makeCut(aObject, aTool));
+  switch (aType) {
+  case BOOL_CUT:
+    aResult->store(GeomAlgoAPI_Boolean::makeCut(aObject, aTool));
+    break;
+  case BOOL_FUSE:
+    aResult->store(GeomAlgoAPI_Boolean::makeFuse(aObject, aTool));
+    break;
+  case BOOL_COMMON:
+    aResult->store(GeomAlgoAPI_Boolean::makeCommon(aObject, aTool));
+    break;
+  }
   setResult(aResult);
 }
\ No newline at end of file
index d4b0e22cf078691c16165cbd72c14b19f288254f..15916356569abc74383bae93e39195b0080e9c34 100644 (file)
@@ -37,6 +37,11 @@ class FeaturesPlugin_Boolean : public ModelAPI_Feature
     return MY_TOOL_ID;
   }
 
+  enum {
+    BOOL_CUT,
+    BOOL_FUSE,
+    BOOL_COMMON
+  };
 
 
   /// Returns the kind of a feature
index d0ee131a4da8e6ab35d40ae617214f60898fdfaa..c80856f292c898b922914831e6cbcb1410514dca 100644 (file)
@@ -3,14 +3,17 @@
     label="Main object" 
     icon=":icons/cut_shape.png" 
     tooltip="Select an object to cut"
-    activate="true"
-    shape_types="solid,shell"
+    shape_types="solid shell"
   />
   <selector id="tool_object" 
     label="Tool object" 
     icon=":icons/cut_tool.png" 
     tooltip="Select a tool"
-    activate="false"
     shape_types="solid"
   />
+  <choice id="bool_type" 
+    label="Type" 
+    tooltip="Type of boolean operation"
+    string_list="Cut Fuse Common"
+  />
 </source>
index 0f68186e4b67cc01235f573e72d640783e09693b..d56a226aa8795aa529a5f865c79b6706cb2be649 100644 (file)
@@ -5,6 +5,8 @@
 #include "GeomAlgoAPI_Boolean.h"
 
 #include <BRepAlgoAPI_Cut.hxx>
+#include <BRepAlgoAPI_Common.hxx>
+#include <BRepAlgoAPI_Fuse.hxx>
 
 
 boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeCut(
@@ -22,3 +24,37 @@ boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeCut(
   }
   return boost::shared_ptr<GeomAPI_Shape>();
 }
+
+
+boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeFuse(
+  boost::shared_ptr<GeomAPI_Shape> theShape,
+  boost::shared_ptr<GeomAPI_Shape> theTool)
+{
+  const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
+  const TopoDS_Shape& aTool = theTool->impl<TopoDS_Shape>();
+
+  BRepAlgoAPI_Fuse aFuse(aShape, aTool);
+  if (aFuse.IsDone()) {
+    boost::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape());
+    aResult->setImpl(new TopoDS_Shape(aFuse.Shape()));
+    return aResult;
+  }
+  return boost::shared_ptr<GeomAPI_Shape>();
+}
+
+
+boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeCommon(
+  boost::shared_ptr<GeomAPI_Shape> theShape,
+  boost::shared_ptr<GeomAPI_Shape> theTool)
+{
+  const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
+  const TopoDS_Shape& aTool = theTool->impl<TopoDS_Shape>();
+
+  BRepAlgoAPI_Common aCommon(aShape, aTool);
+  if (aCommon.IsDone()) {
+    boost::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape());
+    aResult->setImpl(new TopoDS_Shape(aCommon.Shape()));
+    return aResult;
+  }
+  return boost::shared_ptr<GeomAPI_Shape>();
+}
\ No newline at end of file
index 790e7950c25ede6c4d2b0d6e52f0ad49adc35367..6a8f9c657f155d3783933181a3aea02dc246f7b5 100644 (file)
@@ -17,13 +17,28 @@ class GEOMALGOAPI_EXPORT GeomAlgoAPI_Boolean
 {
  public:
   /* \brief Creates cut boolean operation
-   * \param[in] theShape face or wire to be extruded
+   * \param[in] theShape the main shape
    * \param[in] theTool  toole shape for boolean
    * \return a solid as result of operation
    */
   static boost::shared_ptr<GeomAPI_Shape> makeCut(boost::shared_ptr<GeomAPI_Shape> theShape,
                                                         boost::shared_ptr<GeomAPI_Shape> theTool);
 
+  /* \brief Creates fuse boolean operation
+   * \param[in] theShape the main shape
+   * \param[in] theTool  second shape
+   * \return a solid as result of operation
+   */
+  static boost::shared_ptr<GeomAPI_Shape> makeFuse(boost::shared_ptr<GeomAPI_Shape> theShape,
+                                                   boost::shared_ptr<GeomAPI_Shape> theTool);
+
+  /* \brief Creates common boolean operation
+   * \param[in] theShape the main shape
+   * \param[in] theTool  second shape
+   * \return a solid as result of operation
+   */
+  static boost::shared_ptr<GeomAPI_Shape> makeCommon(boost::shared_ptr<GeomAPI_Shape> theShape,
+                                                     boost::shared_ptr<GeomAPI_Shape> theTool);
 };
 
 #endif
index 18ca3f55015333a596bf8856b7d944976fe6a73c..158675e9f1272443c9acbcbcda09dc0a2d674434 100644 (file)
@@ -50,7 +50,7 @@ void ModelAPI_Feature::setResult(const boost::shared_ptr<ModelAPI_Result>& theRe
     static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
     ModelAPI_EventCreator::get()->sendUpdated(theResult, anEvent);
     // Create event for first Feature, send it to make "created" earlier than "updated"
-    Events_Loop::loop()->flush(anEvent);
+    //Events_Loop::loop()->flush(anEvent);
   } else {  // update
     *aResIter = theResult;
     static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
index 6a1c455d905a2eb46d771bcc4218ddd6216f3d06..ba5a281eda49256daa308c3571deff2a360c2da0 100644 (file)
@@ -4,6 +4,8 @@
 
 #include "ModuleBase_WidgetChoice.h"
 
+#include <ModelAPI_AttributeInteger.h>
+#include <ModelAPI_Data.h>
 #include <Config_WidgetAPI.h>
 
 #include <QWidget>
@@ -23,11 +25,17 @@ ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent,
   QString aLabelText = QString::fromStdString(theData->widgetLabel());
   QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
   myLabel = new QLabel(aLabelText, myContainer);
-  myLabel->setPixmap(QPixmap(aLabelIcon));
+  if (!aLabelIcon.isEmpty())
+    myLabel->setPixmap(QPixmap(aLabelIcon));
   aLayout->addWidget(myLabel);
 
   myCombo = new QComboBox(myContainer);
-  aLayout->addWidget(myCombo);
+  aLayout->addWidget(myCombo, 1);
+  std::string aTypes = theData->getProperty("string_list");
+  QStringList aList = QString(aTypes.c_str()).split(' ');
+  myCombo->addItems(aList);
+
   connect(myCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int)));
 }
 
@@ -37,11 +45,22 @@ ModuleBase_WidgetChoice::~ModuleBase_WidgetChoice()
   
 bool ModuleBase_WidgetChoice::storeValue() const
 {
+  DataPtr aData = myFeature->data();
+  boost::shared_ptr<ModelAPI_AttributeInteger> aIntAttr = aData->integer(attributeID());
+
+  aIntAttr->setValue(myCombo->currentIndex());
+  updateObject(myFeature);
   return true;
 }
 
 bool ModuleBase_WidgetChoice::restoreValue()
 {
+  DataPtr aData = myFeature->data();
+  boost::shared_ptr<ModelAPI_AttributeInteger> aIntAttr = aData->integer(attributeID());
+
+  bool isBlocked = myCombo->blockSignals(true);
+  myCombo->setCurrentIndex(aIntAttr->value());
+  myCombo->blockSignals(isBlocked);
   return true;
 }
 
@@ -61,4 +80,6 @@ QList<QWidget*> ModuleBase_WidgetChoice::getControls() const
 
 void ModuleBase_WidgetChoice::onCurrentIndexChanged(int theIndex)
 {
+  emit valuesChanged();
+  emit focusOutWidget(this);
 }
\ No newline at end of file
index 46b7e03d03229e7181c465be561c5fffa69deb49..cbe5a9939e34712f06d310b761d88c7ab6adc993 100644 (file)
@@ -19,6 +19,7 @@
 #include <ModuleBase_WidgetBoolValue.h>
 #include <ModuleBase_WidgetPoint2dDistance.h>
 #include <ModuleBase_WidgetFileSelector.h>
+#include <ModuleBase_WidgetChoice.h>
 #include <ModuleBase_IWorkshop.h>
 #include <ModuleBase_IModule.h>
 
@@ -142,10 +143,18 @@ QWidget* ModuleBase_WidgetFactory::createWidgetByType(const std::string& theType
   } else if (theType == WDG_DOUBLEVALUE_EDITOR) {
     result = doubleValueEditor(theParent);
 
+  } else if (theType == WDG_DOUBLEVALUE_EDITOR) {
+    result = doubleValueEditor(theParent);
+
   } else if (theType == WDG_POINT2D_DISTANCE) {
     result = point2dDistanceControl(theParent);
+
   } else if (theType == WDG_FILE_SELECTOR) {
     result = fileSelectorControl(theParent);
+
+  } else if (theType == WDG_CHOICE) {
+    result = choiceControl(theParent);
+
   } else if (myWidgetApi->isContainerWidget() || myWidgetApi->isPagedWidget()) {
     result = createContainer(theType, theParent);
   } else {
@@ -270,3 +279,13 @@ QWidget* ModuleBase_WidgetFactory::fileSelectorControl(QWidget* theParent)
 
   return aFileSelectorWgt->getControl();
 }
+
+QWidget* ModuleBase_WidgetFactory::choiceControl(QWidget* theParent)
+{
+  ModuleBase_WidgetChoice* aChoiceWgt = new ModuleBase_WidgetChoice(theParent, myWidgetApi,
+                                                                        myParentId);
+  myModelWidgets.append(aChoiceWgt);
+
+  return aChoiceWgt->getControl();
+}
+
index 643e85b67ddb69ae0b1f5711fdb633499749d751..1b9e031bf7fcad51a7de5b74c8abae0481181b10 100644 (file)
@@ -47,6 +47,7 @@ class MODULEBASE_EXPORT ModuleBase_WidgetFactory
   QWidget* booleanControl(QWidget* theParent);
   QWidget* point2dDistanceControl(QWidget* theParent);
   QWidget* fileSelectorControl(QWidget* theParent);
+  QWidget* choiceControl(QWidget* theParent);
 
   /// Check whether the XML definition for the given type contains internal property
   /// \param theType the widget type
index dd8fb94939dd3f49750f586aafa3c0858f6ca224..08cb49f0001123a533f76da9c1c388fed6ba32ac 100644 (file)
@@ -117,8 +117,9 @@ bool ModuleBase_WidgetFeature::setObject(const ObjectPtr& theObject, bool theSen
 bool ModuleBase_WidgetFeature::storeValue() const
 {
   //FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
-  //if (!aFeature)
-  //  return false;
+  if (!myObject)
+    return false;
+
   boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
   boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
       ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
index 5e447ef1deeeaa74f9fd8cc17ccc4dba815d6e4a..157ccb45d74fd5737bcdfd4387bc2dd7a2c090cc 100644 (file)
@@ -110,6 +110,8 @@ bool ModuleBase_WidgetPoint2D::storeValue() const
 
   ModuleBase_WidgetPoint2D* that = (ModuleBase_WidgetPoint2D*) this;
   bool isBlocked = that->blockSignals(true);
+  double aX = myXSpin->value();
+  double aY = myYSpin->value();
   aPoint->setValue(myXSpin->value(), myYSpin->value());
   updateObject(myFeature);
   that->blockSignals(isBlocked);
index 35cb90e189895d04b7bbe8261dd785bfc6b77f97..8f0c1324f5d2daf943468e4dc29c39be308e0511 100644 (file)
@@ -54,8 +54,7 @@ ModuleBase_WidgetSelector::ModuleBase_WidgetSelector(QWidget* theParent,
                                                      const Config_WidgetAPI* theData,
                                                      const std::string& theParentId)
     : ModuleBase_ModelWidget(theParent, theData, theParentId),
-      myWorkshop(theWorkshop),
-      myActivateOnStart(false)
+      myWorkshop(theWorkshop)
 {
   myContainer = new QWidget(theParent);
   QHBoxLayout* aLayout = new QHBoxLayout(myContainer);
@@ -64,7 +63,8 @@ ModuleBase_WidgetSelector::ModuleBase_WidgetSelector(QWidget* theParent,
   QString aLabelText = QString::fromStdString(theData->widgetLabel());
   QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
   myLabel = new QLabel(aLabelText, myContainer);
-  myLabel->setPixmap(QPixmap(aLabelIcon));
+  if (!aLabelIcon.isEmpty())
+    myLabel->setPixmap(QPixmap(aLabelIcon));
 
   aLayout->addWidget(myLabel);
 
@@ -77,8 +77,9 @@ ModuleBase_WidgetSelector::ModuleBase_WidgetSelector(QWidget* theParent,
   myBasePalet = myTextLine->palette();
   myInactivePalet = myBasePalet;
   myInactivePalet.setBrush(QPalette::Base, QBrush(Qt::gray, Qt::Dense6Pattern));
+  myTextLine->setPalette(myInactivePalet);
 
-  aLayout->addWidget(myTextLine);
+  aLayout->addWidget(myTextLine, 1);
 
   myActivateBtn = new QToolButton(myContainer);
   myActivateBtn->setIcon(QIcon(":icons/hand_point.png"));
@@ -88,13 +89,8 @@ ModuleBase_WidgetSelector::ModuleBase_WidgetSelector(QWidget* theParent,
 
   aLayout->addWidget(myActivateBtn);
 
-  QString aActivateTxt = QString::fromStdString(theData->getProperty("activate"));
-  if (!aActivateTxt.isNull()) {
-    myActivateOnStart = (aActivateTxt == "true");
-  }
-
   std::string aTypes = theData->getProperty("shape_types");
-  myShapeTypes = QString(aTypes.c_str()).split(',');
+  myShapeTypes = QString(aTypes.c_str()).split(' ');
 }
 
 //********************************************************************
@@ -215,10 +211,10 @@ void ModuleBase_WidgetSelector::updateSelectionName()
 bool ModuleBase_WidgetSelector::eventFilter(QObject* theObj, QEvent* theEvent)
 {
   if (theObj == myTextLine) {
-    if (theEvent->type() == QEvent::Polish) {
-      myActivateBtn->setChecked(myActivateOnStart);
-      onSelectionChanged();
-    }
+    //if (theEvent->type() == QEvent::Polish) {
+    //  myActivateBtn->setChecked(myActivateOnStart);
+    //  onSelectionChanged();
+    //}
   }
   return ModuleBase_ModelWidget::eventFilter(theObj, theEvent);
 }
index 0eba6cdee057d3245af29079e46ab254f1ed12af..5973c520a143852d2e1df90b2e20317e61a32fef 100644 (file)
@@ -50,15 +50,6 @@ Q_OBJECT
   /// \return a control list
   virtual QList<QWidget*> getControls() const;
 
-  void setActivationOnStart(bool toActivate)
-  {
-    myActivateOnStart = toActivate;
-  }
-  bool activateOnStart() const
-  {
-    return myActivateOnStart;
-  }
-
   ObjectPtr selectedFeature() const
   {
     return mySelectedObject;
@@ -90,8 +81,6 @@ Q_OBJECT
 
   ModuleBase_IWorkshop* myWorkshop;
 
-  bool myActivateOnStart;
-
   ObjectPtr mySelectedObject;
   QStringList myShapeTypes;
 
index 69e4f2a4acc81cfd5682dff791fcdc6acf12c5db..b9c346009f323f875ac78b62eb89d1fc2b59f309 100644 (file)
@@ -1055,9 +1055,17 @@ void XGUI_ViewWindow::dumpView()
 
     Handle(Visual3d_View) a3dView = myViewPort->getView()->View();
     if (aFmt == "PS")
+#ifdef WIN32
+      a3dView->Export(_strdup(qPrintable(aFileName)), Graphic3d_EF_PostScript);
+#else
       a3dView->Export(strdup(qPrintable(aFileName)), Graphic3d_EF_PostScript);
+#endif
     else if (aFmt == "EPS")
+#ifdef WIN32
+      a3dView->Export(_strdup(qPrintable(aFileName)), Graphic3d_EF_EnhPostScript);
+#else
       a3dView->Export(strdup(qPrintable(aFileName)), Graphic3d_EF_EnhPostScript);
+#endif
     else
       aPicture.save(aFileName, aFmt.toLatin1());
     QApplication::restoreOverrideCursor();