diff --git a/src/Mod/Fem/Gui/CMakeLists.txt b/src/Mod/Fem/Gui/CMakeLists.txt
index 5635bef1fc..af0fb7fcd6 100755
--- a/src/Mod/Fem/Gui/CMakeLists.txt
+++ b/src/Mod/Fem/Gui/CMakeLists.txt
@@ -9,6 +9,12 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
add_compile_options(-Wno-pedantic) # needed for vtk headers
endif()
+if(MSVC)
+ add_definitions(-DFCGuiFem -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)
endif(BUILD_FEM_NETGEN)
diff --git a/src/Mod/Material/App/AppMaterial.cpp b/src/Mod/Material/App/AppMaterial.cpp
index ced297ec95..9d2471c657 100644
--- a/src/Mod/Material/App/AppMaterial.cpp
+++ b/src/Mod/Material/App/AppMaterial.cpp
@@ -33,6 +33,7 @@
#include "ModelManagerPy.h"
#include "ModelPropertyPy.h"
#include "ModelPy.h"
+#include "UUIDsPy.h"
namespace Materials
{
@@ -68,6 +69,7 @@ PyMOD_INIT_FUNC(Material)
Base::Interpreter().addType(&Materials::ModelManagerPy ::Type, module, "ModelManager");
Base::Interpreter().addType(&Materials::ModelPropertyPy ::Type, module, "ModelProperty");
Base::Interpreter().addType(&Materials::ModelPy ::Type, module, "Model");
+ Base::Interpreter().addType(&Materials::UUIDsPy ::Type, module, "UUIDs");
PyMOD_Return(module);
}
diff --git a/src/Mod/Material/App/Array2DPy.xml b/src/Mod/Material/App/Array2DPy.xml
new file mode 100644
index 0000000000..ba6f5f965f
--- /dev/null
+++ b/src/Mod/Material/App/Array2DPy.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+ 2D Array of material properties.
+
+
+
+ The number of rows in the array.
+
+
+
+
+
+ The number of columns in the array.
+
+
+
+
+
+ Get the default value for the first column of the array
+
+
+
+
diff --git a/src/Mod/Material/App/Array2DPyImpl.cpp b/src/Mod/Material/App/Array2DPyImpl.cpp
new file mode 100644
index 0000000000..02ef6e5465
--- /dev/null
+++ b/src/Mod/Material/App/Array2DPyImpl.cpp
@@ -0,0 +1,85 @@
+/***************************************************************************
+ * Copyright (c) 2023 David Carter *
+ * *
+ * This file is part of FreeCAD. *
+ * *
+ * FreeCAD is free software: you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 2.1 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * FreeCAD 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 *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with FreeCAD. If not, see *
+ * . *
+ * *
+ **************************************************************************/
+
+#include "PreCompiled.h"
+
+#include "Array2DPy.h"
+#include "Model.h"
+#include "ModelLibrary.h"
+#include "ModelPropertyPy.h"
+#include "ModelUuids.h"
+
+#include "Array2DPy.cpp"
+
+using namespace Materials;
+
+// returns a string which represents the object e.g. when printed in python
+std::string Array2DPy::representation() const
+{
+ std::stringstream str;
+ str << "";
+
+ return str.str();
+}
+
+PyObject* Array2DPy::PyMake(struct _typeobject*, PyObject*, PyObject*) // Python wrapper
+{
+ // never create such objects with the constructor
+ return new Array2DPy(new Material2DArray());
+}
+
+// constructor method
+int Array2DPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
+{
+ return 0;
+}
+
+Py::Int Array2DPy::getRows() const
+{
+ return Py::Int(getMaterial2DArrayPtr()->rows());
+}
+
+Py::Int Array2DPy::getColumns() const
+{
+ return Py::Int(getMaterial2DArrayPtr()->columns());
+}
+
+PyObject* Array2DPy::getDefaultValue(PyObject* args)
+{
+ char* name;
+ if (!PyArg_ParseTuple(args, "s", &name)) {
+ return nullptr;
+ }
+
+ // QVariant value = getMaterial2DArrayPtr()->getPhysicalValue(QString::fromStdString(name));
+ // return _pyObjectFromVariant(value);
+ return nullptr;
+}
+
+PyObject* Array2DPy::getCustomAttributes(const char* /*attr*/) const
+{
+ return nullptr;
+}
+
+int Array2DPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
+{
+ return 0;
+}
diff --git a/src/Mod/Material/App/CMakeLists.txt b/src/Mod/Material/App/CMakeLists.txt
index 21258ea53a..ab2bc85745 100644
--- a/src/Mod/Material/App/CMakeLists.txt
+++ b/src/Mod/Material/App/CMakeLists.txt
@@ -33,14 +33,18 @@ list(APPEND Material_LIBS
${YAML_CPP_LIBRARIES}
)
+generate_from_xml(Array2DPy)
generate_from_xml(MaterialManagerPy)
generate_from_xml(MaterialPy)
generate_from_xml(ModelManagerPy)
generate_from_xml(ModelPropertyPy)
generate_from_xml(ModelPy)
+generate_from_xml(UUIDsPy)
SET(Python_SRCS
Exceptions.h
+ Array2DPy.xml
+ Array2DPyImpl.cpp
MaterialManagerPy.xml
MaterialManagerPyImpl.cpp
MaterialPy.xml
@@ -51,6 +55,8 @@ SET(Python_SRCS
ModelPropertyPyImpl.cpp
ModelPy.xml
ModelPyImpl.cpp
+ UUIDsPy.xml
+ UUIDsPyImpl.cpp
)
SOURCE_GROUP("Python" FILES ${Python_SRCS})
@@ -78,6 +84,7 @@ SET(Material_SRCS
ModelLoader.h
ModelManager.cpp
ModelManager.h
+ ModelUuids.cpp
ModelUuids.h
PreCompiled.cpp
PreCompiled.h
diff --git a/src/Mod/Material/App/Exceptions.h b/src/Mod/Material/App/Exceptions.h
index c67e9df4eb..49152cd263 100644
--- a/src/Mod/Material/App/Exceptions.h
+++ b/src/Mod/Material/App/Exceptions.h
@@ -22,6 +22,8 @@
#ifndef MATERIAL_EXCEPTIONS_H
#define MATERIAL_EXCEPTIONS_H
+#include
+
#include
#include
@@ -37,6 +39,10 @@ public:
{
this->setMessage(msg);
}
+ explicit Uninitialized(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
~Uninitialized() noexcept override = default;
};
@@ -49,9 +55,29 @@ public:
{
this->setMessage(msg);
}
+ explicit ModelNotFound(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
~ModelNotFound() noexcept override = default;
};
+class InvalidMaterialType: public Base::Exception
+{
+public:
+ InvalidMaterialType()
+ {}
+ explicit InvalidMaterialType(const char* msg)
+ {
+ this->setMessage(msg);
+ }
+ explicit InvalidMaterialType(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
+ ~InvalidMaterialType() noexcept override = default;
+};
+
class MaterialNotFound: public Base::Exception
{
public:
@@ -61,9 +87,29 @@ public:
{
this->setMessage(msg);
}
+ explicit MaterialNotFound(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
~MaterialNotFound() noexcept override = default;
};
+class MaterialExists: public Base::Exception
+{
+public:
+ MaterialExists()
+ {}
+ explicit MaterialExists(const char* msg)
+ {
+ this->setMessage(msg);
+ }
+ explicit MaterialExists(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
+ ~MaterialExists() noexcept override = default;
+};
+
class PropertyNotFound: public Base::Exception
{
public:
@@ -73,6 +119,10 @@ public:
{
this->setMessage(msg);
}
+ explicit PropertyNotFound(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
~PropertyNotFound() noexcept override = default;
};
@@ -85,6 +135,10 @@ public:
{
this->setMessage(msg);
}
+ explicit LibraryNotFound(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
~LibraryNotFound() noexcept override = default;
};
@@ -97,6 +151,10 @@ public:
{
this->setMessage(msg);
}
+ explicit InvalidModel(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
~InvalidModel() noexcept override = default;
};
@@ -109,6 +167,10 @@ public:
{
this->setMessage(msg);
}
+ explicit InvalidRow(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
~InvalidRow() noexcept override = default;
};
@@ -121,9 +183,29 @@ public:
{
this->setMessage(msg);
}
+ explicit InvalidColumn(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
~InvalidColumn() noexcept override = default;
};
+class InvalidDepth: public Base::Exception
+{
+public:
+ InvalidDepth()
+ {}
+ explicit InvalidDepth(char* msg)
+ {
+ this->setMessage(msg);
+ }
+ explicit InvalidDepth(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
+ ~InvalidDepth() noexcept override = default;
+};
+
class InvalidIndex: public Base::Exception
{
public:
@@ -133,6 +215,10 @@ public:
{
this->setMessage(msg);
}
+ explicit InvalidIndex(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
~InvalidIndex() noexcept override = default;
};
@@ -145,9 +231,29 @@ public:
{
this->setMessage(msg);
}
+ explicit UnknownValueType(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
~UnknownValueType() noexcept override = default;
};
+class DeleteError: public Base::Exception
+{
+public:
+ DeleteError()
+ {}
+ explicit DeleteError(char* msg)
+ {
+ this->setMessage(msg);
+ }
+ explicit DeleteError(const QString& msg)
+ {
+ this->setMessage(msg.toStdString().c_str());
+ }
+ ~DeleteError() noexcept override = default;
+};
+
} // namespace Materials
#endif // MATERIAL_EXCEPTIONS_H
diff --git a/src/Mod/Material/App/FolderTree.h b/src/Mod/Material/App/FolderTree.h
index 2cc3133fa6..e2c450753c 100644
--- a/src/Mod/Material/App/FolderTree.h
+++ b/src/Mod/Material/App/FolderTree.h
@@ -22,10 +22,10 @@
#ifndef MATERIAL_FOLDERTREE_H
#define MATERIAL_FOLDERTREE_H
-#include
#include