From 836d5b15255603e40ceaf2c65d5bc9ceef989966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Tr=C3=B6ger?= Date: Sat, 14 May 2016 07:59:10 +0200 Subject: [PATCH] FEM Post: Fix rebase errors --- src/App/CMakeLists.txt.orig | 247 --- src/Gui/CMakeLists.txt.orig | 1158 ------------ src/Gui/SoFCDB.cpp.orig | 311 ---- src/Gui/SoFCDB.cpp.orig.orig | 310 ---- src/Gui/View3DInventorViewer.cpp | 20 - src/Mod/Fem/App/AppFem.cpp.orig | 339 ---- src/Mod/Fem/App/AppFemPy.cpp.orig | 535 ------ src/Mod/Fem/App/CMakeLists.txt | 3 +- src/Mod/Fem/App/CMakeLists.txt.orig | 236 --- src/Mod/Fem/Gui/Command.cpp.orig | 2315 ------------------------ src/Mod/Fem/Gui/Resources/Fem.qrc.orig | 123 -- 11 files changed, 1 insertion(+), 5596 deletions(-) delete mode 100644 src/App/CMakeLists.txt.orig delete mode 100644 src/Gui/CMakeLists.txt.orig delete mode 100644 src/Gui/SoFCDB.cpp.orig delete mode 100644 src/Gui/SoFCDB.cpp.orig.orig delete mode 100644 src/Mod/Fem/App/AppFem.cpp.orig delete mode 100644 src/Mod/Fem/App/AppFemPy.cpp.orig delete mode 100755 src/Mod/Fem/App/CMakeLists.txt.orig delete mode 100644 src/Mod/Fem/Gui/Command.cpp.orig delete mode 100755 src/Mod/Fem/Gui/Resources/Fem.qrc.orig diff --git a/src/App/CMakeLists.txt.orig b/src/App/CMakeLists.txt.orig deleted file mode 100644 index 86f20246b..000000000 --- a/src/App/CMakeLists.txt.orig +++ /dev/null @@ -1,247 +0,0 @@ -if(WIN32) - add_definitions(-DFCApp) - add_definitions(-DBOOST_DYN_LINK) -endif(WIN32) - -# This causes some problems with the resource files to be found, especially with the StartPage -IF(RESOURCEDIR) - add_definitions(-DRESOURCEDIR="${RESOURCEDIR}") -ENDIF(RESOURCEDIR) - -IF(DOCDIR) - add_definitions(-DDOCDIR="${DOCDIR}") -ENDIF(DOCDIR) - -<<<<<<< 99c1373c94c4a8d3efa0cc0f558a8e523389a501 -add_definitions(-DBOOST_${Boost_VERSION}) -======= -#write relevant cmake variables to a file for later access with python. Exportet are all variables -#starting with BUILD. As the variable only exists if the user set it to ON a dict is useless, we -#use a python list for export. -set(_vars "const char CMakeVariables[] =\"cmake = [") -set(_delim "") -get_cmake_property(_variableNames VARIABLES) -foreach (_variableName ${_variableNames}) - if (${_variableName}) - STRING(REGEX MATCH "^[_]?[^_]*" _prefix "${_variableName}_") - if(${_prefix} STREQUAL "BUILD") - STRING(REPLACE "\\" "\\\\" _name ${_variableName}) - set(_vars "${_vars}${_delim}\\n\"\n\"\\\"${_name}\\\"") - set(_delim ",") - endif() - endif () -endforeach() -set(_vars "${_vars}]\\n\" \n;") -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CMakeScript.h "${_vars}" ) ->>>>>>> Give access to cmake BUILD variables from python - -include_directories( - ${CMAKE_BINARY_DIR}/src - ${CMAKE_SOURCE_DIR}/src - ${CMAKE_CURRENT_BINARY_DIR} - ${Boost_INCLUDE_DIRS} - ${PYTHON_INCLUDE_DIRS} - ${XercesC_INCLUDE_DIRS} - ${QT_INCLUDE_DIR} - ${ZLIB_INCLUDE_DIR} -) - -set(FreeCADApp_LIBS - FreeCADBase - ${Boost_LIBRARIES} - ${QT_QTCORE_LIBRARY} - ${QT_QTXML_LIBRARY} -) - -generate_from_xml(DocumentPy) -generate_from_xml(DocumentObjectPy) -generate_from_xml(DocumentObjectGroupPy) -generate_from_xml(GeoFeaturePy) -generate_from_xml(GeoFeatureGroupPy) -generate_from_xml(OriginGroupPy) -generate_from_xml(PartPy) - -generate_from_xml(ComplexGeoDataPy) -generate_from_xml(PropertyContainerPy) -generate_from_xml(MaterialPy) - -generate_from_py(FreeCADInit InitScript.h) -generate_from_py(FreeCADTest TestScript.h) - -SET(FreeCADApp_XML_SRCS - DocumentObjectGroupPy.xml - DocumentObjectPy.xml - GeoFeaturePy.xml - GeoFeatureGroupPy.xml - OriginGroupPy.xml - PartPy.xml - DocumentPy.xml - PropertyContainerPy.xml - ComplexGeoDataPy.xml - MaterialPy.xml -) -SOURCE_GROUP("XML" FILES ${FreeCADApp_XML_SRCS}) - -# The document stuff -SET(Document_CPP_SRCS - Annotation.cpp - Document.cpp - DocumentObject.cpp - DocumentObjectFileIncluded.cpp - DocumentObjectGroup.cpp - DocumentObjectGroupPyImp.cpp - GeoFeaturePyImp.cpp - DocumentObjectPyImp.cpp - DocumentObserver.cpp - DocumentObserverPython.cpp - DocumentPyImp.cpp - Expression.cpp - FeaturePython.cpp - FeatureTest.cpp - GeoFeature.cpp - GeoFeatureGroupPyImp.cpp - GeoFeatureGroup.cpp - OriginGroupPyImp.cpp - OriginGroup.cpp - PartPyImp.cpp - Part.cpp - Origin.cpp - Path.cpp - InventorObject.cpp - MeasureDistance.cpp - Placement.cpp - OriginFeature.cpp - Range.cpp - Transactions.cpp - VRMLObject.cpp - MaterialObject.cpp - MergeDocuments.cpp -) - -SET(Document_HPP_SRCS - Annotation.h - Document.h - DocumentObject.h - DocumentObjectFileIncluded.h - DocumentObjectGroup.h - DocumentObserver.h - DocumentObserverPython.h - Expression.h - ExpressionVisitors.h - FeatureCustom.h - FeaturePython.h - FeaturePythonPyImp.h - FeaturePythonPyImp.inl - FeatureTest.h - GeoFeature.h - GeoFeatureGroup.h - OriginGroup.h - Part.h - Origin.h - Path.h - InventorObject.h - MeasureDistance.h - Placement.h - OriginFeature.h - Range.h - Transactions.h - VRMLObject.h - MaterialObject.h - MergeDocuments.h -) -SET(Document_SRCS - ${Document_CPP_SRCS} - ${Document_HPP_SRCS} -) -SOURCE_GROUP("Document" FILES ${Document_SRCS}) - -# The property stuff -SET(Properties_CPP_SRCS - DynamicProperty.cpp - ObjectIdentifier.cpp - Property.cpp - PropertyContainer.cpp - PropertyContainerPyImp.cpp - PropertyFile.cpp - PropertyGeo.cpp - PropertyLinks.cpp - PropertyPythonObject.cpp - PropertyStandard.cpp - PropertyUnits.cpp - PropertyExpressionEngine.cpp -) -SET(Properties_HPP_SRCS - DynamicProperty.h - ObjectIdentifier.h - Property.h - PropertyContainer.h - PropertyFile.h - PropertyGeo.h - PropertyLinks.h - PropertyPythonObject.h - PropertyStandard.h - PropertyUnits.h - PropertyExpressionEngine.h -) -SET(Properties_SRCS - ${Properties_CPP_SRCS} - ${Properties_HPP_SRCS} -) -SOURCE_GROUP("Properties" FILES ${Properties_SRCS}) - -SET(FreeCADApp_CPP_SRCS - ${Document_CPP_SRCS} - ${Properties_CPP_SRCS} - Application.cpp - ApplicationPy.cpp - Branding.cpp - ColorModel.cpp - ComplexGeoData.cpp - ComplexGeoDataPyImp.cpp - Enumeration.cpp - Material.cpp - MaterialPyImp.cpp -) - -SET(FreeCADApp_HPP_SRCS - ${Document_HPP_SRCS} - ${Properties_HPP_SRCS} - Application.h - Branding.h - ColorModel.h - ComplexGeoData.h - Enumeration.h - Material.h -) - -SET(FreeCADApp_SRCS - ${FreeCADApp_CPP_SRCS} - ${FreeCADApp_HPP_SRCS} - ${FreeCADApp_XML_SRCS} - FreeCADInit.py - FreeCADTest.py - PreCompiled.cpp - PreCompiled.h -) - -if(MSVC) - add_definitions(-D_PreComp_) - ADD_MSVC_PRECOMPILED_HEADER(FreeCADApp PreCompiled.h PreCompiled.cpp FreeCADApp_CPP_SRCS) -endif(MSVC) - -add_library(FreeCADApp SHARED ${FreeCADApp_SRCS}) - -target_link_libraries(FreeCADApp ${FreeCADApp_LIBS}) - -SET_BIN_DIR(FreeCADApp FreeCADApp) - -if(WIN32) - INSTALL(TARGETS FreeCADApp - RUNTIME DESTINATION bin - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) -else(WIN32) - INSTALL(TARGETS FreeCADApp - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) -endif(WIN32) diff --git a/src/Gui/CMakeLists.txt.orig b/src/Gui/CMakeLists.txt.orig deleted file mode 100644 index 03dff9de9..000000000 --- a/src/Gui/CMakeLists.txt.orig +++ /dev/null @@ -1,1158 +0,0 @@ -#add_subdirectory(Icons) -add_subdirectory(Stylesheets) - -if(WIN32) -add_definitions(-DFCGui -DQIIS_MAKEDLL -DQSINT_MAKEDLL -DOVR_OS_WIN32 -DQUARTER_INTERNAL -DQUARTER_MAKE_DLL -DCOIN_DLL) -endif(WIN32) - -IF(CMAKE_BUILD_TYPE) - add_definitions(-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}") -ENDIF(CMAKE_BUILD_TYPE) - -if (FREECAD_USE_3DCONNEXION) - add_definitions(-D_USE_3DCONNEXION_SDK) - if(APPLE) - set(3DCONNEXION_LINKFLAGS "-F/Library/Frameworks -weak_framework 3DconnexionClient") - set(3DCONNEXION_INCLUDE_DIR ${3DCONNEXIONCLIENT_FRAMEWORK}/Headers - ${3DCONNEXIONCLIENT_FRAMEWORK}/Headers/3DconnexionClient ) - endif(APPLE) -endif(FREECAD_USE_3DCONNEXION) - -if (BUILD_VR) - add_definitions(-DBUILD_VR ) -endif(BUILD_VR) - -include_directories( - ${CMAKE_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/Quarter - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/.. - ${CMAKE_CURRENT_BINARY_DIR}/.. - ${CMAKE_CURRENT_BINARY_DIR}/Language - ${CMAKE_CURRENT_BINARY_DIR}/propertyeditor - ${CMAKE_CURRENT_BINARY_DIR}/TaskView - ${CMAKE_CURRENT_BINARY_DIR}/Quarter - ${CMAKE_CURRENT_BINARY_DIR}/DAGView - ${Boost_INCLUDE_DIRS} - ${COIN3D_INCLUDE_DIRS} - ${PYTHON_INCLUDE_DIRS} - ${XercesC_INCLUDE_DIRS} - ${QT_INCLUDE_DIR} - ${ZLIB_INCLUDE_DIR} - ${3DCONNEXION_INCLUDE_DIR} -) - -if(MSVC) - set(FreeCADGui_LIBS - FreeCADApp - ${COIN3D_LIBRARIES} - ${QT_LIBRARIES} - ${QT_QTUITOOLS_LIBRARY} - ${OPENGL_gl_LIBRARY} - ) -else(MSVC) - set(FreeCADGui_LIBS - FreeCADApp - ${COIN3D_LIBRARIES} - ${QT_LIBRARIES} - ${Boost_LIBRARIES} - ${OPENGL_gl_LIBRARY} - ${3DCONNEXION_LINKFLAGS} - ) -endif(MSVC) - -IF(SPNAV_FOUND) - add_definitions(-DSPNAV_FOUND) - include_directories( - ${SPNAV_INCLUDE_DIR} - ) - set(FreeCADGui_LIBS - ${FreeCADGui_LIBS} - ${SPNAV_LIBRARIES} - ) - find_package(X11 QUIET) - if (X11_FOUND) - set(FreeCADGui_LIBS - ${FreeCADGui_LIBS} - ${X11_X11_LIB} - ) - endif(X11_FOUND) -ENDIF(SPNAV_FOUND) - -IF(OCULUS_FOUND) - add_definitions(-DOCULUS_FOUND) - include_directories( - ${OCULUS_INCLUDE_DIRS} - ) - set(FreeCADGui_LIBS - ${FreeCADGui_LIBS} - ${OCULUS_LIBRARIES} - ) -ENDIF(OCULUS_FOUND) - -if(SHIBOKEN_INCLUDE_DIR) - add_definitions(-DHAVE_SHIBOKEN) - include_directories( - ${SHIBOKEN_INCLUDE_DIR} - ) - set(FreeCADGui_LIBS - ${FreeCADGui_LIBS} - ${SHIBOKEN_LIBRARY} - ) -endif(SHIBOKEN_INCLUDE_DIR) - -if(PYSIDE_INCLUDE_DIR) - add_definitions(-DHAVE_PYSIDE) - include_directories( - ${PYSIDE_INCLUDE_DIR} - ${PYSIDE_INCLUDE_DIR}/QtCore - ${PYSIDE_INCLUDE_DIR}/QtGui - ) - set(FreeCADGui_LIBS - ${FreeCADGui_LIBS} - ${PYSIDE_LIBRARY} - ) -endif(PYSIDE_INCLUDE_DIR) - -generate_from_xml(DocumentPy) -generate_from_xml(PythonWorkbenchPy) -generate_from_xml(ViewProviderPy) -generate_from_xml(ViewProviderDocumentObjectPy) -generate_from_xml(ViewProviderPythonFeaturePy) -generate_from_xml(WorkbenchPy) -generate_from_xml(SelectionObjectPy) - -generate_from_py(FreeCADGuiInit GuiInitScript.h) - -# The XML files -SET(FreeCADGui_XML_SRCS - ViewProviderDocumentObjectPy.xml - ViewProviderPythonFeaturePy.xml - ViewProviderPy.xml - PythonWorkbenchPy.xml - WorkbenchPy.xml - SelectionObjectPy.xml - DocumentPy.xml -) -SOURCE_GROUP("XML" FILES ${FreeCADApp_XML_SRCS}) - -# The 3D Connexion SDK files -if(FREECAD_USE_3DCONNEXION AND MSVC) -SET(FreeCADGui_SDK_SRCS - 3Dconnexion/I3dMouseParams.h - 3Dconnexion/MouseParameters.cpp - 3Dconnexion/MouseParameters.h - 3Dconnexion/GuiApplicationNativeEventAwareWin32.cpp -) -SOURCE_GROUP("3D connexion SDK" FILES ${FreeCADGui_SDK_SRCS}) -endif(FREECAD_USE_3DCONNEXION AND MSVC) - -if(FREECAD_USE_3DCONNEXION AND APPLE) -SET(FreeCADGui_SDK_SRCS - 3Dconnexion/GuiApplicationNativeEventAwareMac.cpp -) -SOURCE_GROUP("3D connexion SDK" FILES ${FreeCADGui_SDK_SRCS}) -endif(FREECAD_USE_3DCONNEXION AND APPLE) - -set(Gui_MOC_HDRS - Action.h - ActionFunction.h - Assistant.h - AutoSaver.h - CallTips.h - CombiView.h - Control.h - Clipping.h - DemoMode.h - DownloadDialog.h - DownloadItem.h - DownloadManager.h - DlgActionsImp.h - DlgActivateWindowImp.h - DlgUnitsCalculatorImp.h - DlgCommandsImp.h - DlgCustomizeImp.h - DlgCustomizeSpaceball.h - DlgCustomizeSpNavSettings.h - DlgDisplayPropertiesImp.h - DlgEditorImp.h - DlgGeneralImp.h - DlgInputDialogImp.h - DlgKeyboardImp.h - DlgMacroExecuteImp.h - DlgMacroRecordImp.h - DlgRunExternal.h - DlgEditFileIncludeProptertyExternal.h - DlgMaterialPropertiesImp.h - DlgOnlineHelpImp.h - DlgParameterImp.h - DlgPreferencesImp.h - DlgProjectInformationImp.h - DlgProjectUtility.h - DlgPropertyLink.h - DlgReportViewImp.h - DlgSettings3DViewImp.h - DlgSettingsViewColor.h - DlgSettingsColorGradientImp.h - DlgSettingsDocumentImp.h - DlgSettingsImageImp.h - DlgSettingsMacroImp.h - DlgSettingsUnitsImp.h - DlgTipOfTheDayImp.h - DlgCheckableMessageBox.h - DlgToolbarsImp.h - DlgWorkbenchesImp.h - TaskDlgRelocation.h - TaskCSysDragger.h - DlgUndoRedo.h - DockWindow.h - DockWindowManager.h - DocumentRecovery.h - EditorView.h - ExpressionCompleter.h - DlgExpressionInput.h - FileDialog.h - Flag.h - GraphicsViewZoom.h - GraphvizView.h - GuiApplication.h - GuiApplicationNativeEventAware.h - HelpView.h - InputVector.h - MainWindow.h - ManualAlignment.h - MDIView.h - NetworkRetriever.h - OnlineDocumentation.h - Placement.h - InputField.h - PrefWidgets.h - ProgressBar.h - PropertyPage.h - PropertyView.h - PythonConsole.h - PythonDebugger.h - PythonEditor.h - QuantitySpinBox.h - QListWidgetCustom.h - QuantitySpinBox_p.h - ReportView.h - SceneInspector.h - SelectionView.h - SpinBox.h - Splashscreen.h - TextEdit.h - TextureMapping.h - ToolBox.h - Transform.h - Tree.h - TreeView.h - ProjectView.h - View3DInventor.h - WidgetFactory.h - Widgets.h - Language/Translator.h - propertyeditor/PropertyEditor.h - propertyeditor/PropertyItem.h - propertyeditor/PropertyItemDelegate.h - propertyeditor/PropertyModel.h - TaskView/TaskAppearance.h - TaskView/TaskSelectLinkProperty.h - TaskView/TaskDialog.h - TaskView/TaskWatcher.h - TaskView/TaskEditControl.h - TaskView/TaskView.h - DAGView/DAGView.h - DAGView/DAGModel.h -) -#qt4_wrap_cpp(Gui_MOC_SRCS ${Gui_MOC_HDRS}) -fc_wrap_cpp(Gui_MOC_SRCS ${Gui_MOC_HDRS}) -#SOURCE_GROUP("Moc" FILES ${Gui_MOC_SRCS}) - -add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_GraphvizView-internal.cpp - COMMAND ${QT_MOC_EXECUTABLE} -o ${CMAKE_CURRENT_BINARY_DIR}/moc_GraphvizView-internal.cpp ${CMAKE_CURRENT_SOURCE_DIR}/GraphvizView.cpp - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/GraphvizView.cpp) - -set_property(SOURCE GraphvizView.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_GraphvizView-internal.cpp) - -SET(Gui_UIC_SRCS - AboutApplication.ui - Clipping.ui - DemoMode.ui - DlgActions.ui - DlgActivateWindow.ui - DlgUnitsCalculator.ui - DlgAuthorization.ui - DlgChooseIcon.ui - DlgCommands.ui - DlgCustomizeSpNavSettings.ui - DlgDisplayProperties.ui - DlgEditor.ui - DlgGeneral.ui - DlgInputDialog.ui - DlgKeyboard.ui - DlgMacroExecute.ui - DlgRunExternal.ui - DlgMacroRecord.ui - DlgMaterialProperties.ui - DlgOnlineHelp.ui - DlgParameter.ui - DlgPreferences.ui - DlgProjectInformation.ui - DlgProjectUtility.ui - DlgPropertyLink.ui - DlgReportView.ui - DlgSettings3DView.ui - DlgSettingsUnits.ui - DlgSettingsViewColor.ui - DlgSettingsColorGradient.ui - DlgSettingsDocument.ui - DlgSettingsImage.ui - DlgSettingsMacro.ui - DlgCheckableMessageBox.ui - DlgTipOfTheDay.ui - DlgToolbars.ui - DlgWorkbenches.ui - DlgTreeWidget.ui - DlgLocationAngle.ui - DlgLocationPos.ui - DocumentRecovery.ui - DownloadManager.ui - DownloadItem.ui - DlgExpressionInput.ui - MouseButtons.ui - SceneInspector.ui - InputVector.ui - Placement.ui - TextureMapping.ui - TaskView/TaskAppearance.ui - TaskView/TaskSelectLinkProperty.ui -) - -SET(Gui_RES_SRCS - Icons/resource.qrc - Language/translation.qrc - iisTaskPanel/src/iisTaskPanel.qrc - QSint/actionpanel/schemes.qrc -) -QT4_ADD_RESOURCES(Gui_QRC_SRCS ${Gui_RES_SRCS}) - -QT4_WRAP_UI(Gui_UIC_HDRS ${Gui_UIC_SRCS}) -SOURCE_GROUP("Uic" FILES ${Gui_UIC_HDRS}) - -# The command sources -SET(Command_CPP_SRCS - Action.cpp - ActionFunction.cpp - Command.cpp - CommandDoc.cpp - CommandFeat.cpp - CommandMacro.cpp - CommandStd.cpp - CommandWindow.cpp - CommandTest.cpp - CommandView.cpp -) -SET(Command_SRCS - ${Command_CPP_SRCS} - Action.h - ActionFunction.h - Command.h -) -SOURCE_GROUP("Command" FILES ${Command_SRCS}) - -# The dialog sources -SET(Dialog_CPP_SRCS - Clipping.cpp - DemoMode.cpp - DlgActivateWindowImp.cpp - DlgUnitsCalculatorImp.cpp - DlgDisplayPropertiesImp.cpp - DlgInputDialogImp.cpp - DlgMacroExecuteImp.cpp - DlgRunExternal.cpp - DlgEditFileIncludeProptertyExternal.cpp - DlgMacroRecordImp.cpp - DlgMaterialPropertiesImp.cpp - DlgParameterImp.cpp - DlgProjectInformationImp.cpp - DlgProjectUtility.cpp - DlgPropertyLink.cpp - DlgTipOfTheDayImp.cpp - DlgExpressionInput.cpp - TaskDlgRelocation.cpp - DlgCheckableMessageBox.cpp - TaskCSysDragger.cpp - DlgUndoRedo.cpp - InputVector.cpp - Placement.cpp - PropertyPage.cpp - SceneInspector.cpp - TextureMapping.cpp - Transform.cpp - DownloadDialog.cpp - DownloadItem.cpp - DownloadManager.cpp - DocumentRecovery.cpp -) - -SET(Dialog_HPP_SRCS - Clipping.h - DemoMode.h - DlgActivateWindowImp.h - DlgUnitsCalculatorImp.h - DlgDisplayPropertiesImp.h - DlgInputDialogImp.h - DlgMacroExecuteImp.h - DlgRunExternal.h - DlgEditFileIncludeProptertyExternal.h - DlgMacroRecordImp.h - DlgMaterialPropertiesImp.h - DlgParameterImp.h - DlgProjectInformationImp.h - DlgProjectUtility.h - DlgPropertyLink.h - DlgCheckableMessageBox.h - DlgTipOfTheDayImp.h - DlgExpressionInput.h - TaskDlgRelocation.h - TaskCSysDragger.h - DlgUndoRedo.h - InputVector.h - Placement.h - PropertyPage.h - SceneInspector.h - TextureMapping.h - Transform.h - DownloadDialog.h - DownloadItem.h - DownloadManager.h - DocumentRecovery.h -) - -SET(Dialog_SRCS - ${Dialog_CPP_SRCS} - ${Dialog_HPP_SRCS} - AboutApplication.ui - Clipping.ui - DemoMode.ui - DlgActivateWindow.ui - DlgUnitsCalculator.ui - DlgAuthorization.ui - DlgDisplayProperties.ui - DlgInputDialog.ui - DlgLocationAngle.ui - DlgLocationPos.ui - DlgMacroExecute.ui - DlgRunExternal.ui - DlgMacroRecord.ui - DlgMaterialProperties.ui - DlgParameter.ui - DlgProjectInformation.ui - DlgProjectUtility.ui - DlgPropertyLink.ui - DlgTipOfTheDay.ui - DlgCheckableMessageBox.ui - DlgTreeWidget.ui - DlgExpressionInput.ui - DownloadManager.ui - DownloadItem.ui - DocumentRecovery.ui - MouseButtons.ui - InputVector.ui - Placement.ui - SceneInspector.ui - TextureMapping.ui -) -SOURCE_GROUP("Dialog" FILES ${Dialog_SRCS}) - -# The customize dialog sources -SET(Dialog_Customize_CPP_SRCS - DlgActionsImp.cpp - DlgCommandsImp.cpp - DlgCustomizeImp.cpp - DlgCustomizeSpaceball.cpp - DlgCustomizeSpNavSettings.cpp - DlgKeyboardImp.cpp - DlgToolbarsImp.cpp - DlgWorkbenchesImp.cpp - QListWidgetCustom.cpp -) -SET(Dialog_Customize_HPP_SRCS - DlgActionsImp.h - DlgCommandsImp.h - DlgCustomizeImp.h - DlgCustomizeSpaceball.h - DlgCustomizeSpNavSettings.h - DlgKeyboardImp.h - DlgToolbarsImp.h - DlgWorkbenchesImp.h - QListWidgetCustom.h -) -SET(Dialog_Customize_SRCS - ${Dialog_Customize_CPP_SRCS} - ${Dialog_Customize_HPP_SRCS} - DlgActions.ui - DlgChooseIcon.ui - DlgCommands.ui - DlgCustomizeSpNavSettings.ui - DlgKeyboard.ui - DlgToolbars.ui - DlgWorkbenches.ui -) -SOURCE_GROUP("Dialog\\Customize" FILES ${Dialog_Customize_SRCS}) - -# The settings dialog sources -SET(Dialog_Settings_CPP_SRCS - DlgEditorImp.cpp - DlgGeneralImp.cpp - DlgOnlineHelpImp.cpp - DlgPreferencesImp.cpp - DlgReportViewImp.cpp - DlgSettings3DViewImp.cpp - DlgSettingsUnitsImp.cpp - DlgSettingsViewColor.cpp - DlgSettingsColorGradientImp.cpp - DlgSettingsDocumentImp.cpp - DlgSettingsImageImp.cpp - DlgSettingsMacroImp.cpp -) -SET(Dialog_Settings_HPP_SRCS - DlgEditorImp.h - DlgGeneralImp.h - DlgOnlineHelpImp.h - DlgPreferencesImp.h - DlgReportViewImp.h - DlgSettings3DViewImp.h - DlgSettingsUnitsImp.h - DlgSettingsViewColor.h - DlgSettingsColorGradientImp.h - DlgSettingsDocumentImp.h - DlgSettingsImageImp.h - DlgSettingsMacroImp.h -) -SET(Dialog_Settings_SRCS - ${Dialog_Settings_CPP_SRCS} - ${Dialog_Settings_HPP_SRCS} - DlgEditor.ui - DlgGeneral.ui - DlgOnlineHelp.ui - DlgPreferences.ui - DlgReportView.ui - DlgSettings3DView.ui - DlgSettingsUnits.ui - DlgSettingsViewColor.ui - DlgSettingsColorGradient.ui - DlgSettingsDocument.ui - DlgSettingsImage.ui - DlgSettingsMacro.ui -) -SOURCE_GROUP("Dialog\\Settings" FILES ${Dialog_Settings_SRCS}) - -# The dock windows sources -SET(Dock_Windows_CPP_SRCS - CombiView.cpp - DockWindow.cpp - HelpView.cpp - PropertyView.cpp - ReportView.cpp - SelectionView.cpp - ToolBox.cpp - Tree.cpp - TreeView.cpp - ProjectView.cpp - DAGView/DAGView.cpp - DAGView/DAGModel.cpp - DAGView/DAGRectItem.cpp - DAGView/DAGModelGraph.cpp - DAGView/DAGFilter.cpp -) -SET(Dock_Windows_HPP_SRCS - CombiView.h - DockWindow.h - HelpView.h - PropertyView.h - ReportView.h - SelectionView.h - ToolBox.h - Tree.h - TreeView.h - ProjectView.h - DAGView/DAGView.h - DAGView/DAGModel.h - DAGView/DAGRectItem.h - DAGView/DAGModelGraph.h - DAGView/DAGFilter.h -) -SET(Dock_Windows_SRCS - ${Dock_Windows_CPP_SRCS} - ${Dock_Windows_HPP_SRCS} -) -SOURCE_GROUP("Dock Windows" FILES ${Dock_Windows_SRCS}) - -# The editor sources -SET(Editor_CPP_SRCS - CallTips.cpp - EditorView.cpp - PythonConsole.cpp - PythonConsolePy.cpp - PythonDebugger.cpp - PythonEditor.cpp - SyntaxHighlighter.cpp - TextEdit.cpp -) -SET(Editor_HPP_SRCS - CallTips.h - EditorView.h - PythonConsole.h - PythonConsolePy.h - PythonDebugger.h - PythonEditor.h - SyntaxHighlighter.h - TextEdit.h -) -SET(Editor_SRCS - ${Editor_CPP_SRCS} - ${Editor_HPP_SRCS} -) -SOURCE_GROUP("Editor" FILES ${Editor_SRCS}) - -# The help system -SET(Help_CPP_SRCS - Assistant.cpp - NetworkRetriever.cpp - OnlineDocumentation.cpp - WhatsThis.cpp -) -SET(Help_SRCS - ${Help_CPP_SRCS} - Assistant.h - NetworkRetriever.h - OnlineDocumentation.h - WhatsThis.h -) -SOURCE_GROUP("Help" FILES ${Help_SRCS}) - - -# The i18n sources -SET(Language_SRCS - Language/Translator.cpp - Language/Translator.h -) -SOURCE_GROUP("Language" FILES ${Language_SRCS}) - -# The property editor -SET(Propertyeditor_SRCS - propertyeditor/PropertyEditor.cpp - propertyeditor/PropertyEditor.h - propertyeditor/PropertyItem.cpp - propertyeditor/PropertyItem.h - propertyeditor/PropertyItemDelegate.cpp - propertyeditor/PropertyItemDelegate.h - propertyeditor/PropertyModel.cpp - propertyeditor/PropertyModel.h -) -SOURCE_GROUP("Propertyeditor" FILES ${Propertyeditor_SRCS}) - -# The task view -SET(Task_View_SRCS - TaskView/TaskAppearance.cpp - TaskView/TaskAppearance.h - TaskView/TaskAppearance.ui - TaskView/TaskSelectLinkProperty.cpp - TaskView/TaskSelectLinkProperty.h - TaskView/TaskSelectLinkProperty.ui - TaskView/TaskEditControl.cpp - TaskView/TaskEditControl.h - TaskView/TaskEditControl.ui - TaskView/TaskView.cpp - TaskView/TaskView.h - TaskView/TaskDialog.cpp - TaskView/TaskDialog.h - TaskView/TaskDialogPython.cpp - TaskView/TaskDialogPython.h - TaskView/TaskWatcher.cpp - TaskView/TaskWatcher.h -) -SOURCE_GROUP("Task View" FILES ${Task_View_SRCS}) - -SET(iisTaskPanel_SRCS - iisTaskPanel/src/iisfreecadscheme.cpp - iisTaskPanel/src/iisfreecadscheme.h - iisTaskPanel/src/iisiconlabel.cpp - iisTaskPanel/src/iisiconlabel.h - iisTaskPanel/src/iistaskbox.cpp - iisTaskPanel/src/iistaskbox.h - iisTaskPanel/src/iistaskgroup.cpp - iisTaskPanel/src/iistaskgroup.h - iisTaskPanel/src/iistaskheader.cpp - iisTaskPanel/src/iistaskheader.h - iisTaskPanel/src/iistaskpanel.cpp - iisTaskPanel/src/iistaskpanel.h - iisTaskPanel/src/iistaskpanelscheme.cpp - iisTaskPanel/src/iistaskpanelscheme.h - iisTaskPanel/src/iiswinxptaskpanelscheme.cpp - iisTaskPanel/src/iiswinxptaskpanelscheme.h - iisTaskPanel/src/iistaskpanel_global.h -) -SOURCE_GROUP("Widget\\iisTaskPanel" FILES ${iisTaskPanel_SRCS}) -set(iis_MOC_HDRS - iisTaskPanel/src/iisiconlabel.h - iisTaskPanel/src/iistaskbox.h - iisTaskPanel/src/iistaskgroup.h - iisTaskPanel/src/iistaskheader.h -) -qt4_wrap_cpp(iis_MOC_SRCS ${iis_MOC_HDRS}) -SOURCE_GROUP("Widget\\iisTaskPanel\\Mocs" FILES ${iis_MOC_SRCS}) - -SET(qsintActionPanel_SRCS - QSint/actionpanel/actionbox.cpp - QSint/actionpanel/actionbox.h - QSint/actionpanel/actionlabel.cpp - QSint/actionpanel/actionlabel.h - QSint/actionpanel/actiongroup.cpp - QSint/actionpanel/actiongroup.h - QSint/actionpanel/actionpanel.cpp - QSint/actionpanel/actionpanel.h - QSint/actionpanel/actionpanelscheme.cpp - QSint/actionpanel/actionpanelscheme.h - QSint/actionpanel/androidpanelscheme.cpp - QSint/actionpanel/androidpanelscheme.h - QSint/actionpanel/macpanelscheme.cpp - QSint/actionpanel/macpanelscheme.h - QSint/actionpanel/taskgroup_p.cpp - QSint/actionpanel/taskgroup_p.h - QSint/actionpanel/taskheader_p.cpp - QSint/actionpanel/taskheader_p.h - QSint/actionpanel/winvistapanelscheme.cpp - QSint/actionpanel/winvistapanelscheme.h - QSint/actionpanel/winxppanelscheme.cpp - QSint/actionpanel/winxppanelscheme.h - QSint/actionpanel/freecadscheme.cpp - QSint/actionpanel/freecadscheme.h -) -SOURCE_GROUP("Widget\\QSintActionPanel" FILES ${qsintActionPanel_SRCS}) -set(qsint_MOC_HDRS - QSint/actionpanel/actionbox.h - QSint/actionpanel/actionlabel.h - QSint/actionpanel/actiongroup.h - QSint/actionpanel/actionpanel.h - QSint/actionpanel/taskheader_p.h -) -qt4_wrap_cpp(qsint_MOC_SRCS ${qsint_MOC_HDRS}) -SOURCE_GROUP("Widget\\QSintActionPanel\\Mocs" FILES ${qsint_MOC_SRCS}) - -#SET(Resource_RCS -# Icons/resource.qrc -# Language/translation.qrc) -#qt4_add_resources(Resource_SRCS ${Resource_RCS}) -#SET(Resource_SRCS -# ${Resource_SRCS} -# Icons/resource.qrc -# Language/translation.qrc -#) -#SOURCE_GROUP("Resource" FILES ${Resource_SRCS}) - -# The 3d view -SET(View3D_CPP_SRCS - Flag.cpp - GLPainter.cpp - MouseSelection.cpp - NavigationStyle.cpp - InventorNavigationStyle.cpp - CADNavigationStyle.cpp - BlenderNavigationStyle.cpp - MayaGestureNavigationStyle.cpp - OpenCascadeNavigationStyle.cpp - TouchpadNavigationStyle.cpp - GestureNavigationStyle.cpp - SplitView3DInventor.cpp - View.cpp - View3DInventor.cpp - View3DInventorExamples.cpp - View3DInventorViewer.cpp - View3DInventorRiftViewer.cpp - CoinRiftWidget.cpp - View3DPy.cpp - View3DViewerPy.cpp -) -SET(View3D_SRCS - ${View3D_CPP_SRCS} - Flag.h - GLPainter.h - MouseSelection.h - NavigationStyle.h - SplitView3DInventor.h - View.h - View3DInventor.h - View3DInventorExamples.h - View3DInventorViewer.h - View3DPy.h - View3DInventorRiftViewer.h - CoinRiftWidget.h - View3DViewerPy.h -) -SOURCE_GROUP("View3D" FILES ${View3D_SRCS}) - -#quarter sources -FILE(GLOB_RECURSE Quarter_CPP_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} Quarter/*.cpp) -FILE(GLOB_RECURSE Quarter_H_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} Quarter/*.h) - -SET(Quarter_MOC_HDR - Quarter/SignalThread.h - Quarter/InteractionMode.h - Quarter/SensorManager.h - Quarter/ContextMenu.h - Quarter/eventhandlers/FocusHandler.h - Quarter/eventhandlers/DragDropHandler.h - Quarter/eventhandlers/EventFilter.h - Quarter/QuarterWidget.h -) -qt4_wrap_cpp(Quarter_MOC_SRCS ${Quarter_MOC_HDR}) - -SET(Quarter_SRCS - ${Quarter_CPP_SRC} - ${Quarter_H_SRC} - ${Quarter_MOC_SRCS} -) -SOURCE_GROUP("Quarter" FILES ${Quarter_SRCS}) - -# The view provider sources -SET(Viewprovider_CPP_SRCS - ViewProvider.cpp - ViewProviderAnnotation.cpp - ViewProviderDocumentObject.cpp - ViewProviderDocumentObjectGroup.cpp - ViewProviderDocumentObjectPyImp.cpp - ViewProviderPythonFeaturePyImp.cpp - ViewProviderExtern.cpp - ViewProviderFeature.cpp - ViewProviderGeometryObject.cpp - ViewProviderInventorObject.cpp - ViewProviderMeasureDistance.cpp - ViewProviderPyImp.cpp - ViewProviderPythonFeature.cpp - ViewProviderVRMLObject.cpp - ViewProviderBuilder.cpp - ViewProviderPlacement.cpp - ViewProviderOriginFeature.cpp - ViewProviderPlane.cpp - ViewProviderLine.cpp - ViewProviderGeoFeatureGroup.cpp - ViewProviderOriginGroup.cpp - ViewProviderPart.cpp - ViewProviderOrigin.cpp - ViewProviderMaterialObject.cpp -) -SET(Viewprovider_SRCS - ${Viewprovider_CPP_SRCS} - ViewProvider.h - ViewProviderAnnotation.h - ViewProviderDocumentObject.h - ViewProviderDocumentObjectGroup.h - ViewProviderExtern.h - ViewProviderFeature.h - ViewProviderGeometryObject.h - ViewProviderInventorObject.h - ViewProviderMeasureDistance.h - ViewProviderPythonFeature.h - ViewProviderVRMLObject.h - ViewProviderBuilder.h - ViewProviderPlacement.h - ViewProviderOriginFeature.h - ViewProviderPlane.h - ViewProviderLine.h - ViewProviderGeoFeatureGroup.h - ViewProviderOriginGroup.h - ViewProviderPart.h - ViewProviderOrigin.h - ViewProviderMaterialObject.h -) -SOURCE_GROUP("View3D\\Viewprovider" FILES ${Viewprovider_SRCS}) - -# The Inventor sources -SET(Inventor_CPP_SRCS - Inventor/SoDrawingGrid.cpp - Inventor/SoAutoZoomTranslation.cpp - Inventor/MarkerBitmaps.cpp - SoFCBackgroundGradient.cpp - SoFCBoundingBox.cpp - SoFCColorBar.cpp - SoFCColorGradient.cpp - SoFCColorLegend.cpp - SoFCDB.cpp - SoFCInteractiveElement.cpp - SoFCOffscreenRenderer.cpp - SoFCSelection.cpp - SoFCUnifiedSelection.cpp - SoFCSelectionAction.cpp - SoFCVectorizeSVGAction.cpp - SoFCVectorizeU3DAction.cpp - SoNavigationDragger.cpp - SoAxisCrossKit.cpp - SoTextLabel.cpp - SoTouchEvents.cpp -<<<<<<< 09326bbbdaf756fe381d51d340e0db27fd8c452a - SoFCCSysDragger.cpp -======= ->>>>>>> Move post processing to fem objects -) -SET(Inventor_SRCS - ${Inventor_CPP_SRCS} - Inventor/SoDrawingGrid.h - Inventor/SoAutoZoomTranslation.h - Inventor/MarkerBitmaps.h - SoFCBackgroundGradient.h - SoFCBoundingBox.h - SoFCColorBar.h - SoFCColorGradient.h - SoFCColorLegend.h - SoFCDB.h - SoFCInteractiveElement.h - SoFCOffscreenRenderer.h - SoFCSelection.h - SoFCUnifiedSelection.h - SoFCSelectionAction.h - SoFCVectorizeSVGAction.h - SoFCVectorizeU3DAction.h - SoNavigationDragger.h - SoAxisCrossKit.h - SoTextLabel.h - SoTouchEvents.h -<<<<<<< 09326bbbdaf756fe381d51d340e0db27fd8c452a - SoFCCSysDragger.h -======= ->>>>>>> Move post processing to fem objects -) -SOURCE_GROUP("View3D\\Inventor" FILES ${Inventor_SRCS}) - -# The widget sources -SET(Widget_CPP_SRCS - FileDialog.cpp - MainWindow.cpp - PrefWidgets.cpp - InputField.cpp - ProgressBar.cpp - QuantitySpinBox.cpp - SpinBox.cpp - Splashscreen.cpp - WidgetFactory.cpp - Widgets.cpp - Window.cpp -) -SET(Widget_HPP_SRCS - FileDialog.h - MainWindow.h - PrefWidgets.h - InputField.h - ProgressBar.h - QuantitySpinBox.h - QuantitySpinBox_p.h - SpinBox.h - Splashscreen.h - WidgetFactory.h - Widgets.h - Window.h -) -SET(Widget_SRCS - ${Widget_CPP_SRCS} - ${Widget_HPP_SRCS} -) -SOURCE_GROUP("Widget" FILES ${Widget_SRCS}) - -# The view sources -SET(View_CPP_SRCS - MDIView.cpp - GraphvizView.cpp - ActiveObjectList.cpp -) -SET(View_HPP_SRCS - MDIView.h - GraphvizView.h - ActiveObjectList.h -) -SET(View_SRCS - ${View_CPP_SRCS} - ${View_HPP_SRCS} -) -SOURCE_GROUP("View" FILES ${View_SRCS}) - -# The workbench sources -SET(Workbench_CPP_SRCS - DockWindowManager.cpp - MenuManager.cpp - PythonWorkbenchPyImp.cpp - ToolBarManager.cpp - ToolBoxManager.cpp - Workbench.cpp - WorkbenchFactory.cpp - WorkbenchManager.cpp - WorkbenchPyImp.cpp -) -SET(Workbench_SRCS - ${Workbench_CPP_SRCS} - DockWindowManager.h - MenuManager.h - ToolBarManager.h - ToolBoxManager.h - Workbench.h - WorkbenchFactory.h - WorkbenchManager.h -) -SOURCE_GROUP("Workbench" FILES ${Workbench_SRCS}) - -SET(Selection_SRCS - SelectionObjectPyImp.cpp - SelectionObject.h - SelectionObject.cpp - Selection.h - Selection.cpp - SelectionFilter.h - SelectionFilter.cpp - SelectionFilter.y - SelectionFilter.l -) -SOURCE_GROUP("Selection" FILES ${Selection_SRCS}) - -# The FreeCADGui sources -SET(FreeCADGui_CPP_SRCS - Application.cpp - ApplicationPy.cpp - AutoSaver.cpp - BitmapFactory.cpp - Document.cpp - DocumentModel.cpp - DocumentPyImp.cpp - ExpressionBinding.cpp - GraphicsViewZoom.cpp - ExpressionCompleter.cpp - GuiApplication.cpp - GuiApplicationNativeEventAware.cpp - GuiConsole.cpp - Macro.cpp - MergeDocuments.cpp - resource.cpp - Control.cpp - SpaceballEvent.cpp - Thumbnail.cpp - Utilities.cpp - WaitCursor.cpp - ManualAlignment.cpp - WinNativeGestureRecognizers.cpp -) -SET(FreeCADGui_SRCS - Application.h - AutoSaver.h - BitmapFactory.h - Document.h - DocumentModel.h - ExpressionBinding.cpp - ExpressionCompleter.h - FreeCADGuiInit.py - GraphicsViewZoom.h - GuiApplication.h - GuiApplicationNativeEventAware.h - GuiConsole.h - InventorAll.h - Macro.h - MergeDocuments.h - PreCompiled.cpp - PreCompiled.h - Qt4All.h - Control.h - SpaceballEvent.h - Thumbnail.h - Utilities.h - WaitCursor.h - ManualAlignment.h - WinNativeGestureRecognizers.h -) - -SET(FreeCADGui_SRCS - ${FreeCADGui_SDK_SRCS} - ${FreeCADGui_CPP_SRCS} - ${FreeCADGui_XML_SRCS} - ${iis_MOC_SRCS} - ${qsint_MOC_SRCS} - ${Gui_QRC_SRCS} - ${Gui_UIC_HDRS} - ${Command_SRCS} - ${Dialog_SRCS} - ${Dialog_Customize_SRCS} - ${Dialog_Settings_SRCS} - ${Dock_Windows_SRCS} - ${Editor_SRCS} - ${Help_SRCS} - ${Inventor_SRCS} - ${Language_SRCS} - ${Propertyeditor_SRCS} - ${Task_View_SRCS} - ${iisTaskPanel_SRCS} - ${qsintActionPanel_SRCS} - ${Resource_SRCS} - ${Quarter_SRCS} - ${View3D_SRCS} - ${Viewprovider_SRCS} - ${Widget_SRCS} - ${View_SRCS} - ${Workbench_SRCS} - ${Selection_SRCS} - ${FreeCADGui_SRCS} -) - -if(MSVC) - add_definitions(-D_PreComp_) - SET(FreeCADGui_CPP_SRCS - Language/Translator.cpp - propertyeditor/PropertyEditor.cpp - propertyeditor/PropertyItem.cpp - propertyeditor/PropertyItemDelegate.cpp - propertyeditor/PropertyModel.cpp - TaskView/TaskAppearance.cpp - TaskView/TaskSelectLinkProperty.cpp - TaskView/TaskEditControl.cpp - TaskView/TaskView.cpp - ${Command_CPP_SRCS} - ${Dialog_CPP_SRCS} - ${Dialog_Customize_CPP_SRCS} - ${Dialog_Settings_CPP_SRCS} - ${Dock_Windows_CPP_SRCS} - ${Editor_CPP_SRCS} - ${Help_CPP_SRCS} - ${Inventor_CPP_SRCS} - ${View3D_CPP_SRCS} - ${Viewprovider_CPP_SRCS} - ${Widget_CPP_SRCS} - ${Workbench_CPP_SRCS} - ${FreeCADGui_CPP_SRCS} - ) - ADD_MSVC_PRECOMPILED_HEADER(FreeCADGui PreCompiled.h PreCompiled.cpp FreeCADGui_CPP_SRCS) -endif(MSVC) - -add_library(FreeCADGui SHARED ${FreeCADGui_SRCS}) - -target_link_libraries(FreeCADGui ${FreeCADGui_LIBS}) - -SET_BIN_DIR(FreeCADGui FreeCADGui) - -if(WIN32) - INSTALL(TARGETS FreeCADGui - RUNTIME DESTINATION bin - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) -else(WIN32) - INSTALL(TARGETS FreeCADGui - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) - INSTALL(FILES Icons/freecad.xpm - Icons/freecad-icon-16.png - Icons/freecad-icon-32.png - Icons/freecad-icon-48.png - Icons/freecad-icon-64.png - Icons/freecad.svg - Icons/freecad-doc.png - DESTINATION ${CMAKE_INSTALL_DATADIR} - ) -endif(WIN32) - diff --git a/src/Gui/SoFCDB.cpp.orig b/src/Gui/SoFCDB.cpp.orig deleted file mode 100644 index 7981724bc..000000000 --- a/src/Gui/SoFCDB.cpp.orig +++ /dev/null @@ -1,311 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2005 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" -#ifndef _PreComp_ -# include -# include -# include -# include -# include -#endif - -#include -#include -#include - -#include "SoFCDB.h" -#include "SoFCColorBar.h" -#include "SoFCColorLegend.h" -#include "SoFCColorGradient.h" -#include "SoFCSelection.h" -#include "SoFCBackgroundGradient.h" -#include "SoFCBoundingBox.h" -#include "SoFCSelection.h" -#include "SoFCUnifiedSelection.h" -#include "SoFCSelectionAction.h" -#include "SoFCInteractiveElement.h" -#include "SoFCUnifiedSelection.h" -#include "SoFCVectorizeSVGAction.h" -#include "SoFCVectorizeU3DAction.h" -#include "SoAxisCrossKit.h" -#include "SoTextLabel.h" -#include "SoNavigationDragger.h" -#include "Inventor/SoDrawingGrid.h" -#include "Inventor/SoAutoZoomTranslation.h" -#include "Inventor/MarkerBitmaps.h" -#include "SoFCCSysDragger.h" - -#include "propertyeditor/PropertyItem.h" -#include "NavigationStyle.h" -#include "Flag.h" -#include "SelectionObject.h" - -using namespace Gui; -using namespace Gui::Inventor; -using namespace Gui::PropertyEditor; - -static SbBool init_done = false; -static SoGroup *storage = nullptr; - -SbBool Gui::SoFCDB::isInitialized(void) -{ - return init_done; -} - -void Gui::SoFCDB::init() -{ - SoInteraction ::init(); - RotTransDragger ::initClass(); - SoGLRenderActionElement ::initClass(); - SoFCInteractiveElement ::initClass(); - SoGLWidgetElement ::initClass(); - SoFCColorBarBase ::initClass(); - SoFCColorBar ::initClass(); - SoFCColorLegend ::initClass(); - SoFCColorGradient ::initClass(); - SoFCBackgroundGradient ::initClass(); - SoFCBoundingBox ::initClass(); - SoFCSelection ::initClass(); - SoFCUnifiedSelection ::initClass(); - SoFCSelectionAction ::initClass(); - SoFCDocumentAction ::initClass(); - SoGLWidgetNode ::initClass(); - SoFCEnableSelectionAction ::initClass(); - SoFCEnableHighlightAction ::initClass(); - SoFCSelectionColorAction ::initClass(); - SoFCHighlightColorAction ::initClass(); - SoFCDocumentObjectAction ::initClass(); - SoGLSelectAction ::initClass(); - SoVisibleFaceAction ::initClass(); - SoBoxSelectionRenderAction ::initClass(); - SoFCVectorizeSVGAction ::initClass(); - SoFCVectorizeU3DAction ::initClass(); - SoHighlightElementAction ::initClass(); - SoSelectionElementAction ::initClass(); - SoVRMLAction ::initClass(); - SoSkipBoundingGroup ::initClass(); - SoTextLabel ::initClass(); - SoStringLabel ::initClass(); - SoFrameLabel ::initClass(); - TranslateManip ::initClass(); - SoShapeScale ::initClass(); - SoAxisCrossKit ::initClass(); - SoRegPoint ::initClass(); - SoDrawingGrid ::initClass(); - SoAutoZoomTranslation ::initClass(); - MarkerBitmaps ::initClass(); -<<<<<<< d7d347b2d62ec685840e7db1c35863e659148981 - SoFCCSysDragger ::initClass(); -======= - SoVTKActor ::initClass(); ->>>>>>> proof of concept - - PropertyItem ::init(); - PropertySeparatorItem ::init(); - PropertyStringItem ::init(); - PropertyFontItem ::init(); - PropertyIntegerItem ::init(); - PropertyIntegerConstraintItem ::init(); - PropertyFloatItem ::init(); - PropertyUnitItem ::init(); - PropertyFloatConstraintItem ::init(); - PropertyUnitConstraintItem ::init(); - PropertyAngleItem ::init(); - PropertyBoolItem ::init(); - PropertyVectorItem ::init(); - PropertyVectorDistanceItem ::init(); - PropertyMatrixItem ::init(); - PropertyPlacementItem ::init(); - PropertyEnumItem ::init(); - PropertyStringListItem ::init(); - PropertyFloatListItem ::init(); - PropertyIntegerListItem ::init(); - PropertyColorItem ::init(); - PropertyMaterialItem ::init(); - PropertyMaterialListItem ::init(); - PropertyFileItem ::init(); - PropertyPathItem ::init(); - PropertyTransientFileItem ::init(); - PropertyLinkItem ::init(); - - NavigationStyle ::init(); - UserNavigationStyle ::init(); - InventorNavigationStyle ::init(); - CADNavigationStyle ::init(); - BlenderNavigationStyle ::init(); - MayaGestureNavigationStyle ::init(); - TouchpadNavigationStyle ::init(); - GestureNavigationStyle ::init(); - OpenCascadeNavigationStyle ::init(); - - GLGraphicsItem ::init(); - GLFlagWindow ::init(); - - SelectionObject ::init(); - - qRegisterMetaType("Base::Vector3f"); - qRegisterMetaType("Base::Vector3d"); - qRegisterMetaType("Base::Quantity"); - qRegisterMetaType >("Base::QuantityList"); - init_done = true; - - assert(!storage); - storage = new SoGroup(); - storage->ref(); -} - -void Gui::SoFCDB::finish() -{ - // Coin doesn't provide a mechanism to free static members of own data types. - // Hence, we need to define a static method e.g. 'finish()' for all new types - // to invoke the private member function 'atexit_cleanup()'. - SoFCColorBarBase ::finish(); - SoFCColorBar ::finish(); - SoFCColorLegend ::finish(); - SoFCColorGradient ::finish(); - SoFCBackgroundGradient ::finish(); - SoFCBoundingBox ::finish(); - SoFCSelection ::finish(); - SoFCSelectionAction ::finish(); - SoFCDocumentAction ::finish(); - SoFCDocumentObjectAction ::finish(); - SoFCEnableSelectionAction ::finish(); - SoFCEnableHighlightAction ::finish(); - SoFCSelectionColorAction ::finish(); - SoFCHighlightColorAction ::finish(); - - storage->unref(); - storage = nullptr; -} - -// buffer acrobatics for inventor **************************************************** -static char * buffer; -static size_t buffer_size = 0; -static std::string cReturnString; - -static void * -buffer_realloc(void * bufptr, size_t size) -{ - buffer = (char *)realloc(bufptr, size); - buffer_size = size; - return buffer; -} - -const std::string& Gui::SoFCDB::writeNodesToString(SoNode * root) -{ - SoOutput out; - buffer = (char *)malloc(1024); - buffer_size = 1024; - out.setBuffer(buffer, buffer_size, buffer_realloc); - if (root && root->getTypeId().isDerivedFrom(SoVRMLParent::getClassTypeId())) - out.setHeaderString("#VRML V2.0 utf8"); - - SoWriteAction wa(&out); - wa.apply(root); - - cReturnString = buffer; - free(buffer); - return cReturnString; -} - -bool Gui::SoFCDB::writeToVRML(SoNode* node, const char* filename, bool binary) -{ - SoVRMLAction vrml2; - vrml2.setOverrideMode(true); - vrml2.apply(node); - SoToVRML2Action tovrml2; - tovrml2.apply(node); - SoVRMLGroup* vrmlRoot = tovrml2.getVRML2SceneGraph(); - vrmlRoot->setInstancePrefix(SbString("o")); - vrmlRoot->ref(); - std::string buffer = SoFCDB::writeNodesToString(vrmlRoot); - vrmlRoot->unref(); // release the memory as soon as possible - - // restore old settings - vrml2.setOverrideMode(false); - vrml2.apply(node); - - Base::FileInfo fi(filename); - if (binary) { - // We want to write compressed VRML but Coin 2.4.3 doesn't do it even though - // SoOutput::getAvailableCompressionMethods() delivers a string list that - // contains 'GZIP'. setCompression() was called directly after opening the file, - // returned true and no error message appeared but anyway it didn't work. - // Strange is that reading GZIPped VRML files works. - // So, we do the compression on our own. - Base::ofstream str(fi, std::ios::out | std::ios::binary); - zipios::GZIPOutputStream gzip(str); - - if (gzip) { - gzip << buffer; - gzip.close(); - return true; - } - } - else { - Base::ofstream str(fi, std::ios::out); - - if (str) { - str << buffer; - str.close(); - return true; - } - } - - return false; -} - -bool Gui::SoFCDB::writeToFile(SoNode* node, const char* filename, bool binary) -{ - bool ret = false; - Base::FileInfo fi(filename); - - // Write VRML V2.0 - if (fi.hasExtension("wrl") || fi.hasExtension("vrml") || fi.hasExtension("wrz")) { - // If 'wrz' is set then force compression - if (fi.hasExtension("wrz")) - binary = true; - - ret = SoFCDB::writeToVRML(node, filename, binary); - } - else if (fi.hasExtension("iv")) { - // Write Inventor in ASCII - std::string buffer = SoFCDB::writeNodesToString(node); - Base::ofstream str(Base::FileInfo(filename), std::ios::out); - - if (str) { - str << buffer; - str.close(); - ret = true; - } - } - - return ret; -} - -SoGroup* Gui::SoFCDB::getStorage() -{ - assert(storage); //call init first. - return storage; -} diff --git a/src/Gui/SoFCDB.cpp.orig.orig b/src/Gui/SoFCDB.cpp.orig.orig deleted file mode 100644 index 4d108bb3f..000000000 --- a/src/Gui/SoFCDB.cpp.orig.orig +++ /dev/null @@ -1,310 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2005 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" -#ifndef _PreComp_ -# include -# include -# include -# include -# include -#endif - -#include -#include -#include - -#include "SoFCDB.h" -#include "SoFCColorBar.h" -#include "SoFCColorLegend.h" -#include "SoFCColorGradient.h" -#include "SoFCSelection.h" -#include "SoFCBackgroundGradient.h" -#include "SoFCBoundingBox.h" -#include "SoFCSelection.h" -#include "SoFCUnifiedSelection.h" -#include "SoFCSelectionAction.h" -#include "SoFCInteractiveElement.h" -#include "SoFCUnifiedSelection.h" -#include "SoFCVectorizeSVGAction.h" -#include "SoFCVectorizeU3DAction.h" -#include "SoAxisCrossKit.h" -#include "SoTextLabel.h" -#include "SoNavigationDragger.h" -#include "Inventor/SoDrawingGrid.h" -#include "Inventor/SoAutoZoomTranslation.h" -#include "Inventor/MarkerBitmaps.h" -#include "SoFCCSysDragger.h" - -#include "propertyeditor/PropertyItem.h" -#include "NavigationStyle.h" -#include "Flag.h" -#include "SelectionObject.h" - -using namespace Gui; -using namespace Gui::Inventor; -using namespace Gui::PropertyEditor; - -static SbBool init_done = false; -static SoGroup *storage = nullptr; - -SbBool Gui::SoFCDB::isInitialized(void) -{ - return init_done; -} - -void Gui::SoFCDB::init() -{ - SoInteraction ::init(); - RotTransDragger ::initClass(); - SoGLRenderActionElement ::initClass(); - SoFCInteractiveElement ::initClass(); - SoGLWidgetElement ::initClass(); - SoFCColorBarBase ::initClass(); - SoFCColorBar ::initClass(); - SoFCColorLegend ::initClass(); - SoFCColorGradient ::initClass(); - SoFCBackgroundGradient ::initClass(); - SoFCBoundingBox ::initClass(); - SoFCSelection ::initClass(); - SoFCUnifiedSelection ::initClass(); - SoFCSelectionAction ::initClass(); - SoFCDocumentAction ::initClass(); - SoGLWidgetNode ::initClass(); - SoFCEnableSelectionAction ::initClass(); - SoFCEnableHighlightAction ::initClass(); - SoFCSelectionColorAction ::initClass(); - SoFCHighlightColorAction ::initClass(); - SoFCDocumentObjectAction ::initClass(); - SoGLSelectAction ::initClass(); - SoVisibleFaceAction ::initClass(); - SoBoxSelectionRenderAction ::initClass(); - SoFCVectorizeSVGAction ::initClass(); - SoFCVectorizeU3DAction ::initClass(); - SoHighlightElementAction ::initClass(); - SoSelectionElementAction ::initClass(); - SoVRMLAction ::initClass(); - SoSkipBoundingGroup ::initClass(); - SoTextLabel ::initClass(); - SoStringLabel ::initClass(); - SoFrameLabel ::initClass(); - TranslateManip ::initClass(); - SoShapeScale ::initClass(); - SoAxisCrossKit ::initClass(); - SoRegPoint ::initClass(); - SoDrawingGrid ::initClass(); - SoAutoZoomTranslation ::initClass(); - MarkerBitmaps ::initClass(); -<<<<<<< 09326bbbdaf756fe381d51d340e0db27fd8c452a - SoFCCSysDragger ::initClass(); -======= ->>>>>>> Move post processing to fem objects - - PropertyItem ::init(); - PropertySeparatorItem ::init(); - PropertyStringItem ::init(); - PropertyFontItem ::init(); - PropertyIntegerItem ::init(); - PropertyIntegerConstraintItem ::init(); - PropertyFloatItem ::init(); - PropertyUnitItem ::init(); - PropertyFloatConstraintItem ::init(); - PropertyUnitConstraintItem ::init(); - PropertyAngleItem ::init(); - PropertyBoolItem ::init(); - PropertyVectorItem ::init(); - PropertyVectorDistanceItem ::init(); - PropertyMatrixItem ::init(); - PropertyPlacementItem ::init(); - PropertyEnumItem ::init(); - PropertyStringListItem ::init(); - PropertyFloatListItem ::init(); - PropertyIntegerListItem ::init(); - PropertyColorItem ::init(); - PropertyMaterialItem ::init(); - PropertyMaterialListItem ::init(); - PropertyFileItem ::init(); - PropertyPathItem ::init(); - PropertyTransientFileItem ::init(); - PropertyLinkItem ::init(); - - NavigationStyle ::init(); - UserNavigationStyle ::init(); - InventorNavigationStyle ::init(); - CADNavigationStyle ::init(); - BlenderNavigationStyle ::init(); - MayaGestureNavigationStyle ::init(); - TouchpadNavigationStyle ::init(); - GestureNavigationStyle ::init(); - OpenCascadeNavigationStyle ::init(); - - GLGraphicsItem ::init(); - GLFlagWindow ::init(); - - SelectionObject ::init(); - - qRegisterMetaType("Base::Vector3f"); - qRegisterMetaType("Base::Vector3d"); - qRegisterMetaType("Base::Quantity"); - qRegisterMetaType >("Base::QuantityList"); - init_done = true; - - assert(!storage); - storage = new SoGroup(); - storage->ref(); -} - -void Gui::SoFCDB::finish() -{ - // Coin doesn't provide a mechanism to free static members of own data types. - // Hence, we need to define a static method e.g. 'finish()' for all new types - // to invoke the private member function 'atexit_cleanup()'. - SoFCColorBarBase ::finish(); - SoFCColorBar ::finish(); - SoFCColorLegend ::finish(); - SoFCColorGradient ::finish(); - SoFCBackgroundGradient ::finish(); - SoFCBoundingBox ::finish(); - SoFCSelection ::finish(); - SoFCSelectionAction ::finish(); - SoFCDocumentAction ::finish(); - SoFCDocumentObjectAction ::finish(); - SoFCEnableSelectionAction ::finish(); - SoFCEnableHighlightAction ::finish(); - SoFCSelectionColorAction ::finish(); - SoFCHighlightColorAction ::finish(); - - storage->unref(); - storage = nullptr; -} - -// buffer acrobatics for inventor **************************************************** -static char * buffer; -static size_t buffer_size = 0; -static std::string cReturnString; - -static void * -buffer_realloc(void * bufptr, size_t size) -{ - buffer = (char *)realloc(bufptr, size); - buffer_size = size; - return buffer; -} - -const std::string& Gui::SoFCDB::writeNodesToString(SoNode * root) -{ - SoOutput out; - buffer = (char *)malloc(1024); - buffer_size = 1024; - out.setBuffer(buffer, buffer_size, buffer_realloc); - if (root && root->getTypeId().isDerivedFrom(SoVRMLParent::getClassTypeId())) - out.setHeaderString("#VRML V2.0 utf8"); - - SoWriteAction wa(&out); - wa.apply(root); - - cReturnString = buffer; - free(buffer); - return cReturnString; -} - -bool Gui::SoFCDB::writeToVRML(SoNode* node, const char* filename, bool binary) -{ - SoVRMLAction vrml2; - vrml2.setOverrideMode(true); - vrml2.apply(node); - SoToVRML2Action tovrml2; - tovrml2.apply(node); - SoVRMLGroup* vrmlRoot = tovrml2.getVRML2SceneGraph(); - vrmlRoot->setInstancePrefix(SbString("o")); - vrmlRoot->ref(); - std::string buffer = SoFCDB::writeNodesToString(vrmlRoot); - vrmlRoot->unref(); // release the memory as soon as possible - - // restore old settings - vrml2.setOverrideMode(false); - vrml2.apply(node); - - Base::FileInfo fi(filename); - if (binary) { - // We want to write compressed VRML but Coin 2.4.3 doesn't do it even though - // SoOutput::getAvailableCompressionMethods() delivers a string list that - // contains 'GZIP'. setCompression() was called directly after opening the file, - // returned true and no error message appeared but anyway it didn't work. - // Strange is that reading GZIPped VRML files works. - // So, we do the compression on our own. - Base::ofstream str(fi, std::ios::out | std::ios::binary); - zipios::GZIPOutputStream gzip(str); - - if (gzip) { - gzip << buffer; - gzip.close(); - return true; - } - } - else { - Base::ofstream str(fi, std::ios::out); - - if (str) { - str << buffer; - str.close(); - return true; - } - } - - return false; -} - -bool Gui::SoFCDB::writeToFile(SoNode* node, const char* filename, bool binary) -{ - bool ret = false; - Base::FileInfo fi(filename); - - // Write VRML V2.0 - if (fi.hasExtension("wrl") || fi.hasExtension("vrml") || fi.hasExtension("wrz")) { - // If 'wrz' is set then force compression - if (fi.hasExtension("wrz")) - binary = true; - - ret = SoFCDB::writeToVRML(node, filename, binary); - } - else if (fi.hasExtension("iv")) { - // Write Inventor in ASCII - std::string buffer = SoFCDB::writeNodesToString(node); - Base::ofstream str(Base::FileInfo(filename), std::ios::out); - - if (str) { - str << buffer; - str.close(); - ret = true; - } - } - - return ret; -} - -SoGroup* Gui::SoFCDB::getStorage() -{ - assert(storage); //call init first. - return storage; -} diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index b5558bb09..2634a936b 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -129,25 +129,6 @@ #include "WinNativeGestureRecognizers.h" #include "Document.h" -/* -#include "SoVTKActor.h" -#include "vtkDataSetSurfaceFilter.h" -#include "vtkGeometryFilter.h" -#include "vtkLookupTable.h" -#include "vtkPointData.h" -#include "vtkCellData.h" -#include "vtkContourFilter.h" -#include "vtkCubeSource.h" -#include "vtkPlane.h" -#include "vtkCutter.h" -#include "vtkHedgeHog.h" -#include "vtkGlyph3D.h" -#include "vtkArrowSource.h" -#include "vtkPointSource.h" -#include "vtkRungeKutta4.h" -#include "vtkStreamTracer.h" -#include "vtkPointLocator.h" -*/ //#define FC_LOGGING_CB using namespace Gui; @@ -546,7 +527,6 @@ void View3DInventorViewer::init() cursor = QBitmap::fromData(QSize(PAN_WIDTH, PAN_HEIGHT), pan_bitmap); mask = QBitmap::fromData(QSize(PAN_WIDTH, PAN_HEIGHT), pan_mask_bitmap); panCursor = QCursor(cursor, mask, PAN_HOT_X, PAN_HOT_Y); - } View3DInventorViewer::~View3DInventorViewer() diff --git a/src/Mod/Fem/App/AppFem.cpp.orig b/src/Mod/Fem/App/AppFem.cpp.orig deleted file mode 100644 index 7bb1cdda8..000000000 --- a/src/Mod/Fem/App/AppFem.cpp.orig +++ /dev/null @@ -1,339 +0,0 @@ -<<<<<<< 43b51b168bc838480fd6a0a4b9f67e0bf864a560 -/*************************************************************************** - * Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" -#ifndef _PreComp_ -# include -#endif - -#include -#include -#include - -#include "FemMeshPy.h" -#include "FemMesh.h" -#include "FemMeshProperty.h" -#include "FemAnalysis.h" -#include "FemMeshObject.h" -#include "FemMeshShapeObject.h" -#include "FemMeshShapeNetgenObject.h" - -#include "FemSetElementsObject.h" -#include "FemSetFacesObject.h" -#include "FemSetGeometryObject.h" -#include "FemSetNodesObject.h" - -#include "HypothesisPy.h" -#include "FemConstraintBearing.h" -#include "FemConstraintFixed.h" -#include "FemConstraintForce.h" -#include "FemConstraintPressure.h" -#include "FemConstraintGear.h" -#include "FemConstraintPulley.h" -#include "FemConstraintDisplacement.h" - -#include "FemResultObject.h" -#include "FemSolverObject.h" - -#ifdef FC_USE_VTK -#include "FemPostPipeline.h" -#include "FemPostFilter.h" -#include "FemPostFunction.h" -#endif - -namespace Fem { -extern PyObject* initModule(); -} - -/* Python entry */ -PyMODINIT_FUNC initFem() -{ - // load dependend module - try { - Base::Interpreter().loadModule("Part"); - //Base::Interpreter().loadModule("Mesh"); - } - catch(const Base::Exception& e) { - PyErr_SetString(PyExc_ImportError, e.what()); - return; - } - PyObject* femModule = Fem::initModule(); - Base::Console().Log("Loading Fem module... done\n"); - - Fem::StdMeshers_Arithmetic1DPy ::init_type(femModule); - Fem::StdMeshers_AutomaticLengthPy ::init_type(femModule); - Fem::StdMeshers_NotConformAllowedPy ::init_type(femModule); - Fem::StdMeshers_MaxLengthPy ::init_type(femModule); - Fem::StdMeshers_LocalLengthPy ::init_type(femModule); - Fem::StdMeshers_QuadranglePreferencePy ::init_type(femModule); - Fem::StdMeshers_Quadrangle_2DPy ::init_type(femModule); - Fem::StdMeshers_MaxElementAreaPy ::init_type(femModule); - Fem::StdMeshers_Regular_1DPy ::init_type(femModule); - Fem::StdMeshers_UseExisting_1DPy ::init_type(femModule); - Fem::StdMeshers_UseExisting_2DPy ::init_type(femModule); - Fem::StdMeshers_CompositeSegment_1DPy ::init_type(femModule); - Fem::StdMeshers_Deflection1DPy ::init_type(femModule); - Fem::StdMeshers_LayerDistributionPy ::init_type(femModule); - Fem::StdMeshers_LengthFromEdgesPy ::init_type(femModule); - Fem::StdMeshers_MaxElementVolumePy ::init_type(femModule); - Fem::StdMeshers_MEFISTO_2DPy ::init_type(femModule); - Fem::StdMeshers_NumberOfLayersPy ::init_type(femModule); - Fem::StdMeshers_NumberOfSegmentsPy ::init_type(femModule); - Fem::StdMeshers_Prism_3DPy ::init_type(femModule); - Fem::StdMeshers_Projection_1DPy ::init_type(femModule); - Fem::StdMeshers_Projection_2DPy ::init_type(femModule); - Fem::StdMeshers_Projection_3DPy ::init_type(femModule); - Fem::StdMeshers_ProjectionSource1DPy ::init_type(femModule); - Fem::StdMeshers_ProjectionSource2DPy ::init_type(femModule); - Fem::StdMeshers_ProjectionSource3DPy ::init_type(femModule); - Fem::StdMeshers_QuadraticMeshPy ::init_type(femModule); - Fem::StdMeshers_RadialPrism_3DPy ::init_type(femModule); - Fem::StdMeshers_SegmentAroundVertex_0DPy ::init_type(femModule); - Fem::StdMeshers_SegmentLengthAroundVertexPy ::init_type(femModule); - Fem::StdMeshers_StartEndLengthPy ::init_type(femModule); - Fem::StdMeshers_TrianglePreferencePy ::init_type(femModule); - Fem::StdMeshers_Hexa_3DPy ::init_type(femModule); - - // Add Types to module - Base::Interpreter().addType(&Fem::FemMeshPy::Type,femModule,"FemMesh"); - - - // NOTE: To finish the initialization of our own type objects we must - // call PyType_Ready, otherwise we run into a segmentation fault, later on. - // This function is responsible for adding inherited slots from a type's base class. - - Fem::FemAnalysis ::init(); - Fem::FemAnalysisPython ::init(); - Fem::DocumentObject ::init(); - Fem::FeaturePython ::init(); - Fem::FemMesh ::init(); - Fem::FemMeshObject ::init(); - Fem::FemMeshShapeObject ::init(); - Fem::FemMeshShapeNetgenObject ::init(); - Fem::PropertyFemMesh ::init(); - - Fem::FemSetObject ::init(); - Fem::FemSetElementsObject ::init(); - Fem::FemSetFacesObject ::init(); - Fem::FemSetGeometryObject ::init(); - Fem::FemSetNodesObject ::init(); - - Fem::Constraint ::init(); - Fem::ConstraintBearing ::init(); - Fem::ConstraintFixed ::init(); - Fem::ConstraintForce ::init(); - Fem::ConstraintPressure ::init(); - Fem::ConstraintGear ::init(); - Fem::ConstraintPulley ::init(); - Fem::ConstraintDisplacement ::init(); - - Fem::FemResultObject ::init(); - Fem::FemSolverObject ::init(); - Fem::FemSolverObjectPython ::init(); - -#ifdef FC_USE_VTK - Fem::FemPostObject ::init(); - Fem::FemPostPipeline ::init(); - Fem::FemPostFilter ::init(); - Fem::FemPostClipFilter ::init(); - Fem::FemPostScalarClipFilter ::init(); - Fem::FemPostWarpVectorFilter ::init(); - Fem::FemPostCutFilter ::init(); - Fem::FemPostFunction ::init(); - Fem::FemPostFunctionProvider ::init(); - Fem::FemPostPlaneFunction ::init(); - Fem::FemPostSphereFunction ::init(); -#endif -} -======= -/*************************************************************************** - * Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" -#ifndef _PreComp_ -# include -#endif - -#include -#include -#include - -#include "FemMeshPy.h" -#include "FemMesh.h" -#include "FemMeshProperty.h" -#include "FemAnalysis.h" -#include "FemMeshObject.h" -#include "FemMeshShapeObject.h" -#include "FemMeshShapeNetgenObject.h" - -#include "FemSetElementsObject.h" -#include "FemSetFacesObject.h" -#include "FemSetGeometryObject.h" -#include "FemSetNodesObject.h" - -#include "HypothesisPy.h" -#include "FemConstraintBearing.h" -#include "FemConstraintFixed.h" -#include "FemConstraintForce.h" -#include "FemConstraintPressure.h" -#include "FemConstraintGear.h" -#include "FemConstraintPulley.h" -#include "FemConstraintDisplacement.h" - -#include "FemResultObject.h" -#include "FemSolverObject.h" - -#ifdef FC_USE_VTK -#include "FemPostPipeline.h" -#include "FemPostFilter.h" -#include "FemPostFunction.h" -#include "PropertyPostDataObject.h" -#endif - -namespace Fem { -extern PyObject* initModule(); -} - -/* Python entry */ -PyMODINIT_FUNC initFem() -{ - // load dependend module - try { - Base::Interpreter().loadModule("Part"); - //Base::Interpreter().loadModule("Mesh"); - } - catch(const Base::Exception& e) { - PyErr_SetString(PyExc_ImportError, e.what()); - return; - } - PyObject* femModule = Fem::initModule(); - Base::Console().Log("Loading Fem module... done\n"); - - Fem::StdMeshers_Arithmetic1DPy ::init_type(femModule); - Fem::StdMeshers_AutomaticLengthPy ::init_type(femModule); - Fem::StdMeshers_NotConformAllowedPy ::init_type(femModule); - Fem::StdMeshers_MaxLengthPy ::init_type(femModule); - Fem::StdMeshers_LocalLengthPy ::init_type(femModule); - Fem::StdMeshers_QuadranglePreferencePy ::init_type(femModule); - Fem::StdMeshers_Quadrangle_2DPy ::init_type(femModule); - Fem::StdMeshers_MaxElementAreaPy ::init_type(femModule); - Fem::StdMeshers_Regular_1DPy ::init_type(femModule); - Fem::StdMeshers_UseExisting_1DPy ::init_type(femModule); - Fem::StdMeshers_UseExisting_2DPy ::init_type(femModule); - Fem::StdMeshers_CompositeSegment_1DPy ::init_type(femModule); - Fem::StdMeshers_Deflection1DPy ::init_type(femModule); - Fem::StdMeshers_LayerDistributionPy ::init_type(femModule); - Fem::StdMeshers_LengthFromEdgesPy ::init_type(femModule); - Fem::StdMeshers_MaxElementVolumePy ::init_type(femModule); - Fem::StdMeshers_MEFISTO_2DPy ::init_type(femModule); - Fem::StdMeshers_NumberOfLayersPy ::init_type(femModule); - Fem::StdMeshers_NumberOfSegmentsPy ::init_type(femModule); - Fem::StdMeshers_Prism_3DPy ::init_type(femModule); - Fem::StdMeshers_Projection_1DPy ::init_type(femModule); - Fem::StdMeshers_Projection_2DPy ::init_type(femModule); - Fem::StdMeshers_Projection_3DPy ::init_type(femModule); - Fem::StdMeshers_ProjectionSource1DPy ::init_type(femModule); - Fem::StdMeshers_ProjectionSource2DPy ::init_type(femModule); - Fem::StdMeshers_ProjectionSource3DPy ::init_type(femModule); - Fem::StdMeshers_QuadraticMeshPy ::init_type(femModule); - Fem::StdMeshers_RadialPrism_3DPy ::init_type(femModule); - Fem::StdMeshers_SegmentAroundVertex_0DPy ::init_type(femModule); - Fem::StdMeshers_SegmentLengthAroundVertexPy ::init_type(femModule); - Fem::StdMeshers_StartEndLengthPy ::init_type(femModule); - Fem::StdMeshers_TrianglePreferencePy ::init_type(femModule); - Fem::StdMeshers_Hexa_3DPy ::init_type(femModule); - - // Add Types to module - Base::Interpreter().addType(&Fem::FemMeshPy::Type,femModule,"FemMesh"); - - - // NOTE: To finish the initialization of our own type objects we must - // call PyType_Ready, otherwise we run into a segmentation fault, later on. - // This function is responsible for adding inherited slots from a type's base class. - - Fem::FemAnalysis ::init(); - Fem::FemAnalysisPython ::init(); - Fem::DocumentObject ::init(); - Fem::FeaturePython ::init(); - Fem::FemMesh ::init(); - Fem::FemMeshObject ::init(); - Fem::FemMeshShapeObject ::init(); - Fem::FemMeshShapeNetgenObject ::init(); - Fem::PropertyFemMesh ::init(); - - Fem::FemSetObject ::init(); - Fem::FemSetElementsObject ::init(); - Fem::FemSetFacesObject ::init(); - Fem::FemSetGeometryObject ::init(); - Fem::FemSetNodesObject ::init(); - - Fem::Constraint ::init(); - Fem::ConstraintBearing ::init(); - Fem::ConstraintFixed ::init(); - Fem::ConstraintForce ::init(); - Fem::ConstraintPressure ::init(); - Fem::ConstraintGear ::init(); - Fem::ConstraintPulley ::init(); - Fem::ConstraintDisplacement ::init(); - - Fem::FemResultObject ::init(); - Fem::FemSolverObject ::init(); - Fem::FemSolverObjectPython ::init(); - -#ifdef FC_USE_VTK - Fem::FemPostObject ::init(); - Fem::FemPostPipeline ::init(); - Fem::FemPostFilter ::init(); - Fem::FemPostClipFilter ::init(); - Fem::FemPostScalarClipFilter ::init(); - Fem::FemPostWarpVectorFilter ::init(); - Fem::FemPostCutFilter ::init(); - Fem::FemPostFunction ::init(); - Fem::FemPostFunctionProvider ::init(); - Fem::FemPostPlaneFunction ::init(); - Fem::FemPostSphereFunction ::init(); - Fem::PropertyPostDataObject ::init(); -#endif -} ->>>>>>> FreeCADify the vtk post processing diff --git a/src/Mod/Fem/App/AppFemPy.cpp.orig b/src/Mod/Fem/App/AppFemPy.cpp.orig deleted file mode 100644 index e99a67f18..000000000 --- a/src/Mod/Fem/App/AppFemPy.cpp.orig +++ /dev/null @@ -1,535 +0,0 @@ -<<<<<<< 9049674212e3b4f1429e82bfa203304100632838 -/*************************************************************************** - * Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" -#ifndef _PreComp_ -# include -# include -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -//#include -//#include -//#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "FemMesh.h" -#include "FemMeshObject.h" -#include "FemPostPipeline.h" -#include "FemMeshPy.h" - -#include - -#include -#include -#include - -namespace Fem { -class Module : public Py::ExtensionModule -{ -public: - Module() : Py::ExtensionModule("Fem") - { - add_varargs_method("open",&Module::open, - "open(string) -- Create a new document and a Mesh::Import feature to load the file into the document." - ); - add_varargs_method("insert",&Module::insert, - "insert(string|mesh,[string]) -- Load or insert a mesh into the given or active document." - ); - add_varargs_method("export",&Module::exporter, - "export(list,string) -- Export a list of objects into a single file." - ); - add_varargs_method("read",&Module::read, - "Read a mesh from a file and returns a Mesh object." - ); - add_varargs_method("show",&Module::show, - "show(shape) -- Add the shape to the active document or create one if no document exists." - ); - initialize("This module is the Fem module."); // register with Python - } - - virtual ~Module() {} - -private: - virtual Py::Object invoke_method_varargs(void *method_def, const Py::Tuple &args) - { - try { - return Py::ExtensionModule::invoke_method_varargs(method_def, args); - } - catch (const Standard_Failure &e) { - std::string str; - Standard_CString msg = e.GetMessageString(); - str += typeid(e).name(); - str += " "; - if (msg) {str += msg;} - else {str += "No OCCT Exception Message";} - throw Py::Exception(Part::PartExceptionOCCError, str); - } - catch (const Base::Exception &e) { - throw Py::RuntimeError(e.what()); - } - catch (const std::exception &e) { - throw Py::RuntimeError(e.what()); - } - } - Py::Object open(const Py::Tuple& args) - { - char* Name; - if (!PyArg_ParseTuple(args.ptr(), "et","utf-8",&Name)) - throw Py::Exception(); - - std::string EncodedName = std::string(Name); - PyMem_Free(Name); - - std::auto_ptr mesh(new FemMesh); - mesh->read(EncodedName.c_str()); - Base::FileInfo file(EncodedName.c_str()); - // create new document and add Import feature - App::Document *pcDoc = App::GetApplication().newDocument("Unnamed"); - FemMeshObject *pcFeature = static_cast - (pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str())); - pcFeature->Label.setValue(file.fileNamePure().c_str()); - pcFeature->FemMesh.setValuePtr(mesh.get()); - (void)mesh.release(); - pcFeature->purgeTouched(); - - return Py::None(); - } - Py::Object insert(const Py::Tuple& args) - { - char* Name; - const char* DocName = 0; - if (!PyArg_ParseTuple(args.ptr(), "et|s","utf-8",&Name,&DocName)) - throw Py::Exception(); - - std::string EncodedName = std::string(Name); - PyMem_Free(Name); - - App::Document *pcDoc = 0; - if (DocName) - pcDoc = App::GetApplication().getDocument(DocName); - else - pcDoc = App::GetApplication().getActiveDocument(); - - if (!pcDoc) { - pcDoc = App::GetApplication().newDocument(DocName); - } - - Base::FileInfo file(EncodedName.c_str()); - - try { - std::auto_ptr mesh(new FemMesh); - mesh->read(EncodedName.c_str()); - - FemMeshObject *pcFeature = static_cast - (pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str())); - pcFeature->Label.setValue(file.fileNamePure().c_str()); - pcFeature->FemMesh.setValuePtr(mesh.get()); - (void)mesh.release(); - pcFeature->purgeTouched(); - } - catch(Base::Exception& e) { -#ifdef FC_USE_VTK - if( FemPostPipeline::canRead(file) ) { - - FemPostPipeline *pcFeature = static_cast - (pcDoc->addObject("Fem::FemPostPipeline", file.fileNamePure().c_str())); - - pcFeature->Label.setValue(file.fileNamePure().c_str()); - pcFeature->read(file); - pcFeature->touch(); - pcDoc->recomputeFeature(pcFeature); - } - else - throw e; -#else - throw e; -#endif - } - - return Py::None(); - } - Py::Object exporter(const Py::Tuple& args) - { - PyObject* object; - char* Name; - if (!PyArg_ParseTuple(args.ptr(), "Oet",&object,"utf-8",&Name)) - throw Py::Exception(); - - std::string EncodedName = std::string(Name); - PyMem_Free(Name); - - Py::Sequence list(object); - Base::Type meshId = Base::Type::fromName("Fem::FemMeshObject"); - for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { - PyObject* item = (*it).ptr(); - if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) { - App::DocumentObject* obj = static_cast(item)->getDocumentObjectPtr(); - if (obj->getTypeId().isDerivedFrom(meshId)) { - static_cast(obj)->FemMesh.getValue().write(EncodedName.c_str()); - break; - } - } - } - - return Py::None(); - } - Py::Object read(const Py::Tuple& args) - { - char* Name; - if (!PyArg_ParseTuple(args.ptr(), "et","utf-8",&Name)) - throw Py::Exception(); - - std::string EncodedName = std::string(Name); - PyMem_Free(Name); - - std::auto_ptr mesh(new FemMesh); - mesh->read(EncodedName.c_str()); - return Py::asObject(new FemMeshPy(mesh.release())); - } - Py::Object show(const Py::Tuple& args) - { - PyObject *pcObj; - if (!PyArg_ParseTuple(args.ptr(), "O!", &(FemMeshPy::Type), &pcObj)) - throw Py::Exception(); - - App::Document *pcDoc = App::GetApplication().getActiveDocument(); - if (!pcDoc) - pcDoc = App::GetApplication().newDocument(); - - FemMeshPy* pShape = static_cast(pcObj); - Fem::FemMeshObject *pcFeature = (Fem::FemMeshObject *)pcDoc->addObject("Fem::FemMeshObject", "Mesh"); - // copy the data - //TopoShape* shape = new MeshObject(*pShape->getTopoShapeObjectPtr()); - pcFeature->FemMesh.setValue(*(pShape->getFemMeshPtr())); - pcDoc->recompute(); - - return Py::None(); - } -}; - -PyObject* initModule() -{ - return (new Module)->module().ptr(); -} - -} // namespace Fem -======= -/*************************************************************************** - * Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" -#ifndef _PreComp_ -# include -# include -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -//#include -//#include -//#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "FemMesh.h" -#include "FemMeshObject.h" -#include "FemMeshPy.h" -#ifdef FC_USE_VTK -#include "FemPostPipeline.h" -#endif - -#include - -#include -#include -#include - -namespace Fem { -class Module : public Py::ExtensionModule -{ -public: - Module() : Py::ExtensionModule("Fem") - { - add_varargs_method("open",&Module::open, - "open(string) -- Create a new document and a Mesh::Import feature to load the file into the document." - ); - add_varargs_method("insert",&Module::insert, - "insert(string|mesh,[string]) -- Load or insert a mesh into the given or active document." - ); - add_varargs_method("export",&Module::exporter, - "export(list,string) -- Export a list of objects into a single file." - ); - add_varargs_method("read",&Module::read, - "Read a mesh from a file and returns a Mesh object." - ); - add_varargs_method("show",&Module::show, - "show(shape) -- Add the shape to the active document or create one if no document exists." - ); - initialize("This module is the Fem module."); // register with Python - } - - virtual ~Module() {} - -private: - virtual Py::Object invoke_method_varargs(void *method_def, const Py::Tuple &args) - { - try { - return Py::ExtensionModule::invoke_method_varargs(method_def, args); - } - catch (const Standard_Failure &e) { - std::string str; - Standard_CString msg = e.GetMessageString(); - str += typeid(e).name(); - str += " "; - if (msg) {str += msg;} - else {str += "No OCCT Exception Message";} - throw Py::Exception(Part::PartExceptionOCCError, str); - } - catch (const Base::Exception &e) { - throw Py::RuntimeError(e.what()); - } - catch (const std::exception &e) { - throw Py::RuntimeError(e.what()); - } - } - Py::Object open(const Py::Tuple& args) - { - char* Name; - if (!PyArg_ParseTuple(args.ptr(), "et","utf-8",&Name)) - throw Py::Exception(); - - std::string EncodedName = std::string(Name); - PyMem_Free(Name); - - std::auto_ptr mesh(new FemMesh); - mesh->read(EncodedName.c_str()); - Base::FileInfo file(EncodedName.c_str()); - // create new document and add Import feature - App::Document *pcDoc = App::GetApplication().newDocument("Unnamed"); - FemMeshObject *pcFeature = static_cast - (pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str())); - pcFeature->Label.setValue(file.fileNamePure().c_str()); - pcFeature->FemMesh.setValuePtr(mesh.get()); - (void)mesh.release(); - pcFeature->purgeTouched(); - - return Py::None(); - } - Py::Object insert(const Py::Tuple& args) - { - char* Name; - const char* DocName = 0; - if (!PyArg_ParseTuple(args.ptr(), "et|s","utf-8",&Name,&DocName)) - throw Py::Exception(); - - std::string EncodedName = std::string(Name); - PyMem_Free(Name); - - App::Document *pcDoc = 0; - if (DocName) - pcDoc = App::GetApplication().getDocument(DocName); - else - pcDoc = App::GetApplication().getActiveDocument(); - - if (!pcDoc) { - pcDoc = App::GetApplication().newDocument(DocName); - } - - Base::FileInfo file(EncodedName.c_str()); - - try { - std::auto_ptr mesh(new FemMesh); - mesh->read(EncodedName.c_str()); - - FemMeshObject *pcFeature = static_cast - (pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str())); - pcFeature->Label.setValue(file.fileNamePure().c_str()); - pcFeature->FemMesh.setValuePtr(mesh.get()); - (void)mesh.release(); - pcFeature->purgeTouched(); - } - catch(Base::Exception& e) { -#ifdef FC_USE_VTK - if( FemPostPipeline::canRead(file) ) { - - FemPostPipeline *pcFeature = static_cast - (pcDoc->addObject("Fem::FemPostPipeline", file.fileNamePure().c_str())); - - pcFeature->Label.setValue(file.fileNamePure().c_str()); - pcFeature->read(file); - pcFeature->touch(); - pcDoc->recomputeFeature(pcFeature); - } - else - throw e; -#else - throw e; -#endif - } - - return Py::None(); - } - Py::Object exporter(const Py::Tuple& args) - { - PyObject* object; - char* Name; - if (!PyArg_ParseTuple(args.ptr(), "Oet",&object,"utf-8",&Name)) - throw Py::Exception(); - - std::string EncodedName = std::string(Name); - PyMem_Free(Name); - - Py::Sequence list(object); - Base::Type meshId = Base::Type::fromName("Fem::FemMeshObject"); - for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { - PyObject* item = (*it).ptr(); - if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) { - App::DocumentObject* obj = static_cast(item)->getDocumentObjectPtr(); - if (obj->getTypeId().isDerivedFrom(meshId)) { - static_cast(obj)->FemMesh.getValue().write(EncodedName.c_str()); - break; - } - } - } - - return Py::None(); - } - Py::Object read(const Py::Tuple& args) - { - char* Name; - if (!PyArg_ParseTuple(args.ptr(), "et","utf-8",&Name)) - throw Py::Exception(); - - std::string EncodedName = std::string(Name); - PyMem_Free(Name); - - std::auto_ptr mesh(new FemMesh); - mesh->read(EncodedName.c_str()); - return Py::asObject(new FemMeshPy(mesh.release())); - } - Py::Object show(const Py::Tuple& args) - { - PyObject *pcObj; - if (!PyArg_ParseTuple(args.ptr(), "O!", &(FemMeshPy::Type), &pcObj)) - throw Py::Exception(); - - App::Document *pcDoc = App::GetApplication().getActiveDocument(); - if (!pcDoc) - pcDoc = App::GetApplication().newDocument(); - - FemMeshPy* pShape = static_cast(pcObj); - Fem::FemMeshObject *pcFeature = (Fem::FemMeshObject *)pcDoc->addObject("Fem::FemMeshObject", "Mesh"); - // copy the data - //TopoShape* shape = new MeshObject(*pShape->getTopoShapeObjectPtr()); - pcFeature->FemMesh.setValue(*(pShape->getFemMeshPtr())); - pcDoc->recompute(); - - return Py::None(); - } -}; - -PyObject* initModule() -{ - return (new Module)->module().ptr(); -} - -} // namespace Fem ->>>>>>> Fem Post: fix vtk include wthout guard diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt index 220d98d71..72467bb27 100755 --- a/src/Mod/Fem/App/CMakeLists.txt +++ b/src/Mod/Fem/App/CMakeLists.txt @@ -122,7 +122,6 @@ SET(FemScripts_SRCS FemSelectionObserver.py TestFem.py z88DispReader.py - TaskPanelFemBeamSection.ui TaskPanelFemShellThickness.ui TaskPanelFemSolverCalculix.ui @@ -222,7 +221,7 @@ SET(Fem_SRCS ${FemSet_SRCS} ${FemConstraints_SRCS} ${FemResult_SRCS} -....${FemPost_SRCS} + ${FemPost_SRCS} ${Mod_SRCS} ${Python_SRCS} ) diff --git a/src/Mod/Fem/App/CMakeLists.txt.orig b/src/Mod/Fem/App/CMakeLists.txt.orig deleted file mode 100755 index abfb11da3..000000000 --- a/src/Mod/Fem/App/CMakeLists.txt.orig +++ /dev/null @@ -1,236 +0,0 @@ -if(MSVC) - add_definitions(-DFCAppFem -DHAVE_ACOSH -DHAVE_ASINH -DHAVE_ATANH) -else(MSVC) - add_definitions(-DHAVE_LIMITS_H -DHAVE_CONFIG_H) -endif(MSVC) - -if(BUILD_FEM_NETGEN) - add_definitions(-DFCWithNetgen ${NETGEN_DEFINITIONS}) -endif(BUILD_FEM_NETGEN) - - -include_directories( - ${CMAKE_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/src - ${CMAKE_BINARY_DIR}/src - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/src/3rdParty/ANN/include - ${Boost_INCLUDE_DIRS} - ${QT_INCLUDE_DIR} - ${OCC_INCLUDE_DIR} - ${PYTHON_INCLUDE_DIRS} - ${ZLIB_INCLUDE_DIR} - ${XercesC_INCLUDE_DIRS} - ${SMESH_INCLUDE_DIR} -) - -link_directories(${OCC_LIBRARY_DIR}) - -set(Fem_LIBS - Part - FreeCADApp - StdMeshers - SMESH - SMDS - SMESHDS - ) - -if(BUILD_FEM_NETGEN) - set(Fem_LIBS - ${Fem_LIBS} - NETGENPlugin - ) -endif(BUILD_FEM_NETGEN) - -if(BUILD_FEM_VTK) - set(Fem_LIBS - ${Fem_LIBS} - ${VTK_LIBRARIES} - ) -endif(BUILD_FEM_VTK) - -generate_from_xml(FemMeshPy) - - -SET(Python_SRCS - FemMeshPy.xml - FemMeshPyImp.cpp - HypothesisPy.cpp - HypothesisPy.h -) -SOURCE_GROUP("Python" FILES ${Python_SRCS}) - -SET(Mod_SRCS - AppFem.cpp - AppFemPy.cpp - FemTools.cpp - FemTools.h - PreCompiled.cpp - PreCompiled.h -) -SOURCE_GROUP("Module" FILES ${Mod_SRCS}) - -SET(FemScripts_SRCS - _CommandFemBeamSection.py - _CommandFemFromShape.py - _CommandFemShellThickness.py - _CommandFemSolverCalculix.py - _CommandMechanicalMaterial.py - _CommandMechanicalShowResult.py - _CommandNewMechanicalAnalysis.py - _CommandPurgeFemResults.py - _CommandQuickAnalysis.py - _CommandSolverJobControl.py - _FemAnalysis.py - _FemBeamSection.py - _FemShellThickness.py - _FemSolverCalculix.py - _MechanicalMaterial.py - _TaskPanelFemBeamSection.py - _TaskPanelFemShellThickness.py - _TaskPanelFemSolverCalculix.py - _TaskPanelMechanicalMaterial.py - _TaskPanelResultControl.py - _ViewProviderFemAnalysis.py - _ViewProviderFemBeamSection.py - _ViewProviderFemShellThickness.py - _ViewProviderFemSolverCalculix.py - _ViewProviderMechanicalMaterial.py - ccxDatReader.py - ccxFrdReader.py - ccxInpWriter.py - convert2TetGen.py - Init.py - InitGui.py - FemAnalysis.py - FemCommands.py - FemBeamSection.py - FemShellThickness.py - FemSolverCalculix.py - FemTools.py - MechanicalMaterial.py - SelectionObserverFem.py - TestFem.py - - TaskPanelFemBeamSection.ui - TaskPanelFemShellThickness.ui - TaskPanelFemSolverCalculix.ui - TaskPanelMechanicalMaterial.ui - TaskPanelShowDisplacement.ui -) -#SOURCE_GROUP("Scripts" FILES ${FemScripts_SRCS}) - -SET(FemTests_SRCS - test_files/ccx/mesh_points.csv - test_files/ccx/mesh_volumes.csv - test_files/ccx/cube_frequency.inp - test_files/ccx/cube_frequency.dat - test_files/ccx/cube_frequency.frd - test_files/ccx/cube_frequency_expected_values - test_files/ccx/cube_static.inp - test_files/ccx/cube_static.dat - test_files/ccx/cube_static.frd - test_files/ccx/cube_static_expected_values - test_files/ccx/cube.fcstd -) - -SET(FemBase_SRCS - FemMeshObject.cpp - FemMeshObject.h - FemMeshShapeObject.cpp - FemMeshShapeObject.h - FemMeshShapeNetgenObject.cpp - FemMeshShapeNetgenObject.h - FemAnalysis.cpp - FemAnalysis.h - FemMesh.cpp - FemMesh.h - FemResultObject.cpp - FemResultObject.h - FemSolverObject.cpp - FemSolverObject.h - FemConstraint.cpp - FemConstraint.h - FemMeshProperty.cpp - FemMeshProperty.h - ) -SOURCE_GROUP("Base types" FILES ${FemBase_SRCS}) - - -SET(FemSet_SRCS - FemSetObject.cpp - FemSetObject.h - FemSetNodesObject.cpp - FemSetNodesObject.h - FemSetElementsObject.cpp - FemSetElementsObject.h - FemSetFacesObject.cpp - FemSetFacesObject.h - FemSetGeometryObject.cpp - FemSetGeometryObject.h - ) -SOURCE_GROUP("Set objects" FILES ${FemSet_SRCS}) - -SET(FemConstraints_SRCS - FemConstraintBearing.h - FemConstraintBearing.cpp - FemConstraintFixed.cpp - FemConstraintFixed.h - FemConstraintForce.cpp - FemConstraintForce.h - FemConstraintPressure.cpp - FemConstraintPressure.h - FemConstraintGear.cpp - FemConstraintGear.h - FemConstraintPulley.cpp - FemConstraintPulley.h - FemConstraintDisplacement.h - FemConstraintDisplacement.cpp - ) -SOURCE_GROUP("Constraints" FILES ${FemConstraints_SRCS}) - -if(BUILD_FEM_VTK) - SET(FemPost_SRCS - FemPostObject.h - FemPostObject.cpp - FemPostPipeline.h - FemPostPipeline.cpp - FemPostFilter.h - FemPostFilter.cpp -<<<<<<< eec6f7aee8b6e5979a799358e2ae69bdc5a7af5b - ) -======= - FemPostFunction.h - FemPostFunction.cpp - ) ->>>>>>> Basic implementation of filter framework - SOURCE_GROUP("PostObjects" FILES ${FemPost_SRCS}) -endif(BUILD_FEM_VTK) - - -SET(Fem_SRCS - ${FemBase_SRCS} - ${FemSet_SRCS} - ${FemConstraints_SRCS} - ${FemResult_SRCS} -....${FemPost_SRCS} - ${Mod_SRCS} - ${Python_SRCS} -) - -add_library(Fem SHARED ${Fem_SRCS}) -target_link_libraries(Fem ${Fem_LIBS}) - - -fc_target_copy_resource(Fem - ${CMAKE_SOURCE_DIR}/src/Mod/Fem - ${CMAKE_BINARY_DIR}/Mod/Fem - Init.py - ${FemScripts_SRCS} - ${FemTests_SRCS} - ) - -SET_BIN_DIR(Fem Fem /Mod/Fem) -SET_PYTHON_PREFIX_SUFFIX(Fem) - -INSTALL(TARGETS Fem DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/Mod/Fem/Gui/Command.cpp.orig b/src/Mod/Fem/Gui/Command.cpp.orig deleted file mode 100644 index 60d18be1a..000000000 --- a/src/Mod/Fem/Gui/Command.cpp.orig +++ /dev/null @@ -1,2315 +0,0 @@ -<<<<<<< 43b51b168bc838480fd6a0a4b9f67e0bf864a560 -/*************************************************************************** - * Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" -#ifndef _PreComp_ -# include -# include -# include -#include -#endif - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include "ActiveAnalysisObserver.h" - -#ifdef FC_USE_VTK -#include -#endif - -using namespace std; - - -bool getConstraintPrerequisits(Fem::FemAnalysis **Analysis) -{ - Fem::FemAnalysis* ActiveAnalysis = FemGui::ActiveAnalysisObserver::instance()->getActiveObject(); - if (!ActiveAnalysis || !ActiveAnalysis->getTypeId().isDerivedFrom(Fem::FemAnalysis::getClassTypeId())){ - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No active Analysis"), - QObject::tr("You need to create or activate a Analysis")); - return true; - } - - *Analysis = static_cast(ActiveAnalysis); - - // return with no error - return false; - -} - -//OvG: Visibility automation show parts and hide meshes on activation of a constraint -std::string gethideMeshShowPartStr(std::string showConstr="") -{ - return "for amesh in App.activeDocument().Objects:\n\ - if \""+showConstr+"\" == amesh.Name:\n\ - amesh.ViewObject.Visibility = True\n\ - elif \"Mesh\" in amesh.TypeId:\n\ - aparttoshow = amesh.Name.replace(\"_Mesh\",\"\")\n\ - for apart in App.activeDocument().Objects:\n\ - if aparttoshow == apart.Name:\n\ - apart.ViewObject.Visibility = True\n\ - amesh.ViewObject.Visibility = False\n"; -} - -//===================================================================================== -DEF_STD_CMD_A(CmdFemCreateAnalysis); - -CmdFemCreateAnalysis::CmdFemCreateAnalysis() - : Command("Fem_CreateAnalysis") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create a FEM analysis"); - sToolTipText = QT_TR_NOOP("Create a FEM analysis"); - sWhatsThis = "Fem_CreateAnalysis"; - sStatusTip = sToolTipText; - sPixmap = "fem-analysis"; -} - -void CmdFemCreateAnalysis::activated(int iMsg) -{ -#ifndef FCWithNetgen - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), - QObject::tr("Your FreeCAD is build without NETGEN support. Meshing will not work....")); - return; -#endif - - std::vector selection = getSelection().getSelectionEx(); - - if (selection.size() != 1) { - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), - QObject::tr("Select an edge, face or body. Only one body is allowed.")); - return; - } - - if (!selection[0].isObjectTypeOf(Part::Feature::getClassTypeId())){ - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong object type"), - QObject::tr("Fillet works only on parts")); - return; - } - - Part::Feature *base = static_cast(selection[0].getObject()); - - std::string AnalysisName = getUniqueObjectName("FemAnalysis"); - - std::string MeshName = getUniqueObjectName((std::string(base->getNameInDocument()) +"_Mesh").c_str()); - - - openCommand("Create FEM analysis"); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemAnalysis','%s')",AnalysisName.c_str()); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemMeshShapeNetgenObject','%s')",MeshName.c_str()); - doCommand(Doc,"App.activeDocument().ActiveObject.Shape = App.activeDocument().%s",base->getNameInDocument()); - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s",AnalysisName.c_str(),MeshName.c_str()); - addModule(Gui,"FemGui"); - doCommand(Gui,"FemGui.setActiveAnalysis(App.activeDocument().%s)",AnalysisName.c_str()); - commitCommand(); - - updateActive(); -} - -bool CmdFemCreateAnalysis::isActive(void) -{ - return !FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemAddPart); - -CmdFemAddPart::CmdFemAddPart() - : Command("Fem_FemAddPart") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Add a part to the Analysis"); - sToolTipText = QT_TR_NOOP("Add a part to the Analysis"); - sWhatsThis = "Fem_FemAddPart"; - sStatusTip = sToolTipText; - sPixmap = "fem-add-fem-mesh"; -} - -void CmdFemAddPart::activated(int iMsg) -{ -#ifndef FCWithNetgen - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), - QObject::tr("Your FreeCAD is build without NETGEN support. Meshing will not work....")); - return; -#endif - - std::vector selection = getSelection().getSelectionEx(); - - if (selection.size() != 1) { - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), - QObject::tr("Select an edge, face or body. Only one body is allowed.")); - return; - } - - if (!selection[0].isObjectTypeOf(Part::Feature::getClassTypeId())){ - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong object type"), - QObject::tr("Fillet works only on parts")); - return; - } - - Part::Feature *base = static_cast(selection[0].getObject()); - - std::string AnalysisName = getUniqueObjectName("FemAnalysis"); - std::string MeshName = getUniqueObjectName((std::string(base->getNameInDocument()) +"_Mesh").c_str()); - - openCommand("Create FEM analysis"); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemAnalysis','%s')",AnalysisName.c_str()); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemMeshShapeNetgenObject','%s')",MeshName.c_str()); - doCommand(Doc,"App.activeDocument().ActiveObject.Shape = App.activeDocument().%s",base->getNameInDocument()); - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s",AnalysisName.c_str(),MeshName.c_str()); - addModule(Gui,"FemGui"); - doCommand(Gui,"FemGui.setActiveAnalysis(App.activeDocument().%s)",AnalysisName.c_str()); - commitCommand(); - - updateActive(); -} - -bool CmdFemAddPart::isActive(void) -{ - if (Gui::Control().activeDialog()) - return false; - Base::Type type = Base::Type::fromName("Part::Feature"); - return Gui::Selection().countObjectsOfType(type) > 0; -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemCreateSolver); - -CmdFemCreateSolver::CmdFemCreateSolver() - : Command("Fem_CreateSolver") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Add a solver to the Analysis"); - sToolTipText = QT_TR_NOOP("Add a solver to the Analysis"); - sWhatsThis = "Fem_CreateSolver"; - sStatusTip = sToolTipText; - sPixmap = "fem-solver"; -} - -void CmdFemCreateSolver::activated(int iMsg) -{ -#ifndef FCWithNetgen - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), - QObject::tr("Your FreeCAD is build without NETGEN support. Meshing will not work....")); - return; -#endif - - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("Solver"); - - openCommand("Create solver for FEM or CFD analysis"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::FemSolverObject\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemCreateSolver::isActive(void) -{ - return hasActiveDocument(); -} - -//===================================================================================== - - -DEF_STD_CMD_A(CmdFemConstraintBearing); - -CmdFemConstraintBearing::CmdFemConstraintBearing() - : Command("Fem_ConstraintBearing") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM bearing constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a bearing"); - sWhatsThis = "Fem_ConstraintBearing"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-bearing"; -} - -void CmdFemConstraintBearing::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("FemConstraintBearing"); - - openCommand("Make FEM constraint for bearing"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintBearing\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintBearing::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemConstraintFixed); - -CmdFemConstraintFixed::CmdFemConstraintFixed() - : Command("Fem_ConstraintFixed") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM fixed constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a fixed geometric entity"); - sWhatsThis = "Fem_ConstraintFixed"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-fixed"; -} - -void CmdFemConstraintFixed::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("FemConstraintFixed"); - - openCommand("Make FEM constraint fixed geometry"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintFixed\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Scale = 1",FeatName.c_str()); //OvG: set initial scale to 1 - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintFixed::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemConstraintForce); - -CmdFemConstraintForce::CmdFemConstraintForce() - : Command("Fem_ConstraintForce") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM force constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a force acting on a geometric entity"); - sWhatsThis = "Fem_ConstraintForce"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-force"; -} - -void CmdFemConstraintForce::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("FemConstraintForce"); - - openCommand("Make FEM constraint force on geometry"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintForce\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Force = 1.0",FeatName.c_str()); //OvG: set default not equal to 0 - doCommand(Doc,"App.activeDocument().%s.Reversed = False",FeatName.c_str()); //OvG: set default to False - doCommand(Doc,"App.activeDocument().%s.Scale = 1",FeatName.c_str()); //OvG: set initial scale to 1 - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintForce::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemConstraintPressure); - -CmdFemConstraintPressure::CmdFemConstraintPressure() - : Command("Fem_ConstraintPressure") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM pressure constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a pressure acting on a face"); - sWhatsThis = "Fem_ConstraintPressure"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-pressure"; -} - -void CmdFemConstraintPressure::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("FemConstraintPressure"); - - openCommand("Make FEM constraint pressure on face"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintPressure\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Pressure = 1000.0",FeatName.c_str()); //OvG: set default not equal to 0 - doCommand(Doc,"App.activeDocument().%s.Reversed = False",FeatName.c_str()); //OvG: set default to False - doCommand(Doc,"App.activeDocument().%s.Scale = 1",FeatName.c_str()); //OvG: set initial scale to 1 - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]", - Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintPressure::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemConstraintGear); - -CmdFemConstraintGear::CmdFemConstraintGear() - : Command("Fem_ConstraintGear") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM gear constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a gear"); - sWhatsThis = "Fem_ConstraintGear"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-gear"; -} - -void CmdFemConstraintGear::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - std::string FeatName = getUniqueObjectName("FemConstraintGear"); - - openCommand("Make FEM constraint for gear"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintGear\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Diameter = 100.0",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintGear::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemConstraintPulley); - -CmdFemConstraintPulley::CmdFemConstraintPulley() - : Command("Fem_ConstraintPulley") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM pulley constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a pulley"); - sWhatsThis = "Fem_ConstraintPulley"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-pulley"; -} - -void CmdFemConstraintPulley::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("FemConstraintPulley"); - - openCommand("Make FEM constraint for pulley"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintPulley\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Diameter = 300.0",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.OtherDiameter = 100.0",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.CenterDistance = 500.0",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Force = 100.0",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.TensionForce = 100.0",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintPulley::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} -//===================================================================================== - -DEF_STD_CMD_A(CmdFemConstraintDisplacement); - -CmdFemConstraintDisplacement::CmdFemConstraintDisplacement() - : Command("Fem_ConstraintDisplacement") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM displacement constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a displacement acting on a face"); - sWhatsThis = "Fem_ConstraintDisplacement"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-displacement"; -} - -void CmdFemConstraintDisplacement::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("FemConstraintDisplacement"); - - openCommand("Make FEM constraint displacement on face"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintDisplacement\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Scale = 1",FeatName.c_str()); //OvG: set initial scale to 1 - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]", - Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintDisplacement::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} -// ##################################################################################################### - - - -DEF_STD_CMD_A(CmdFemDefineNodesSet); - - -void DefineNodesCallback(void * ud, SoEventCallback * n) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - // show the wait cursor because this could take quite some time - Gui::WaitCursor wc; - - // When this callback function is invoked we must in either case leave the edit mode - Gui::View3DInventorViewer* view = reinterpret_cast(n->getUserData()); - view->setEditing(false); - view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), DefineNodesCallback,ud); - n->setHandled(); - - SbBool clip_inner; - std::vector clPoly = view->getGLPolygon(&clip_inner); - if (clPoly.size() < 3) - return; - if (clPoly.front() != clPoly.back()) - clPoly.push_back(clPoly.front()); - - SoCamera* cam = view->getSoRenderManager()->getCamera(); - SbViewVolume vv = cam->getViewVolume(); - Gui::ViewVolumeProjection proj(vv); - Base::Polygon2D polygon; - for (std::vector::const_iterator it = clPoly.begin(); it != clPoly.end(); ++it) - polygon.Add(Base::Vector2D((*it)[0],(*it)[1])); - - - std::vector docObj = Gui::Selection().getObjectsOfType(Fem::FemMeshObject::getClassTypeId()); - if(docObj.size() !=1) - return; - - const SMESHDS_Mesh* data = const_cast(dynamic_cast(docObj[0])->FemMesh.getValue().getSMesh())->GetMeshDS(); - - SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator(); - Base::Vector3f pt2d; - std::set IntSet; - - while (aNodeIter->more()) { - const SMDS_MeshNode* aNode = aNodeIter->next(); - Base::Vector3f vec(aNode->X(),aNode->Y(),aNode->Z()); - pt2d = proj(vec); - if (polygon.Contains(Base::Vector2D(pt2d.x, pt2d.y)) == true) - IntSet.insert(aNode->GetID()); - } - - std::stringstream set; - - set << "["; - for(std::set::const_iterator it=IntSet.begin();it!=IntSet.end();++it) - if(it==IntSet.begin()) - set << *it ; - else - set << "," << *it ; - set << "]"; - - - Gui::Command::openCommand("Place robot"); - Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.addObject('Fem::FemSetNodesObject','NodeSet')"); - Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.ActiveObject.Nodes = %s",set.str().c_str()); - Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().NodeSet]",Analysis->getNameInDocument(),Analysis->getNameInDocument()); - ////Gui::Command::updateActive(); - Gui::Command::commitCommand(); - - //std::vector views = view->getViewProvidersOfType(ViewProviderMesh::getClassTypeId()); - //if (!views.empty()) { - // Gui::Application::Instance->activeDocument()->openCommand("Cut"); - // for (std::vector::iterator it = views.begin(); it != views.end(); ++it) { - // ViewProviderMesh* that = static_cast(*it); - // if (that->getEditingMode() > -1) { - // that->finishEditing(); - // that->cutMesh(clPoly, *view, clip_inner); - // } - // } - - // Gui::Application::Instance->activeDocument()->commitCommand(); - - // view->render(); - //} -} - - - -CmdFemDefineNodesSet::CmdFemDefineNodesSet() - : Command("Fem_DefineNodesSet") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create node set by Poly"); - sToolTipText = QT_TR_NOOP("Create node set by Poly"); - sWhatsThis = "Create node set by Poly"; - sStatusTip = QT_TR_NOOP("Create node set by Poly"); - sPixmap = "fem-fem-mesh-create-node-by-poly"; -} - -void CmdFemDefineNodesSet::activated(int iMsg) -{ - std::vector docObj = Gui::Selection().getObjectsOfType(Fem::FemMeshObject::getClassTypeId()); - - for (std::vector::iterator it = docObj.begin(); it != docObj.end(); ++it) { - if (it == docObj.begin()) { - Gui::Document* doc = getActiveGuiDocument(); - Gui::MDIView* view = doc->getActiveView(); - if (view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { - Gui::View3DInventorViewer* viewer = ((Gui::View3DInventor*)view)->getViewer(); - viewer->setEditing(true); - viewer->startSelection(Gui::View3DInventorViewer::Clip); - viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), DefineNodesCallback); - } - else { - return; - } - } - - //Gui::ViewProvider* pVP = getActiveGuiDocument()->getViewProvider(*it); - //if (pVP->isVisible()) - // pVP->startEditing(); - } -} - -bool CmdFemDefineNodesSet::isActive(void) -{ - // Check for the selected mesh feature (all Mesh types) - if (getSelection().countObjectsOfType(Fem::FemMeshObject::getClassTypeId()) != 1) - return false; - - Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { - Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); - return !viewer->isEditing(); - } - - return false; -} - - -// ##################################################################################################### - -DEF_STD_CMD_A(CmdFemCreateNodesSet); - -CmdFemCreateNodesSet::CmdFemCreateNodesSet() - : Command("Fem_CreateNodesSet") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Define/create a nodes set..."); - sToolTipText = QT_TR_NOOP("Define/create a nodes set..."); - sWhatsThis = "Fem_CreateNodesSet"; - sStatusTip = sToolTipText; - sPixmap = "fem-fem-mesh-create-node-by-poly"; -} - -void CmdFemCreateNodesSet::activated(int iMsg) -{ - Gui::SelectionFilter ObjectFilter("SELECT Fem::FemSetNodesObject COUNT 1"); - Gui::SelectionFilter FemMeshFilter("SELECT Fem::FemMeshObject COUNT 1"); - - if (ObjectFilter.match()) { - Fem::FemSetNodesObject *NodesObj = static_cast(ObjectFilter.Result[0][0].getObject()); - openCommand("Edit nodes set"); - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",NodesObj->getNameInDocument()); - } - else if (FemMeshFilter.match()) { - Fem::FemMeshObject *MeshObj = static_cast(FemMeshFilter.Result[0][0].getObject()); - - std::string FeatName = getUniqueObjectName("NodesSet"); - - openCommand("Create nodes set"); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemSetNodesObject','%s')",FeatName.c_str()); - doCommand(Gui,"App.activeDocument().%s.FemMesh = App.activeDocument().%s",FeatName.c_str(),MeshObj->getNameInDocument()); - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); - } - else { - QMessageBox::warning(Gui::getMainWindow(), - qApp->translate("CmdFemCreateNodesSet", "Wrong selection"), - qApp->translate("CmdFemCreateNodesSet", "Select a single FEM mesh or nodes set, please.")); - } -} - -bool CmdFemCreateNodesSet::isActive(void) -{ - return hasActiveDocument(); -} - - -// ##################################################################################################### - -#ifdef FC_USE_VTK - -void setupFilter(Gui::Command* cmd, std::string Name) { - - std::vector pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType(); - if (!pipelines.empty()) { - Fem::FemPostPipeline *pipeline = pipelines.front(); - - std::string FeatName = cmd->getUniqueObjectName(Name.c_str()); - - cmd->openCommand("Create filter"); - cmd->doCommand(Gui::Command::Doc,"App.activeDocument().addObject('Fem::FemPost%sFilter','%s')", Name.c_str(), FeatName.c_str()); - cmd->doCommand(Gui::Command::Doc,"__list__ = App.ActiveDocument.%s.Filter", pipeline->getNameInDocument()); - cmd->doCommand(Gui::Command::Doc,"__list__.append(App.ActiveDocument.%s)", FeatName.c_str()); - cmd->doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Filter = __list__", pipeline->getNameInDocument()); - cmd->doCommand(Gui::Command::Doc,"del __list__"); - - cmd->updateActive(); - cmd->doCommand(Gui::Command::Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); - - } - else { - QMessageBox::warning(Gui::getMainWindow(), - qApp->translate("CmdFemPostCreateClipFilter", "Wrong selection"), - qApp->translate("CmdFemPostCreateClipFilter", "Select a pipeline, please.")); - } - -}; - -DEF_STD_CMD_A(CmdFemPostCreateClipFilter); - -CmdFemPostCreateClipFilter::CmdFemPostCreateClipFilter() - : Command("Fem_PostCreateClipFilter") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Define/create a clip filter which uses functions to define the cliped region"); - sToolTipText = QT_TR_NOOP("Define/create a clip filter which uses functions to define the cliped region"); - sWhatsThis = "Fem_PostCreateClipFilter"; - sStatusTip = sToolTipText; - sPixmap = "fem-clip"; -} - -void CmdFemPostCreateClipFilter::activated(int iMsg) -{ - setupFilter(this, "Clip"); -} - -bool CmdFemPostCreateClipFilter::isActive(void) -{ - return hasActiveDocument(); -} - -DEF_STD_CMD_A(CmdFemPostCreateScalarClipFilter); - -CmdFemPostCreateScalarClipFilter::CmdFemPostCreateScalarClipFilter() - : Command("Fem_PostCreateScalarClipFilter") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Define/create a clip filter which clips a field with a scalar value"); - sToolTipText = QT_TR_NOOP("Define/create a clip filter which clips a field with a scalar value"); - sWhatsThis = "Fem_PostCreateScalarClipFilter"; - sStatusTip = sToolTipText; - sPixmap = "fem-clip-scalar"; -} - -void CmdFemPostCreateScalarClipFilter::activated(int iMsg) -{ - setupFilter(this, "ScalarClip"); -} - -bool CmdFemPostCreateScalarClipFilter::isActive(void) -{ - return hasActiveDocument(); -} - - - -DEF_STD_CMD_A(CmdFemPostWarpVectorFilter); - -CmdFemPostWarpVectorFilter::CmdFemPostWarpVectorFilter() - : Command("Fem_PostCreateWarpVectorFilter") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Warp the geometry along a vector field by a certain factor"); - sToolTipText = QT_TR_NOOP("Warp the geometry along a vector field by a certain factor"); - sWhatsThis = "Fem_PostCreateWarpVectorFilter"; - sStatusTip = sToolTipText; - sPixmap = "fem-warp"; -} - -void CmdFemPostWarpVectorFilter::activated(int iMsg) -{ - setupFilter(this, "WarpVector"); -} - -bool CmdFemPostWarpVectorFilter::isActive(void) -{ - return hasActiveDocument(); -} - -DEF_STD_CMD_A(CmdFemPostCutFilter); - -CmdFemPostCutFilter::CmdFemPostCutFilter() - : Command("Fem_PostCreateCutFilter") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Cut the data along an implicit function"); - sToolTipText = QT_TR_NOOP("Cut the data along an implicit function"); - sWhatsThis = "Fem_PostCreateCutFilter"; - sStatusTip = sToolTipText; - sPixmap = "fem-cut"; -} - -void CmdFemPostCutFilter::activated(int iMsg) -{ - setupFilter(this, "Cut"); -} - -bool CmdFemPostCutFilter::isActive(void) -{ - return hasActiveDocument(); -} - -// ##################################################################################################### - - -DEF_STD_CMD_ACL(CmdFemPostFunctions); - -CmdFemPostFunctions::CmdFemPostFunctions() - : Command("Fem_PostCreateFunctions") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Functions for use in postprocessing filter..."); - sToolTipText = QT_TR_NOOP("Functions for use in postprocessing filter..."); - sWhatsThis = "Fem_PostCreateFunctions"; - sStatusTip = sToolTipText; - eType = eType|ForEdit; -} - -void CmdFemPostFunctions::activated(int iMsg) -{ - - std::string name; - if (iMsg==0) - name = "Plane"; - else if (iMsg==1) - name = "Sphere"; - else - return; - - //create the object - std::vector pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType(); - if (!pipelines.empty()) { - Fem::FemPostPipeline *pipeline = pipelines.front(); - - openCommand("Create function"); - - //check if the pipeline has a filter provider and add one if needed - Fem::FemPostFunctionProvider* provider; - if(!pipeline->Function.getValue() || pipeline->Function.getValue()->getTypeId() != Fem::FemPostFunctionProvider::getClassTypeId()) { - std::string FuncName = getUniqueObjectName("Functions"); - doCommand(Doc,"App.ActiveDocument.addObject('Fem::FemPostFunctionProvider','%s')", FuncName.c_str()); - doCommand(Doc,"App.ActiveDocument.%s.Function = App.ActiveDocument.%s", pipeline->getNameInDocument(), FuncName.c_str()); - provider = static_cast(getDocument()->getObject(FuncName.c_str())); - } - else - provider = static_cast(pipeline->Function.getValue()); - - //build the object - std::string FeatName = getUniqueObjectName(name.c_str()); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemPost%sFunction','%s')", name.c_str(), FeatName.c_str()); - doCommand(Doc,"__list__ = App.ActiveDocument.%s.Functions", provider->getNameInDocument()); - doCommand(Doc,"__list__.append(App.ActiveDocument.%s)", FeatName.c_str()); - doCommand(Doc,"App.ActiveDocument.%s.Functions = __list__", provider->getNameInDocument()); - doCommand(Doc,"del __list__"); - - //set the default values, for this get the bounding box - vtkBoundingBox box = pipeline->getBoundingBox(); - - double center[3]; - box.GetCenter(center); - - if (iMsg==0) - doCommand(Doc,"App.ActiveDocument.%s.Origin = App.Vector(%f, %f, %f)", FeatName.c_str(), center[0], - center[1], center[2]); - else if (iMsg==1) { - doCommand(Doc,"App.ActiveDocument.%s.Center = App.Vector(%f, %f, %f)", FeatName.c_str(), center[0], - center[1] + box.GetLength(1)/2, center[2] + box.GetLength(2)/2); - doCommand(Doc,"App.ActiveDocument.%s.Radius = %f", FeatName.c_str(), box.GetDiagonalLength()/2); - } - - - this->updateActive(); - //most of the times functions are added inside of a filter, make sure this still works - if(Gui::Application::Instance->activeDocument()->getInEdit() == NULL) - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); - } - else { - QMessageBox::warning(Gui::getMainWindow(), - qApp->translate("CmdFemPostCreateClipFilter", "Wrong selection"), - qApp->translate("CmdFemPostCreateClipFilter", "Select a pipeline, please.")); - } - - // Since the default icon is reset when enabing/disabling the command we have - // to explicitly set the icon of the used command. - Gui::ActionGroup* pcAction = qobject_cast(_pcAction); - QList a = pcAction->actions(); - - assert(iMsg < a.size()); - pcAction->setIcon(a[iMsg]->icon()); -} - -Gui::Action * CmdFemPostFunctions::createAction(void) -{ - Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow()); - pcAction->setDropDownMenu(true); - applyCommandData(this->className(), pcAction); - - QAction* cmd0 = pcAction->addAction(QString()); - cmd0->setIcon(Gui::BitmapFactory().pixmap("fem-plane")); - - QAction* cmd1 = pcAction->addAction(QString()); - cmd1->setIcon(Gui::BitmapFactory().pixmap("fem-sphere")); - - _pcAction = pcAction; - languageChange(); - - pcAction->setIcon(cmd1->icon()); - int defaultId = 0; - pcAction->setProperty("defaultAction", QVariant(defaultId)); - - return pcAction; -} - -void CmdFemPostFunctions::languageChange() -{ - Command::languageChange(); - - if (!_pcAction) - return; - Gui::ActionGroup* pcAction = qobject_cast(_pcAction); - QList a = pcAction->actions(); - - QAction* cmd = a[0]; - cmd->setText(QApplication::translate("CmdFemPostFunctions","Plane")); - cmd->setToolTip(QApplication::translate("Fem_PostCreateFunctions","Create a plane function, defined by its orgin and normal")); - cmd->setStatusTip(cmd->toolTip()); - - cmd = a[1]; - cmd->setText(QApplication::translate("CmdFemPostFunctions","Sphere")); - cmd->setToolTip(QApplication::translate("Fem_PostCreateFunctions","Create a phere function, defined by its center and radius")); - cmd->setStatusTip(cmd->toolTip()); - -} - -bool CmdFemPostFunctions::isActive(void) -{ - if (getActiveGuiDocument()) - return true; - else - return false; -} - - -DEF_STD_CMD_AC(CmdFemPostApllyChanges); - -CmdFemPostApllyChanges::CmdFemPostApllyChanges() - : Command("Fem_PostApplyChanges") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Apply changes to parameters directly and not on recompute only..."); - sToolTipText = QT_TR_NOOP("Apply changes to parameters directly and not on recompute only..."); - sWhatsThis = "Fem_PostApplyChanges"; - sStatusTip = sToolTipText; - sPixmap = "view-refresh"; - eType = eType|ForEdit; -} - -void CmdFemPostApllyChanges::activated(int iMsg) -{ - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem"); - - if (iMsg == 1) - hGrp->SetBool("PostAutoRecompute", true); - else - hGrp->SetBool("PostAutoRecompute", false); -} - -bool CmdFemPostApllyChanges::isActive(void) -{ - if (getActiveGuiDocument()) - return true; - else - return false; -} - -Gui::Action * CmdFemPostApllyChanges::createAction(void) -{ - Gui::Action *pcAction = Command::createAction(); - pcAction->setCheckable(true); - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem"); - pcAction->setChecked(hGrp->GetBool("PostAutoRecompute", false)); - - return pcAction; -} - - -DEF_STD_CMD_A(CmdFemPostPipelineFromResult); - -CmdFemPostPipelineFromResult::CmdFemPostPipelineFromResult() - : Command("Fem_PostPipelineFromResult") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Creates a post processing pipeline from a result object"); - sToolTipText = QT_TR_NOOP("Creates a post processing pipeline from a result object"); - sWhatsThis = "Fem_PostPipelineFromResult"; - sStatusTip = sToolTipText; - sPixmap = "fem-data"; -} - -void CmdFemPostPipelineFromResult::activated(int iMsg) -{ - Gui::SelectionFilter ResultFilter("SELECT Fem::FemResultObject COUNT 1"); - - if (ResultFilter.match()) { - - Fem::FemResultObject* result = static_cast(ResultFilter.Result[0][0].getObject()); - std::string FeatName = getUniqueObjectName("Pipeline"); - - openCommand("Create pipeline from result"); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemPostPipeline','%s')",FeatName.c_str()); - - //TODO: use python function call for this - static_cast(getDocument()->getObject(FeatName.c_str()))->load(result); - - this->updateActive(); - - } - else { - QMessageBox::warning(Gui::getMainWindow(), - qApp->translate("CmdFemPostCreateClipFilter", "Wrong selection"), - qApp->translate("CmdFemPostCreateClipFilter", "Select a result, please.")); - } -} - -bool CmdFemPostPipelineFromResult::isActive(void) -{ - return hasActiveDocument(); -} - -#endif - -//-------------------------------------------------------------------------------------- - - -void CreateFemCommands(void) -{ - Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager(); - //rcCmdMgr.addCommand(new CmdFemCreateAnalysis()); - rcCmdMgr.addCommand(new CmdFemAddPart()); - //rcCmdMgr.addCommand(new CmdFemCreateSolver()); // Solver will be extended and created in python - rcCmdMgr.addCommand(new CmdFemCreateNodesSet()); - rcCmdMgr.addCommand(new CmdFemDefineNodesSet()); - rcCmdMgr.addCommand(new CmdFemConstraintBearing()); - rcCmdMgr.addCommand(new CmdFemConstraintFixed()); - rcCmdMgr.addCommand(new CmdFemConstraintForce()); - rcCmdMgr.addCommand(new CmdFemConstraintPressure()); - rcCmdMgr.addCommand(new CmdFemConstraintGear()); - rcCmdMgr.addCommand(new CmdFemConstraintPulley()); - rcCmdMgr.addCommand(new CmdFemConstraintDisplacement()); - -#ifdef FC_USE_VTK - rcCmdMgr.addCommand(new CmdFemPostCreateClipFilter); - rcCmdMgr.addCommand(new CmdFemPostCreateScalarClipFilter); - rcCmdMgr.addCommand(new CmdFemPostWarpVectorFilter); - rcCmdMgr.addCommand(new CmdFemPostFunctions); - rcCmdMgr.addCommand(new CmdFemPostApllyChanges); - rcCmdMgr.addCommand(new CmdFemPostPipelineFromResult); - rcCmdMgr.addCommand(new CmdFemPostCutFilter); -#endif -} -======= -/*************************************************************************** - * Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" -#ifndef _PreComp_ -# include -# include -# include -#include -#endif - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include "ActiveAnalysisObserver.h" - -#ifdef FC_USE_VTK -#include -#endif - -using namespace std; - - -bool getConstraintPrerequisits(Fem::FemAnalysis **Analysis) -{ - Fem::FemAnalysis* ActiveAnalysis = FemGui::ActiveAnalysisObserver::instance()->getActiveObject(); - if (!ActiveAnalysis || !ActiveAnalysis->getTypeId().isDerivedFrom(Fem::FemAnalysis::getClassTypeId())){ - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No active Analysis"), - QObject::tr("You need to create or activate a Analysis")); - return true; - } - - *Analysis = static_cast(ActiveAnalysis); - - // return with no error - return false; - -} - -//OvG: Visibility automation show parts and hide meshes on activation of a constraint -std::string gethideMeshShowPartStr(std::string showConstr="") -{ - return "for amesh in App.activeDocument().Objects:\n\ - if \""+showConstr+"\" == amesh.Name:\n\ - amesh.ViewObject.Visibility = True\n\ - elif \"Mesh\" in amesh.TypeId:\n\ - aparttoshow = amesh.Name.replace(\"_Mesh\",\"\")\n\ - for apart in App.activeDocument().Objects:\n\ - if aparttoshow == apart.Name:\n\ - apart.ViewObject.Visibility = True\n\ - amesh.ViewObject.Visibility = False\n"; -} - -//===================================================================================== -DEF_STD_CMD_A(CmdFemCreateAnalysis); - -CmdFemCreateAnalysis::CmdFemCreateAnalysis() - : Command("Fem_CreateAnalysis") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create a FEM analysis"); - sToolTipText = QT_TR_NOOP("Create a FEM analysis"); - sWhatsThis = "Fem_CreateAnalysis"; - sStatusTip = sToolTipText; - sPixmap = "fem-analysis"; -} - -void CmdFemCreateAnalysis::activated(int iMsg) -{ -#ifndef FCWithNetgen - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), - QObject::tr("Your FreeCAD is build without NETGEN support. Meshing will not work....")); - return; -#endif - - std::vector selection = getSelection().getSelectionEx(); - - if (selection.size() != 1) { - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), - QObject::tr("Select an edge, face or body. Only one body is allowed.")); - return; - } - - if (!selection[0].isObjectTypeOf(Part::Feature::getClassTypeId())){ - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong object type"), - QObject::tr("Fillet works only on parts")); - return; - } - - Part::Feature *base = static_cast(selection[0].getObject()); - - std::string AnalysisName = getUniqueObjectName("FemAnalysis"); - - std::string MeshName = getUniqueObjectName((std::string(base->getNameInDocument()) +"_Mesh").c_str()); - - - openCommand("Create FEM analysis"); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemAnalysis','%s')",AnalysisName.c_str()); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemMeshShapeNetgenObject','%s')",MeshName.c_str()); - doCommand(Doc,"App.activeDocument().ActiveObject.Shape = App.activeDocument().%s",base->getNameInDocument()); - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s",AnalysisName.c_str(),MeshName.c_str()); - addModule(Gui,"FemGui"); - doCommand(Gui,"FemGui.setActiveAnalysis(App.activeDocument().%s)",AnalysisName.c_str()); - commitCommand(); - - updateActive(); -} - -bool CmdFemCreateAnalysis::isActive(void) -{ - return !FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemAddPart); - -CmdFemAddPart::CmdFemAddPart() - : Command("Fem_FemAddPart") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Add a part to the Analysis"); - sToolTipText = QT_TR_NOOP("Add a part to the Analysis"); - sWhatsThis = "Fem_FemAddPart"; - sStatusTip = sToolTipText; - sPixmap = "fem-add-fem-mesh"; -} - -void CmdFemAddPart::activated(int iMsg) -{ -#ifndef FCWithNetgen - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), - QObject::tr("Your FreeCAD is build without NETGEN support. Meshing will not work....")); - return; -#endif - - std::vector selection = getSelection().getSelectionEx(); - - if (selection.size() != 1) { - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), - QObject::tr("Select an edge, face or body. Only one body is allowed.")); - return; - } - - if (!selection[0].isObjectTypeOf(Part::Feature::getClassTypeId())){ - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong object type"), - QObject::tr("Fillet works only on parts")); - return; - } - - Part::Feature *base = static_cast(selection[0].getObject()); - - std::string AnalysisName = getUniqueObjectName("FemAnalysis"); - std::string MeshName = getUniqueObjectName((std::string(base->getNameInDocument()) +"_Mesh").c_str()); - - openCommand("Create FEM analysis"); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemAnalysis','%s')",AnalysisName.c_str()); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemMeshShapeNetgenObject','%s')",MeshName.c_str()); - doCommand(Doc,"App.activeDocument().ActiveObject.Shape = App.activeDocument().%s",base->getNameInDocument()); - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s",AnalysisName.c_str(),MeshName.c_str()); - addModule(Gui,"FemGui"); - doCommand(Gui,"FemGui.setActiveAnalysis(App.activeDocument().%s)",AnalysisName.c_str()); - commitCommand(); - - updateActive(); -} - -bool CmdFemAddPart::isActive(void) -{ - if (Gui::Control().activeDialog()) - return false; - Base::Type type = Base::Type::fromName("Part::Feature"); - return Gui::Selection().countObjectsOfType(type) > 0; -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemCreateSolver); - -CmdFemCreateSolver::CmdFemCreateSolver() - : Command("Fem_CreateSolver") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Add a solver to the Analysis"); - sToolTipText = QT_TR_NOOP("Add a solver to the Analysis"); - sWhatsThis = "Fem_CreateSolver"; - sStatusTip = sToolTipText; - sPixmap = "fem-solver"; -} - -void CmdFemCreateSolver::activated(int iMsg) -{ -#ifndef FCWithNetgen - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), - QObject::tr("Your FreeCAD is build without NETGEN support. Meshing will not work....")); - return; -#endif - - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("Solver"); - - openCommand("Create solver for FEM or CFD analysis"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::FemSolverObject\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemCreateSolver::isActive(void) -{ - return hasActiveDocument(); -} - -//===================================================================================== - - -DEF_STD_CMD_A(CmdFemConstraintBearing); - -CmdFemConstraintBearing::CmdFemConstraintBearing() - : Command("Fem_ConstraintBearing") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM bearing constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a bearing"); - sWhatsThis = "Fem_ConstraintBearing"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-bearing"; -} - -void CmdFemConstraintBearing::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("FemConstraintBearing"); - - openCommand("Make FEM constraint for bearing"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintBearing\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintBearing::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemConstraintFixed); - -CmdFemConstraintFixed::CmdFemConstraintFixed() - : Command("Fem_ConstraintFixed") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM fixed constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a fixed geometric entity"); - sWhatsThis = "Fem_ConstraintFixed"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-fixed"; -} - -void CmdFemConstraintFixed::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("FemConstraintFixed"); - - openCommand("Make FEM constraint fixed geometry"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintFixed\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Scale = 1",FeatName.c_str()); //OvG: set initial scale to 1 - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintFixed::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemConstraintForce); - -CmdFemConstraintForce::CmdFemConstraintForce() - : Command("Fem_ConstraintForce") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM force constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a force acting on a geometric entity"); - sWhatsThis = "Fem_ConstraintForce"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-force"; -} - -void CmdFemConstraintForce::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("FemConstraintForce"); - - openCommand("Make FEM constraint force on geometry"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintForce\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Force = 1.0",FeatName.c_str()); //OvG: set default not equal to 0 - doCommand(Doc,"App.activeDocument().%s.Reversed = False",FeatName.c_str()); //OvG: set default to False - doCommand(Doc,"App.activeDocument().%s.Scale = 1",FeatName.c_str()); //OvG: set initial scale to 1 - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintForce::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemConstraintPressure); - -CmdFemConstraintPressure::CmdFemConstraintPressure() - : Command("Fem_ConstraintPressure") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM pressure constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a pressure acting on a face"); - sWhatsThis = "Fem_ConstraintPressure"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-pressure"; -} - -void CmdFemConstraintPressure::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("FemConstraintPressure"); - - openCommand("Make FEM constraint pressure on face"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintPressure\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Pressure = 1000.0",FeatName.c_str()); //OvG: set default not equal to 0 - doCommand(Doc,"App.activeDocument().%s.Reversed = False",FeatName.c_str()); //OvG: set default to False - doCommand(Doc,"App.activeDocument().%s.Scale = 1",FeatName.c_str()); //OvG: set initial scale to 1 - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]", - Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintPressure::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemConstraintGear); - -CmdFemConstraintGear::CmdFemConstraintGear() - : Command("Fem_ConstraintGear") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM gear constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a gear"); - sWhatsThis = "Fem_ConstraintGear"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-gear"; -} - -void CmdFemConstraintGear::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - std::string FeatName = getUniqueObjectName("FemConstraintGear"); - - openCommand("Make FEM constraint for gear"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintGear\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Diameter = 100.0",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintGear::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} - -//===================================================================================== - -DEF_STD_CMD_A(CmdFemConstraintPulley); - -CmdFemConstraintPulley::CmdFemConstraintPulley() - : Command("Fem_ConstraintPulley") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM pulley constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a pulley"); - sWhatsThis = "Fem_ConstraintPulley"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-pulley"; -} - -void CmdFemConstraintPulley::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("FemConstraintPulley"); - - openCommand("Make FEM constraint for pulley"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintPulley\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Diameter = 300.0",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.OtherDiameter = 100.0",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.CenterDistance = 500.0",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Force = 100.0",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.TensionForce = 100.0",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintPulley::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} -//===================================================================================== - -DEF_STD_CMD_A(CmdFemConstraintDisplacement); - -CmdFemConstraintDisplacement::CmdFemConstraintDisplacement() - : Command("Fem_ConstraintDisplacement") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create FEM displacement constraint"); - sToolTipText = QT_TR_NOOP("Create FEM constraint for a displacement acting on a face"); - sWhatsThis = "Fem_ConstraintDisplacement"; - sStatusTip = sToolTipText; - sPixmap = "fem-constraint-displacement"; -} - -void CmdFemConstraintDisplacement::activated(int iMsg) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - std::string FeatName = getUniqueObjectName("FemConstraintDisplacement"); - - openCommand("Make FEM constraint displacement on face"); - doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintDisplacement\",\"%s\")",FeatName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Scale = 1",FeatName.c_str()); //OvG: set initial scale to 1 - doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]", - Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str()); - - doCommand(Doc,"%s",gethideMeshShowPartStr(FeatName).c_str()); //OvG: Hide meshes and show parts - - updateActive(); - - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); -} - -bool CmdFemConstraintDisplacement::isActive(void) -{ - return FemGui::ActiveAnalysisObserver::instance()->hasActiveObject(); -} -// ##################################################################################################### - - - -DEF_STD_CMD_A(CmdFemDefineNodesSet); - - -void DefineNodesCallback(void * ud, SoEventCallback * n) -{ - Fem::FemAnalysis *Analysis; - - if(getConstraintPrerequisits(&Analysis)) - return; - - // show the wait cursor because this could take quite some time - Gui::WaitCursor wc; - - // When this callback function is invoked we must in either case leave the edit mode - Gui::View3DInventorViewer* view = reinterpret_cast(n->getUserData()); - view->setEditing(false); - view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), DefineNodesCallback,ud); - n->setHandled(); - - SbBool clip_inner; - std::vector clPoly = view->getGLPolygon(&clip_inner); - if (clPoly.size() < 3) - return; - if (clPoly.front() != clPoly.back()) - clPoly.push_back(clPoly.front()); - - SoCamera* cam = view->getSoRenderManager()->getCamera(); - SbViewVolume vv = cam->getViewVolume(); - Gui::ViewVolumeProjection proj(vv); - Base::Polygon2D polygon; - for (std::vector::const_iterator it = clPoly.begin(); it != clPoly.end(); ++it) - polygon.Add(Base::Vector2D((*it)[0],(*it)[1])); - - - std::vector docObj = Gui::Selection().getObjectsOfType(Fem::FemMeshObject::getClassTypeId()); - if(docObj.size() !=1) - return; - - const SMESHDS_Mesh* data = const_cast(dynamic_cast(docObj[0])->FemMesh.getValue().getSMesh())->GetMeshDS(); - - SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator(); - Base::Vector3f pt2d; - std::set IntSet; - - while (aNodeIter->more()) { - const SMDS_MeshNode* aNode = aNodeIter->next(); - Base::Vector3f vec(aNode->X(),aNode->Y(),aNode->Z()); - pt2d = proj(vec); - if (polygon.Contains(Base::Vector2D(pt2d.x, pt2d.y)) == true) - IntSet.insert(aNode->GetID()); - } - - std::stringstream set; - - set << "["; - for(std::set::const_iterator it=IntSet.begin();it!=IntSet.end();++it) - if(it==IntSet.begin()) - set << *it ; - else - set << "," << *it ; - set << "]"; - - - Gui::Command::openCommand("Place robot"); - Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.addObject('Fem::FemSetNodesObject','NodeSet')"); - Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.ActiveObject.Nodes = %s",set.str().c_str()); - Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().NodeSet]",Analysis->getNameInDocument(),Analysis->getNameInDocument()); - ////Gui::Command::updateActive(); - Gui::Command::commitCommand(); - - //std::vector views = view->getViewProvidersOfType(ViewProviderMesh::getClassTypeId()); - //if (!views.empty()) { - // Gui::Application::Instance->activeDocument()->openCommand("Cut"); - // for (std::vector::iterator it = views.begin(); it != views.end(); ++it) { - // ViewProviderMesh* that = static_cast(*it); - // if (that->getEditingMode() > -1) { - // that->finishEditing(); - // that->cutMesh(clPoly, *view, clip_inner); - // } - // } - - // Gui::Application::Instance->activeDocument()->commitCommand(); - - // view->render(); - //} -} - - - -CmdFemDefineNodesSet::CmdFemDefineNodesSet() - : Command("Fem_DefineNodesSet") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Create node set by Poly"); - sToolTipText = QT_TR_NOOP("Create node set by Poly"); - sWhatsThis = "Create node set by Poly"; - sStatusTip = QT_TR_NOOP("Create node set by Poly"); - sPixmap = "fem-fem-mesh-create-node-by-poly"; -} - -void CmdFemDefineNodesSet::activated(int iMsg) -{ - std::vector docObj = Gui::Selection().getObjectsOfType(Fem::FemMeshObject::getClassTypeId()); - - for (std::vector::iterator it = docObj.begin(); it != docObj.end(); ++it) { - if (it == docObj.begin()) { - Gui::Document* doc = getActiveGuiDocument(); - Gui::MDIView* view = doc->getActiveView(); - if (view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { - Gui::View3DInventorViewer* viewer = ((Gui::View3DInventor*)view)->getViewer(); - viewer->setEditing(true); - viewer->startSelection(Gui::View3DInventorViewer::Clip); - viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), DefineNodesCallback); - } - else { - return; - } - } - - //Gui::ViewProvider* pVP = getActiveGuiDocument()->getViewProvider(*it); - //if (pVP->isVisible()) - // pVP->startEditing(); - } -} - -bool CmdFemDefineNodesSet::isActive(void) -{ - // Check for the selected mesh feature (all Mesh types) - if (getSelection().countObjectsOfType(Fem::FemMeshObject::getClassTypeId()) != 1) - return false; - - Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { - Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); - return !viewer->isEditing(); - } - - return false; -} - - -// ##################################################################################################### - -DEF_STD_CMD_A(CmdFemCreateNodesSet); - -CmdFemCreateNodesSet::CmdFemCreateNodesSet() - : Command("Fem_CreateNodesSet") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Define/create a nodes set..."); - sToolTipText = QT_TR_NOOP("Define/create a nodes set..."); - sWhatsThis = "Fem_CreateNodesSet"; - sStatusTip = sToolTipText; - sPixmap = "fem-fem-mesh-create-node-by-poly"; -} - -void CmdFemCreateNodesSet::activated(int iMsg) -{ - Gui::SelectionFilter ObjectFilter("SELECT Fem::FemSetNodesObject COUNT 1"); - Gui::SelectionFilter FemMeshFilter("SELECT Fem::FemMeshObject COUNT 1"); - - if (ObjectFilter.match()) { - Fem::FemSetNodesObject *NodesObj = static_cast(ObjectFilter.Result[0][0].getObject()); - openCommand("Edit nodes set"); - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",NodesObj->getNameInDocument()); - } - else if (FemMeshFilter.match()) { - Fem::FemMeshObject *MeshObj = static_cast(FemMeshFilter.Result[0][0].getObject()); - - std::string FeatName = getUniqueObjectName("NodesSet"); - - openCommand("Create nodes set"); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemSetNodesObject','%s')",FeatName.c_str()); - doCommand(Gui,"App.activeDocument().%s.FemMesh = App.activeDocument().%s",FeatName.c_str(),MeshObj->getNameInDocument()); - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); - } - else { - QMessageBox::warning(Gui::getMainWindow(), - qApp->translate("CmdFemCreateNodesSet", "Wrong selection"), - qApp->translate("CmdFemCreateNodesSet", "Select a single FEM mesh or nodes set, please.")); - } -} - -bool CmdFemCreateNodesSet::isActive(void) -{ - return hasActiveDocument(); -} - - -// ##################################################################################################### - -#ifdef FC_USE_VTK - -void setupFilter(Gui::Command* cmd, std::string Name) { - - std::vector pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType(); - if (!pipelines.empty()) { - Fem::FemPostPipeline *pipeline = pipelines.front(); - - std::string FeatName = cmd->getUniqueObjectName(Name.c_str()); - - cmd->openCommand("Create filter"); - cmd->doCommand(Gui::Command::Doc,"App.activeDocument().addObject('Fem::FemPost%sFilter','%s')", Name.c_str(), FeatName.c_str()); - cmd->doCommand(Gui::Command::Doc,"__list__ = App.ActiveDocument.%s.Filter", pipeline->getNameInDocument()); - cmd->doCommand(Gui::Command::Doc,"__list__.append(App.ActiveDocument.%s)", FeatName.c_str()); - cmd->doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Filter = __list__", pipeline->getNameInDocument()); - cmd->doCommand(Gui::Command::Doc,"del __list__"); - - cmd->updateActive(); - cmd->doCommand(Gui::Command::Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); - - } - else { - QMessageBox::warning(Gui::getMainWindow(), - qApp->translate("CmdFemPostCreateClipFilter", "Wrong selection"), - qApp->translate("CmdFemPostCreateClipFilter", "Select a pipeline, please.")); - } - -}; - -DEF_STD_CMD_A(CmdFemPostCreateClipFilter); - -CmdFemPostCreateClipFilter::CmdFemPostCreateClipFilter() - : Command("Fem_PostCreateClipFilter") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Define/create a clip filter which uses functions to define the cliped region"); - sToolTipText = QT_TR_NOOP("Define/create a clip filter which uses functions to define the cliped region"); - sWhatsThis = "Fem_PostCreateClipFilter"; - sStatusTip = sToolTipText; - sPixmap = "fem-clip"; -} - -void CmdFemPostCreateClipFilter::activated(int iMsg) -{ - setupFilter(this, "Clip"); -} - -bool CmdFemPostCreateClipFilter::isActive(void) -{ - return hasActiveDocument(); -} - -DEF_STD_CMD_A(CmdFemPostCreateScalarClipFilter); - -CmdFemPostCreateScalarClipFilter::CmdFemPostCreateScalarClipFilter() - : Command("Fem_PostCreateScalarClipFilter") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Define/create a clip filter which clips a field with a scalar value"); - sToolTipText = QT_TR_NOOP("Define/create a clip filter which clips a field with a scalar value"); - sWhatsThis = "Fem_PostCreateScalarClipFilter"; - sStatusTip = sToolTipText; - sPixmap = "fem-clip-scalar"; -} - -void CmdFemPostCreateScalarClipFilter::activated(int iMsg) -{ - setupFilter(this, "ScalarClip"); -} - -bool CmdFemPostCreateScalarClipFilter::isActive(void) -{ - return hasActiveDocument(); -} - - - -DEF_STD_CMD_A(CmdFemPostWarpVectorFilter); - -CmdFemPostWarpVectorFilter::CmdFemPostWarpVectorFilter() - : Command("Fem_PostCreateWarpVectorFilter") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Warp the geometry along a vector field by a certain factor"); - sToolTipText = QT_TR_NOOP("Warp the geometry along a vector field by a certain factor"); - sWhatsThis = "Fem_PostCreateWarpVectorFilter"; - sStatusTip = sToolTipText; - sPixmap = "fem-warp"; -} - -void CmdFemPostWarpVectorFilter::activated(int iMsg) -{ - setupFilter(this, "WarpVector"); -} - -bool CmdFemPostWarpVectorFilter::isActive(void) -{ - return hasActiveDocument(); -} - -DEF_STD_CMD_A(CmdFemPostCutFilter); - -CmdFemPostCutFilter::CmdFemPostCutFilter() - : Command("Fem_PostCreateCutFilter") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Cut the data along an implicit function"); - sToolTipText = QT_TR_NOOP("Cut the data along an implicit function"); - sWhatsThis = "Fem_PostCreateCutFilter"; - sStatusTip = sToolTipText; - sPixmap = "fem-cut"; -} - -void CmdFemPostCutFilter::activated(int iMsg) -{ - setupFilter(this, "Cut"); -} - -bool CmdFemPostCutFilter::isActive(void) -{ - return hasActiveDocument(); -} - -// ##################################################################################################### - - -DEF_STD_CMD_ACL(CmdFemPostFunctions); - -CmdFemPostFunctions::CmdFemPostFunctions() - : Command("Fem_PostCreateFunctions") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Functions for use in postprocessing filter..."); - sToolTipText = QT_TR_NOOP("Functions for use in postprocessing filter..."); - sWhatsThis = "Fem_PostCreateFunctions"; - sStatusTip = sToolTipText; - eType = eType|ForEdit; -} - -void CmdFemPostFunctions::activated(int iMsg) -{ - - std::string name; - if (iMsg==0) - name = "Plane"; - else if (iMsg==1) - name = "Sphere"; - else - return; - - //create the object - std::vector pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType(); - if (!pipelines.empty()) { - Fem::FemPostPipeline *pipeline = pipelines.front(); - - openCommand("Create function"); - - //check if the pipeline has a filter provider and add one if needed - Fem::FemPostFunctionProvider* provider; - if(!pipeline->Functions.getValue() || pipeline->Functions.getValue()->getTypeId() != Fem::FemPostFunctionProvider::getClassTypeId()) { - std::string FuncName = getUniqueObjectName("Functions"); - doCommand(Doc,"App.ActiveDocument.addObject('Fem::FemPostFunctionProvider','%s')", FuncName.c_str()); - doCommand(Doc,"App.ActiveDocument.%s.Functions = App.ActiveDocument.%s", pipeline->getNameInDocument(), FuncName.c_str()); - provider = static_cast(getDocument()->getObject(FuncName.c_str())); - } - else - provider = static_cast(pipeline->Functions.getValue()); - - //build the object - std::string FeatName = getUniqueObjectName(name.c_str()); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemPost%sFunction','%s')", name.c_str(), FeatName.c_str()); - doCommand(Doc,"__list__ = App.ActiveDocument.%s.Functions", provider->getNameInDocument()); - doCommand(Doc,"__list__.append(App.ActiveDocument.%s)", FeatName.c_str()); - doCommand(Doc,"App.ActiveDocument.%s.Functions = __list__", provider->getNameInDocument()); - doCommand(Doc,"del __list__"); - - //set the default values, for this get the bounding box - vtkBoundingBox box = pipeline->getBoundingBox(); - - double center[3]; - box.GetCenter(center); - - if (iMsg==0) - doCommand(Doc,"App.ActiveDocument.%s.Origin = App.Vector(%f, %f, %f)", FeatName.c_str(), center[0], - center[1], center[2]); - else if (iMsg==1) { - doCommand(Doc,"App.ActiveDocument.%s.Center = App.Vector(%f, %f, %f)", FeatName.c_str(), center[0], - center[1] + box.GetLength(1)/2, center[2] + box.GetLength(2)/2); - doCommand(Doc,"App.ActiveDocument.%s.Radius = %f", FeatName.c_str(), box.GetDiagonalLength()/2); - } - - - this->updateActive(); - //most of the times functions are added inside of a filter, make sure this still works - if(Gui::Application::Instance->activeDocument()->getInEdit() == NULL) - doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); - } - else { - QMessageBox::warning(Gui::getMainWindow(), - qApp->translate("CmdFemPostCreateClipFilter", "Wrong selection"), - qApp->translate("CmdFemPostCreateClipFilter", "Select a pipeline, please.")); - } - - // Since the default icon is reset when enabing/disabling the command we have - // to explicitly set the icon of the used command. - Gui::ActionGroup* pcAction = qobject_cast(_pcAction); - QList a = pcAction->actions(); - - assert(iMsg < a.size()); - pcAction->setIcon(a[iMsg]->icon()); -} - -Gui::Action * CmdFemPostFunctions::createAction(void) -{ - Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow()); - pcAction->setDropDownMenu(true); - applyCommandData(this->className(), pcAction); - - QAction* cmd0 = pcAction->addAction(QString()); - cmd0->setIcon(Gui::BitmapFactory().pixmap("fem-plane")); - - QAction* cmd1 = pcAction->addAction(QString()); - cmd1->setIcon(Gui::BitmapFactory().pixmap("fem-sphere")); - - _pcAction = pcAction; - languageChange(); - - pcAction->setIcon(cmd1->icon()); - int defaultId = 0; - pcAction->setProperty("defaultAction", QVariant(defaultId)); - - return pcAction; -} - -void CmdFemPostFunctions::languageChange() -{ - Command::languageChange(); - - if (!_pcAction) - return; - Gui::ActionGroup* pcAction = qobject_cast(_pcAction); - QList a = pcAction->actions(); - - QAction* cmd = a[0]; - cmd->setText(QApplication::translate("CmdFemPostFunctions","Plane")); - cmd->setToolTip(QApplication::translate("Fem_PostCreateFunctions","Create a plane function, defined by its orgin and normal")); - cmd->setStatusTip(cmd->toolTip()); - - cmd = a[1]; - cmd->setText(QApplication::translate("CmdFemPostFunctions","Sphere")); - cmd->setToolTip(QApplication::translate("Fem_PostCreateFunctions","Create a phere function, defined by its center and radius")); - cmd->setStatusTip(cmd->toolTip()); - -} - -bool CmdFemPostFunctions::isActive(void) -{ - if (getActiveGuiDocument()) - return true; - else - return false; -} - - -DEF_STD_CMD_AC(CmdFemPostApllyChanges); - -CmdFemPostApllyChanges::CmdFemPostApllyChanges() - : Command("Fem_PostApplyChanges") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Apply changes to parameters directly and not on recompute only..."); - sToolTipText = QT_TR_NOOP("Apply changes to parameters directly and not on recompute only..."); - sWhatsThis = "Fem_PostApplyChanges"; - sStatusTip = sToolTipText; - sPixmap = "view-refresh"; - eType = eType|ForEdit; -} - -void CmdFemPostApllyChanges::activated(int iMsg) -{ - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem"); - - if (iMsg == 1) - hGrp->SetBool("PostAutoRecompute", true); - else - hGrp->SetBool("PostAutoRecompute", false); -} - -bool CmdFemPostApllyChanges::isActive(void) -{ - if (getActiveGuiDocument()) - return true; - else - return false; -} - -Gui::Action * CmdFemPostApllyChanges::createAction(void) -{ - Gui::Action *pcAction = Command::createAction(); - pcAction->setCheckable(true); - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem"); - pcAction->setChecked(hGrp->GetBool("PostAutoRecompute", false)); - - return pcAction; -} - - -DEF_STD_CMD_A(CmdFemPostPipelineFromResult); - -CmdFemPostPipelineFromResult::CmdFemPostPipelineFromResult() - : Command("Fem_PostPipelineFromResult") -{ - sAppModule = "Fem"; - sGroup = QT_TR_NOOP("Fem"); - sMenuText = QT_TR_NOOP("Creates a post processing pipeline from a result object"); - sToolTipText = QT_TR_NOOP("Creates a post processing pipeline from a result object"); - sWhatsThis = "Fem_PostPipelineFromResult"; - sStatusTip = sToolTipText; - sPixmap = "fem-data"; -} - -void CmdFemPostPipelineFromResult::activated(int iMsg) -{ - Gui::SelectionFilter ResultFilter("SELECT Fem::FemResultObject COUNT 1"); - - if (ResultFilter.match()) { - - Fem::FemResultObject* result = static_cast(ResultFilter.Result[0][0].getObject()); - std::string FeatName = getUniqueObjectName("Pipeline"); - - openCommand("Create pipeline from result"); - doCommand(Doc,"App.activeDocument().addObject('Fem::FemPostPipeline','%s')",FeatName.c_str()); - - //TODO: use python function call for this - static_cast(getDocument()->getObject(FeatName.c_str()))->load(result); - - this->updateActive(); - - } - else { - QMessageBox::warning(Gui::getMainWindow(), - qApp->translate("CmdFemPostCreateClipFilter", "Wrong selection"), - qApp->translate("CmdFemPostCreateClipFilter", "Select a result, please.")); - } -} - -bool CmdFemPostPipelineFromResult::isActive(void) -{ - return hasActiveDocument(); -} - -#endif - -//-------------------------------------------------------------------------------------- - - -void CreateFemCommands(void) -{ - Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager(); - //rcCmdMgr.addCommand(new CmdFemCreateAnalysis()); - rcCmdMgr.addCommand(new CmdFemAddPart()); - //rcCmdMgr.addCommand(new CmdFemCreateSolver()); // Solver will be extended and created in python - rcCmdMgr.addCommand(new CmdFemCreateNodesSet()); - rcCmdMgr.addCommand(new CmdFemDefineNodesSet()); - rcCmdMgr.addCommand(new CmdFemConstraintBearing()); - rcCmdMgr.addCommand(new CmdFemConstraintFixed()); - rcCmdMgr.addCommand(new CmdFemConstraintForce()); - rcCmdMgr.addCommand(new CmdFemConstraintPressure()); - rcCmdMgr.addCommand(new CmdFemConstraintGear()); - rcCmdMgr.addCommand(new CmdFemConstraintPulley()); - rcCmdMgr.addCommand(new CmdFemConstraintDisplacement()); - -#ifdef FC_USE_VTK - rcCmdMgr.addCommand(new CmdFemPostCreateClipFilter); - rcCmdMgr.addCommand(new CmdFemPostCreateScalarClipFilter); - rcCmdMgr.addCommand(new CmdFemPostWarpVectorFilter); - rcCmdMgr.addCommand(new CmdFemPostFunctions); - rcCmdMgr.addCommand(new CmdFemPostApllyChanges); - rcCmdMgr.addCommand(new CmdFemPostPipelineFromResult); - rcCmdMgr.addCommand(new CmdFemPostCutFilter); -#endif -} ->>>>>>> FreeCADify the vtk post processing diff --git a/src/Mod/Fem/Gui/Resources/Fem.qrc.orig b/src/Mod/Fem/Gui/Resources/Fem.qrc.orig deleted file mode 100755 index 5f0e1540e..000000000 --- a/src/Mod/Fem/Gui/Resources/Fem.qrc.orig +++ /dev/null @@ -1,123 +0,0 @@ -<<<<<<< f24874396c47b854461779051d98df0c6567b0a2 - - - icons/fem-fem-mesh-from-shape.svg - icons/fem-fem-mesh-create-node-by-poly.svg - icons/fem-analysis.svg - icons/fem-solver.svg - icons/fem-constraint-displacement.svg - icons/fem-constraint-force.svg - icons/fem-constraint-fixed.svg - icons/fem-constraint-pressure.svg - icons/fem-constraint-bearing.svg - icons/fem-constraint-gear.svg - icons/fem-constraint-pulley.svg - icons/fem-add-fem-mesh.svg - icons/fem-add-material.svg - icons/fem-add-part.svg - icons/fem-inp-editor.svg - icons/fem-material.svg - icons/fem-new-analysis.svg - icons/fem-purge-results.svg - icons/fem-quick-analysis.svg - icons/fem-frequency-analysis.svg - icons/fem-result.svg - icons/fem-shell-thickness.svg - icons/fem-beam-section.svg - icons/preferences-fem.svg - icons/FemWorkbench.svg - translations/Fem_af.qm - translations/Fem_de.qm - translations/Fem_fi.qm - translations/Fem_fr.qm - translations/Fem_hr.qm - translations/Fem_it.qm - translations/Fem_nl.qm - translations/Fem_no.qm - translations/Fem_pl.qm - translations/Fem_ru.qm - translations/Fem_uk.qm - translations/Fem_tr.qm - translations/Fem_sv-SE.qm - translations/Fem_zh-TW.qm - translations/Fem_pt-BR.qm - translations/Fem_cs.qm - translations/Fem_sk.qm - translations/Fem_es-ES.qm - translations/Fem_zh-CN.qm - translations/Fem_ja.qm - translations/Fem_ro.qm - translations/Fem_hu.qm - translations/Fem_pt-PT.qm - translations/Fem_sr.qm - translations/Fem_el.qm - translations/Fem_sl.qm - - -======= - - - icons/fem-fem-mesh-from-shape.svg - icons/fem-fem-mesh-create-node-by-poly.svg - icons/fem-analysis.svg - icons/fem-solver.svg - icons/fem-constraint-displacement.svg - icons/fem-constraint-force.svg - icons/fem-constraint-fixed.svg - icons/fem-constraint-pressure.svg - icons/fem-constraint-bearing.svg - icons/fem-constraint-gear.svg - icons/fem-constraint-pulley.svg - icons/fem-add-fem-mesh.svg - icons/fem-add-material.svg - icons/fem-add-part.svg - icons/fem-inp-editor.svg - icons/fem-material.svg - icons/fem-new-analysis.svg - icons/fem-purge-results.svg - icons/fem-quick-analysis.svg - icons/fem-frequency-analysis.svg - icons/fem-result.svg - icons/fem-shell-thickness.svg - icons/fem-beam-section.svg - icons/preferences-fem.svg - icons/FemWorkbench.svg - icons/fem-clip.png - icons/fem-clip-scalar.png - icons/fem-cut.png - icons/fem-isosurface.png - icons/fem-warp.png - icons/fem-data.png - icons/fem-plane.svg - icons/fem-box.svg - icons/fem-sphere.svg - icons/fem-cylinder.svg - translations/Fem_af.qm - translations/Fem_de.qm - translations/Fem_fi.qm - translations/Fem_fr.qm - translations/Fem_hr.qm - translations/Fem_it.qm - translations/Fem_nl.qm - translations/Fem_no.qm - translations/Fem_pl.qm - translations/Fem_ru.qm - translations/Fem_uk.qm - translations/Fem_tr.qm - translations/Fem_sv-SE.qm - translations/Fem_zh-TW.qm - translations/Fem_pt-BR.qm - translations/Fem_cs.qm - translations/Fem_sk.qm - translations/Fem_es-ES.qm - translations/Fem_zh-CN.qm - translations/Fem_ja.qm - translations/Fem_ro.qm - translations/Fem_hu.qm - translations/Fem_pt-PT.qm - translations/Fem_sr.qm - translations/Fem_el.qm - translations/Fem_sl.qm - - ->>>>>>> Add icons for fem post processing