Merge branch 'releases/FreeCAD-1-0' of github.com:FreeCAD/FreeCAD into releases/FreeCAD-1-0
This commit is contained in:
+13
-1
@@ -35,6 +35,8 @@
|
||||
# endif
|
||||
# include <boost/program_options.hpp>
|
||||
# include <boost/date_time/posix_time/posix_time.hpp>
|
||||
# include <chrono>
|
||||
# include <random>
|
||||
#endif
|
||||
|
||||
#ifdef FC_OS_WIN32
|
||||
@@ -1117,7 +1119,17 @@ Application::TransactionSignaller::~TransactionSignaller() {
|
||||
|
||||
int64_t Application::applicationPid()
|
||||
{
|
||||
return QCoreApplication::applicationPid();
|
||||
static int64_t randomNumber = []() {
|
||||
auto tp = std::chrono::high_resolution_clock::now();
|
||||
auto dur = tp.time_since_epoch();
|
||||
auto seed = dur.count();
|
||||
std::mt19937 generator(static_cast<unsigned>(seed));
|
||||
constexpr int64_t minValue {1};
|
||||
constexpr int64_t maxValue {1000000};
|
||||
std::uniform_int_distribution<int64_t> distribution(minValue, maxValue);
|
||||
return distribution(generator);
|
||||
}();
|
||||
return randomNumber;
|
||||
}
|
||||
|
||||
std::string Application::getHomePath()
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
|
||||
// STL
|
||||
#include <bitset>
|
||||
#include <chrono>
|
||||
#include <exception>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#
|
||||
# This module provides support for importing airfoil .dat files
|
||||
'''@package importAirfoilDAT
|
||||
\ingroup DRAFT
|
||||
\brief Airfoil (.dat) file importer
|
||||
Airfoil (.dat) file importer
|
||||
|
||||
This module provides support for importing airfoil .dat files.
|
||||
'''
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
# \ingroup DRAFT
|
||||
# \brief OCA (Open CAD Format) file importer & exporter
|
||||
'''@package importOCA
|
||||
\ingroup DRAFT
|
||||
\brief OCA (Open CAD Format) file importer & exporter
|
||||
OCA (Open CAD Format) file importer & exporter
|
||||
|
||||
This module provides support for importing from and exporting to
|
||||
the OCA format or GCAD format from GCAD3D (http://www.gcad3d.org/).
|
||||
|
||||
@@ -113,6 +113,9 @@ def get_femnodes_by_refshape(femmesh, ref):
|
||||
nodes += femmesh.getNodesByFace(r)
|
||||
elif r.ShapeType == "Solid":
|
||||
nodes += femmesh.getNodesBySolid(r)
|
||||
elif r.ShapeType == "Compound":
|
||||
for s in r.Solids:
|
||||
nodes += femmesh.getNodesBySolid(s)
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage(" No Vertice, Edge, Face or Solid as reference shapes!\n")
|
||||
return nodes
|
||||
@@ -1749,42 +1752,51 @@ def get_reference_group_elements(obj, aPart):
|
||||
childs = r[1]
|
||||
# FreeCAD.Console.PrintMessage("{}\n".format(parent))
|
||||
# FreeCAD.Console.PrintMessage("{}\n".format(childs))
|
||||
for child in childs:
|
||||
ref_shape = parent.getSubObject(child)
|
||||
FreeCAD.Console.PrintLog(f"{ref_shape}\n")
|
||||
found_element = geomtools.find_element_in_shape(aShape, ref_shape)
|
||||
if found_element is not None:
|
||||
elements.append(found_element)
|
||||
else:
|
||||
FreeCAD.Console.PrintError(
|
||||
"Problem: For the geometry of the "
|
||||
"following shape was no Shape found: {}\n".format(ref_shape)
|
||||
)
|
||||
FreeCAD.Console.PrintMessage(" " + obj.Name + "\n")
|
||||
FreeCAD.Console.PrintMessage(" " + str(obj.References) + "\n")
|
||||
FreeCAD.Console.PrintMessage(" " + r[0].Name + "\n")
|
||||
if parent.Name != aPart.Name:
|
||||
FreeCAD.Console.PrintError(
|
||||
"The reference Shape is not a child "
|
||||
"nor it is the shape the mesh is made of. : {}\n".format(ref_shape)
|
||||
)
|
||||
FreeCAD.Console.PrintMessage(
|
||||
f"{aPart.Name}--> Name of the Feature we where searching in.\n"
|
||||
)
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"{} --> Name of the parent Feature of reference Shape "
|
||||
"(Use the same as in the line before and you "
|
||||
"will have less trouble :-) !!!!!!).\n".format(parent.Name)
|
||||
)
|
||||
# import Part
|
||||
# Part.show(aShape)
|
||||
# Part.show(ref_shape)
|
||||
|
||||
for child1 in childs:
|
||||
ref_shape1 = parent.getSubObject(child1)
|
||||
subchilds = [
|
||||
ref_shape1,
|
||||
]
|
||||
if (
|
||||
ref_shape1.ShapeType == "Compound"
|
||||
): # if user selects a compound, add all the solids in it
|
||||
subchilds = ref_shape1.Solids
|
||||
for ref_shape in subchilds:
|
||||
FreeCAD.Console.PrintLog(f"{ref_shape}\n")
|
||||
found_element = geomtools.find_element_in_shape(aShape, ref_shape)
|
||||
if found_element is not None:
|
||||
elements.append(found_element)
|
||||
else:
|
||||
FreeCAD.Console.PrintError("This should not happen, please debug!\n")
|
||||
# in this case we would not have needed to use the
|
||||
# is_same_geometry() inside geomtools.find_element_in_shape()
|
||||
# AFAIK we could have used the Part methods isPartner() or even isSame()
|
||||
# We're going to find out when we need to debug this :-)!
|
||||
FreeCAD.Console.PrintError(
|
||||
"Problem: For the geometry of the "
|
||||
"following shape was no Shape found: {}\n".format(ref_shape)
|
||||
)
|
||||
FreeCAD.Console.PrintMessage(" " + obj.Name + "\n")
|
||||
FreeCAD.Console.PrintMessage(" " + str(obj.References) + "\n")
|
||||
FreeCAD.Console.PrintMessage(" " + r[0].Name + "\n")
|
||||
if parent.Name != aPart.Name:
|
||||
FreeCAD.Console.PrintError(
|
||||
"The reference Shape is not a child "
|
||||
"nor it is the shape the mesh is made of. : {}\n".format(ref_shape)
|
||||
)
|
||||
FreeCAD.Console.PrintMessage(
|
||||
f"{aPart.Name}--> Name of the Feature we where searching in.\n"
|
||||
)
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"{} --> Name of the parent Feature of reference Shape "
|
||||
"(Use the same as in the line before and you "
|
||||
"will have less trouble :-) !!!!!!).\n".format(parent.Name)
|
||||
)
|
||||
# import Part
|
||||
# Part.show(aShape)
|
||||
# Part.show(ref_shape)
|
||||
else:
|
||||
FreeCAD.Console.PrintError("This should not happen, please debug!\n")
|
||||
# in this case we would not have needed to use the
|
||||
# is_same_geometry() inside geomtools.find_element_in_shape()
|
||||
# AFAIK we could have used the Part methods isPartner() or even isSame()
|
||||
# We're going to find out when we need to debug this :-)!
|
||||
return (key, sorted(elements))
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ __url__ = "https://www.freecad.org"
|
||||
# \ingroup FEM
|
||||
# \brief base task panel for mesh object
|
||||
|
||||
import time
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from PySide import QtCore
|
||||
@@ -79,6 +78,11 @@ class _BaseMeshTaskPanel(base_femtaskpanel._BaseTaskPanel, ABC):
|
||||
QtCore.SIGNAL("finished(int,QProcess::ExitStatus)"),
|
||||
self.process_finished,
|
||||
)
|
||||
QtCore.QObject.connect(
|
||||
self.tool.process,
|
||||
QtCore.SIGNAL("finished(int,QProcess::ExitStatus)"),
|
||||
self.stop_timer,
|
||||
)
|
||||
QtCore.QObject.connect(
|
||||
self.tool.process,
|
||||
QtCore.SIGNAL("readyReadStandardOutput()"),
|
||||
@@ -171,7 +175,6 @@ class _BaseMeshTaskPanel(base_femtaskpanel._BaseTaskPanel, ABC):
|
||||
QtGui.QApplication.restoreOverrideCursor()
|
||||
if self.tool.process.state() != QtCore.QProcess.ProcessState.NotRunning:
|
||||
self.tool.process.kill()
|
||||
self._thread.quit()
|
||||
FreeCAD.Console.PrintWarning("Process aborted\n")
|
||||
else:
|
||||
return super().reject()
|
||||
@@ -189,19 +192,17 @@ class _BaseMeshTaskPanel(base_femtaskpanel._BaseTaskPanel, ABC):
|
||||
self.run_mesher()
|
||||
|
||||
def update_timer_text(self):
|
||||
if (
|
||||
self._thread.isRunning()
|
||||
or self.tool.process.state() != QtCore.QProcess.ProcessState.NotRunning
|
||||
):
|
||||
self.text_time.setText(f"Time: {time.time() - self.time_start:4.1f}")
|
||||
else:
|
||||
self.timer.stop()
|
||||
QtGui.QApplication.restoreOverrideCursor()
|
||||
self.text_time.setText(f"Time: {self.elapsed.elapsed()/1000:4.1f} s")
|
||||
|
||||
def stop_timer(self, code, status):
|
||||
self.timer.stop()
|
||||
QtGui.QApplication.restoreOverrideCursor()
|
||||
|
||||
def run_mesher(self):
|
||||
self.elapsed = QtCore.QElapsedTimer()
|
||||
self.elapsed.start()
|
||||
self.update_timer_text()
|
||||
self.timer.start(100)
|
||||
self.time_start = time.time()
|
||||
self.text_time.setText(f"Time: {time.time() - self.time_start:4.1f}: ")
|
||||
|
||||
self._thread.start()
|
||||
|
||||
|
||||
@@ -109,6 +109,8 @@ def check_member_for_solver_calculix(analysis, solver, mesh, member):
|
||||
mat_ref_shty = ""
|
||||
for m in member.mats_linear:
|
||||
ref_shty = femutils.get_refshape_type(m["Object"])
|
||||
if ref_shty == "Compound":
|
||||
ref_shty = "Solid"
|
||||
if not mat_ref_shty:
|
||||
mat_ref_shty = ref_shty
|
||||
if mat_ref_shty and ref_shty and ref_shty != mat_ref_shty:
|
||||
|
||||
@@ -446,14 +446,28 @@ void ExportOCAF::pushNode(int root_id,
|
||||
std::vector<TDF_Label>& hierarchical_label,
|
||||
std::vector<TopLoc_Location>& hierarchical_loc)
|
||||
{
|
||||
TDF_Label root;
|
||||
TDF_Label node;
|
||||
root = hierarchical_label.at(root_id - 1);
|
||||
node = hierarchical_label.at(node_id - 1);
|
||||
auto isValidIndex = [&](std::size_t root, std::size_t node) {
|
||||
// NOLINTBEGIN
|
||||
if (root >= hierarchical_label.size()) {
|
||||
return false;
|
||||
}
|
||||
if (node >= hierarchical_label.size() || node >= hierarchical_loc.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
XCAFDoc_DocumentTool::ShapeTool(root)->AddComponent(root,
|
||||
node,
|
||||
hierarchical_loc.at(node_id - 1));
|
||||
return true;
|
||||
// NOLINTEND
|
||||
};
|
||||
if (isValidIndex(root_id - 1, node_id - 1)) {
|
||||
TDF_Label root;
|
||||
TDF_Label node;
|
||||
TopLoc_Location locn;
|
||||
root = hierarchical_label.at(root_id - 1);
|
||||
node = hierarchical_label.at(node_id - 1);
|
||||
locn = hierarchical_loc.at(node_id - 1);
|
||||
|
||||
XCAFDoc_DocumentTool::ShapeTool(root)->AddComponent(root, node, locn);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -120,11 +120,14 @@ bool ViewProviderBoolean::onDelete(const std::vector<std::string> &s)
|
||||
return ViewProvider::onDelete(s);
|
||||
}
|
||||
|
||||
void ViewProviderBoolean::attach(App::DocumentObject* obj) {
|
||||
void ViewProviderBoolean::attach(App::DocumentObject* obj)
|
||||
{
|
||||
PartGui::ViewProviderPartExt::attach(obj);
|
||||
}
|
||||
|
||||
//set default display mode to override the "Group" display mode
|
||||
setDisplayMode("Flat Lines");
|
||||
const char* ViewProviderBoolean::getDefaultDisplayMode() const
|
||||
{
|
||||
return "Flat Lines";
|
||||
}
|
||||
|
||||
void ViewProviderBoolean::onChanged(const App::Property* prop) {
|
||||
|
||||
@@ -49,6 +49,7 @@ public:
|
||||
|
||||
bool onDelete(const std::vector<std::string> &) override;
|
||||
void attach(App::DocumentObject*) override;
|
||||
const char* getDefaultDisplayMode() const override;
|
||||
void onChanged(const App::Property* prop) override;
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user