Merge branch 'master' into RRF-PP-for-Path

This commit is contained in:
P-C-R
2021-11-05 10:42:26 +01:00
committed by GitHub
65 changed files with 227 additions and 147 deletions

View File

@@ -549,7 +549,7 @@ class _TaskPanel:
# for example PoissonRatio
value = Units.Quantity(inputfield_text).Value
old_value = Units.Quantity(self.material[matProperty]).Value
# value = float(inputfield_text) # this fails on locale with komma
# value = float(inputfield_text) # this fails on locale with comma
# https://forum.freecadweb.org/viewtopic.php?f=18&t=56912&p=523313#p523313
if value:
if not (1 - variation < float(old_value) / value < 1 + variation):

View File

@@ -368,7 +368,7 @@ private:
//makeHeader.SetName(new TCollection_HAsciiString((Standard_CString)Utf8Name.c_str()));
makeHeader.SetAuthorValue (1, new TCollection_HAsciiString(hGrp->GetASCII("Author", "Author").c_str()));
makeHeader.SetOrganizationValue (1, new TCollection_HAsciiString(hGrp->GetASCII("Company").c_str()));
makeHeader.SetOriginatingSystem(new TCollection_HAsciiString(App::GetApplication().getExecutableName()));
makeHeader.SetOriginatingSystem(new TCollection_HAsciiString(App::Application::getExecutableName().c_str()));
makeHeader.SetDescriptionValue(1, new TCollection_HAsciiString("FreeCAD Model"));
IFSelect_ReturnStatus ret = writer.Write(name8bit.c_str());
if (ret == IFSelect_RetError || ret == IFSelect_RetFail || ret == IFSelect_RetStop) {

View File

@@ -668,7 +668,7 @@ private:
//makeHeader.SetName(new TCollection_HAsciiString((Standard_CString)Utf8Name.c_str()));
makeHeader.SetAuthorValue (1, new TCollection_HAsciiString(hGrp->GetASCII("Author", "Author").c_str()));
makeHeader.SetOrganizationValue (1, new TCollection_HAsciiString(hGrp->GetASCII("Company").c_str()));
makeHeader.SetOriginatingSystem(new TCollection_HAsciiString(App::GetApplication().getExecutableName()));
makeHeader.SetOriginatingSystem(new TCollection_HAsciiString(App::Application::getExecutableName().c_str()));
makeHeader.SetDescriptionValue(1, new TCollection_HAsciiString("FreeCAD Model"));
IFSelect_ReturnStatus ret = writer.Write(name8bit.c_str());
if (ret == IFSelect_RetError || ret == IFSelect_RetFail || ret == IFSelect_RetStop) {

View File

@@ -514,7 +514,7 @@ public:
dKoeff[ ct ] = pKoef[ ct ];
}
/**
* Destruktor. Deletes the ImpicitSurface instance
* Destructor. Deletes the ImpicitSurface instance
* of the WildMagic library
*/
~FunctionContainer(){ delete pImplSurf; }

View File

@@ -180,22 +180,22 @@ MeshFacetArray& MeshFacetArray::operator = (const MeshFacetArray &rclFAry)
bool MeshGeomEdge::ContainedByOrIntersectBoundingBox ( const Base::BoundBox3f &rclBB ) const
{
// Test, ob alle Eckpunkte der Edge sich auf einer der 6 Seiten der BB befinden
// Test whether all corner points of the Edge are on one of the 6 sides of the BB
if ((GetBoundBox() && rclBB) == false)
return false;
// Test, ob Edge-BB komplett in BB liegt
// Test whether Edge-BB is completely in BB
if (rclBB.IsInBox(GetBoundBox()))
return true;
// Test, ob einer der Eckpunkte in BB liegt
// Test whether one of the corner points is in BB
for (int i=0;i<2;i++)
{
if (rclBB.IsInBox(_aclPoints[i]))
return true;
}
// "echter" Test auf Schnitt
// "real" test for cut
if (IntersectBoundingBox(rclBB))
return true;
@@ -487,7 +487,7 @@ bool MeshGeomFacet::IsPointOf (const Base::Vector3f &rclPoint, float fDistance)
clProjPt.ProjectToPlane(_aclPoints[0], clNorm);
// Kante P0 --> P1
// Edge P0 --> P1
clEdge = clP1 - clP0;
fLP = clProjPt.DistanceToLine(clP0, clEdge);
if (fLP > 0.0f)
@@ -500,9 +500,9 @@ bool MeshGeomFacet::IsPointOf (const Base::Vector3f &rclPoint, float fDistance)
}
else
return false;
}
}
// Kante P0 --> P2
// Edge P0 --> P2
clEdge = clP2 - clP0;
fLP = clProjPt.DistanceToLine(clP0, clEdge);
if (fLP > 0.0f)
@@ -515,9 +515,9 @@ bool MeshGeomFacet::IsPointOf (const Base::Vector3f &rclPoint, float fDistance)
}
else
return false;
}
}
// Kante P1 --> P2
// Edge P1 --> P2
clEdge = clP2 - clP1;
fLP = clProjPt.DistanceToLine(clP1, clEdge);
if (fLP > 0.0f)
@@ -537,7 +537,7 @@ bool MeshGeomFacet::IsPointOf (const Base::Vector3f &rclPoint, float fDistance)
bool MeshGeomFacet::IsPointOfFace (const Base::Vector3f& rclP, float fDistance) const
{
// effektivere Implementierung als in MeshGeomFacet::IsPointOf
// more effective implementation than in MeshGeomFacet::IsPointOf
//
Base::Vector3f a(_aclPoints[0].x, _aclPoints[0].y, _aclPoints[0].z);
Base::Vector3f b(_aclPoints[1].x, _aclPoints[1].y, _aclPoints[1].z);
@@ -907,7 +907,7 @@ bool MeshGeomFacet::Foraminate (const Base::Vector3f &P, const Base::Vector3f &d
bool MeshGeomFacet::IntersectPlaneWithLine (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, Base::Vector3f &rclRes) const
{
// berechne den Schnittpunkt Gerade <-> Ebene
// calculate the intersection of the straight line <-> plane
if ( fabs(rclDir * GetNormal()) < 1e-3f )
return false; // line and plane are parallel
@@ -979,7 +979,7 @@ void MeshGeomFacet::SubSample (float fStep, std::vector<Base::Vector3f> &rclPoin
Base::Vector3f clVecAC(C - A);
Base::Vector3f clVecBC(C - B);
// laengste Achse entspricht AB
// longest axis corresponds to AB
float fLenAB = clVecAB.Length();
float fLenAC = clVecAC.Length();
float fLenBC = clVecBC.Length();

View File

@@ -42,6 +42,8 @@
<file>icons/RegularSolids/Mesh_Ellipsoid.svg</file>
<file>icons/RegularSolids/Mesh_Sphere.svg</file>
<file>icons/RegularSolids/Mesh_Torus.svg</file>
</qresource>
<qresource>
<file>translations/Mesh_af.qm</file>
<file>translations/Mesh_de.qm</file>
<file>translations/Mesh_fi.qm</file>

View File

@@ -274,7 +274,7 @@ void ViewProvider2DObjectGrid::onChanged(const App::Property* prop)
ViewProviderPart::onChanged(prop);
if (prop == &ShowGrid || prop == &ShowOnlyInEditMode || prop == &Visibility) {
if (ShowGrid.getValue() && Visibility.getValue() && !(ShowOnlyInEditMode.getValue() && !this->isEditing()))
if (ShowGrid.getValue() && ((Visibility.getValue() && !ShowOnlyInEditMode.getValue()) || this->isEditing()))
createGrid();
else
Gui::coinRemoveAllChildren(GridRoot);

View File

@@ -21,8 +21,8 @@
***************************************************************************/
#ifndef PARTGUI_IEWPROVIDER2DOBJECT_H
#define PARTGUI_IEWPROVIDER2DOBJECT_H
#ifndef PARTGUI_VIEWPROVIDER2DOBJECT_H
#define PARTGUI_VIEWPROVIDER2DOBJECT_H
#include "ViewProvider.h"
#include <App/PropertyUnits.h>
@@ -103,5 +103,5 @@ typedef Gui::ViewProviderPythonFeatureT<ViewProvider2DObject> ViewProvider2DObje
} // namespace PartGui
#endif // PARTGUI_IEWPROVIDER2DOBJECT_H
#endif // PARTGUI_VIEWPROVIDER2DOBJECT_H

View File

@@ -28,6 +28,7 @@
# include <QMessageBox>
#endif
#include <App/Application.h>
#include <Gui/Application.h>
#include "DlgActiveBody.h"
@@ -92,10 +93,15 @@ void DlgActiveBody::accept()
App::DocumentObject* selectedBody =
selectedItems[0]->data(Qt::UserRole).value<App::DocumentObject*>();
if (selectedBody)
if (selectedBody) {
activeBody = makeBodyActive(selectedBody, _doc);
else
}
else {
// A transaction must be created as otherwise the undo/redo is broken
App::GetApplication().setActiveTransaction(QT_TRANSLATE_NOOP("Command", "Add a Body"), true);
activeBody = makeBody(_doc);
App::GetApplication().closeActiveTransaction();
}
QDialog::accept();
}

View File

@@ -82,7 +82,7 @@ private:
wc.restoreCursor();
try {
std::string path = App::GetApplication().getHomePath();
std::string path = App::Application::getHomePath();
path += "Mod/Path/PathScripts/post/";
QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_pre.py"));
std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro")
@@ -149,7 +149,7 @@ private:
wc.restoreCursor();
try {
std::string path = App::GetApplication().getHomePath();
std::string path = App::Application::getHomePath();
path += "Mod/Path/PathScripts/post/";
QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_pre.py"));
std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro")
@@ -225,7 +225,7 @@ private:
if (objlist.size() == 0)
throw Py::RuntimeError("No object to export");
std::string path = App::GetApplication().getHomePath();
std::string path = App::Application::getHomePath();
path += "Mod/Path/PathScripts/post/";
QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_post.py"));
std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro")

View File

@@ -222,7 +222,7 @@ private:
if (! PyArg_ParseTuple(args.ptr(), "ss",&FileName,&DestDir))
throw Py::Exception();
std::string resName = App::GetApplication().getHomePath();
std::string resName = App::Application::getHomePath();
resName += "Mod";
resName += PATHSEP ;
resName += "Raytracing";

View File

@@ -264,9 +264,6 @@ void TaskSketcherGeneral::onChangedSketchView(const Gui::ViewProvider& vp,
QSignalBlocker block(widget);
widget->checkGridView(sketchView->ShowGrid.getValue());
widget->enableGridSettings(sketchView->ShowGrid.getValue());
if (sketchView->ShowGrid.getValue()) {
sketchView->createGrid();
}
}
else if (&sketchView->GridSize == &prop) {
QSignalBlocker block(widget);
@@ -293,7 +290,6 @@ void TaskSketcherGeneral::onToggleGridView(bool on)
Base::ConnectionBlocker block(changedSketchView);
sketchView->ShowGrid.setValue(on);
widget->enableGridSettings(on);
if (on) sketchView->createGrid();
}
void TaskSketcherGeneral::onSetGridSize(double val)

View File

@@ -6,32 +6,57 @@
<rect>
<x>0</x>
<y>0</y>
<width>311</width>
<height>453</height>
<width>266</width>
<height>684</height>
</rect>
</property>
<property name="windowTitle">
<string>Sketcher validation</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<item row="5" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Reversed external geometry</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QPushButton" name="findReversed">
<property name="toolTip">
<string>Finds reversed external geometries</string>
</property>
<property name="text">
<string>Find</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="swapReversed">
<property name="toolTip">
<string>Fixes found reversed external geometries by swapping their endpoints</string>
</property>
<property name="text">
<string>Swap endpoints in constraints</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_1">
<property name="toolTip">
<string>Fixes found missing coincidences by adding extra coincident constrains</string>
</property>
<property name="title">
<string>Missing coincidences</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Tolerance:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxTolerance"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxIgnoreConstruction">
<property name="toolTip">
<string>If checked, construction geometries are ignored in the search</string>
</property>
<property name="text">
<string>Ignore construction geometry</string>
</property>
@@ -42,11 +67,22 @@
</item>
<item row="2" column="0">
<widget class="QPushButton" name="findButton">
<property name="toolTip">
<string>Finds and displays missing coincidences found in the sketch
This is done by analyzing the sketch geometries and constraints</string>
</property>
<property name="text">
<string>Find</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Tolerance:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="fixButton">
<property name="text">
@@ -54,17 +90,17 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="highlightButton">
<property name="text">
<string>Highlight open vertexes</string>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxTolerance">
<property name="toolTip">
<string>Defines the X/Y tolerance inside which missing coincidences are searched.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Invalid constraints</string>
@@ -72,6 +108,9 @@
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QPushButton" name="findConstraint">
<property name="toolTip">
<string>Finds invalid/malformed constrains in the sketch</string>
</property>
<property name="text">
<string>Find</string>
</property>
@@ -79,6 +118,9 @@
</item>
<item row="0" column="1">
<widget class="QPushButton" name="fixConstraint">
<property name="toolTip">
<string>Tries to fix found invalid constraints</string>
</property>
<property name="text">
<string>Fix</string>
</property>
@@ -86,6 +128,9 @@
</item>
<item row="1" column="0" colspan="2">
<widget class="QPushButton" name="delConstrExtr">
<property name="toolTip">
<string>Deletes constrains refering to external geometry</string>
</property>
<property name="text">
<string>Delete constraints to external geom.</string>
</property>
@@ -94,7 +139,39 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_0">
<property name="title">
<string>Open and non-manifold vertexes</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="highlightButton">
<property name="toolTip">
<string>Highlights open and non-manifold vertexes that could lead to error if sketch is used to generate solids
This is purely based on topological shape of the sketch and not on its geometry/constrain set.</string>
</property>
<property name="text">
<string>Highlight troublesome vertexes</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
<string>Degenerated geometry</string>
@@ -102,6 +179,9 @@
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QPushButton" name="findDegenerated">
<property name="toolTip">
<string>Finds degenerated geometries in the sketch</string>
</property>
<property name="text">
<string>Find</string>
</property>
@@ -109,6 +189,9 @@
</item>
<item row="0" column="1">
<widget class="QPushButton" name="fixDegenerated">
<property name="toolTip">
<string>Tries to fix found degenerated geometries</string>
</property>
<property name="text">
<string>Fix</string>
</property>
@@ -117,30 +200,7 @@
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Reversed external geometry</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QPushButton" name="findReversed">
<property name="text">
<string>Find</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="swapReversed">
<property name="text">
<string>Swap endpoints in constraints</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Constraint orientation locking</string>
@@ -148,6 +208,9 @@
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QPushButton" name="orientLockEnable">
<property name="toolTip">
<string>Enables/updates constraint orientation locking</string>
</property>
<property name="text">
<string>Enable/Update</string>
</property>
@@ -155,6 +218,9 @@
</item>
<item row="1" column="0">
<widget class="QPushButton" name="orientLockDisable">
<property name="toolTip">
<string>Disables constraint orientation locking</string>
</property>
<property name="text">
<string>Disable</string>
</property>

View File

@@ -351,7 +351,7 @@ void PropertySheet::copyCells(Base::Writer& writer, const std::vector<Range>& ra
writer.incInd();
do {
auto cell = getValue(*range);
if (cell) {
if (cell && cell->isUsed()) {
cell->save(writer);
}
else {

View File

@@ -547,6 +547,16 @@ bool SheetModel::setData(const QModelIndex & index, const QVariant & value, int
try {
QString str = value.toString();
// Check to see if this is already the value in the cell, and skip the update if so
auto cell = sheet->getCell(address);
if (cell) {
std::string oldContent;
cell->getStringContent(oldContent);
if (str == QString::fromStdString(oldContent))
return true;
}
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Edit cell"));
// Because of possible complication of recursively escaped
// characters, let's take a shortcut and bypass the command