Merge branch 'main' into feature_23649_update_confusing_nomenclature_offset_pattern

This commit is contained in:
Alihan Tadal
2025-09-13 08:42:34 +03:00
committed by GitHub
7 changed files with 93 additions and 52 deletions

View File

@@ -155,6 +155,7 @@ using namespace Gui::DockWnd;
using namespace std;
namespace sp = std::placeholders;
FC_LOG_LEVEL_INIT("Gui")
Application* Application::Instance = nullptr;
@@ -892,6 +893,10 @@ void Application::exportTo(const char* FileName, const char* DocName, const char
string unicodepath = Base::Tools::escapedUnicodeFromUtf8(File.filePath().c_str());
unicodepath = Base::Tools::escapeEncodeFilename(unicodepath);
if (strcmp(Module, "Part") == 0) {
FC_WARN("Exporting with 'Part' is deprecated, use 'ImportGui' instead");
}
if (Module) {
try {
std::vector<App::DocumentObject*> sel =

View File

@@ -111,6 +111,8 @@
# include "FT2FC.h"
#endif
FC_LOG_LEVEL_INIT("Part")
extern const char* BRepBuilderAPI_FaceErrorText(BRepBuilderAPI_FaceError fe);
namespace Part {
@@ -784,6 +786,7 @@ private:
pcDoc->recompute();
}
else {
FC_WARN("Importing BREP via 'Part' is deprecated. Use 'ImportGui' instead.");
TopoShape shape;
shape.read(EncodedName.c_str());

View File

@@ -40,17 +40,20 @@
# include <XSControl_WorkSession.hxx>
#endif
#include <Base/Console.h>
#include <App/Document.h>
#include <Base/Sequencer.h>
#include "ImportIges.h"
#include "PartFeature.h"
FC_LOG_LEVEL_INIT("Part")
using namespace Part;
int Part::ImportIgesParts(App::Document *pcDoc, const char* FileName)
{
FC_WARN("Importing IGES via 'Part' is deprecated. Use 'ImportGui' instead.");
try {
Base::FileInfo fi(FileName);
// read iges file

View File

@@ -51,6 +51,7 @@
#include "ShapeMapHasher.h"
#include "PartFeature.h"
FC_LOG_LEVEL_INIT("Part")
namespace Part {
bool ReadColors (const Handle(XSControl_WorkSession) &WS, std::map<int, Quantity_Color>& hash_col);
@@ -68,6 +69,8 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name)
TopoDS_Shape aShape;
Base::FileInfo fi(Name);
FC_WARN("Importing STEP via 'Part' is deprecated. Use 'ImportGui' instead.");
if (!fi.exists()) {
std::stringstream str;
str << "File '" << Name << "' does not exist!";

View File

@@ -1458,6 +1458,11 @@ void TaskSketcherConstraints::onListWidgetConstraintsItemSelectionChanged()
Gui::Selection().addSelections(doc_name.c_str(), obj_name.c_str(), constraintSubNames);
this->blockSelection(block);
// it seems that addSelections gives back the focus to the view, and not immediately.
QTimer::singleShot(200, [this]() {
ui->listWidgetConstraints->setFocus();
});
}
void TaskSketcherConstraints::change3DViewVisibilityToTrackFilter(bool filterEnabled)

View File

@@ -1735,6 +1735,11 @@ void TaskSketcherElements::onListWidgetElementsItemPressed(QListWidgetItem* it)
previouslySelectedItemIndex = focusItemIndex;
ui->listWidgetElements->repaint();
// it seems that addSelections gives back the focus to the view, and not immediately.
QTimer::singleShot(200, [this]() {
ui->listWidgetElements->setFocus();
});
}
bool TaskSketcherElements::hasInputWidgetFocused()

View File

@@ -2729,6 +2729,20 @@ bool ViewProviderSketch::selectAll()
return false;
}
// Check if the focus is on the constraints or element list widget.
QWidget* focusedWidget = QApplication::focusWidget();
bool focusOnConstraintWidget = false;
bool focusOnElementWidget = false;
if (focusedWidget) {
if (focusedWidget->objectName().toStdString() == "listWidgetConstraints") {
focusOnConstraintWidget = true;
}
else if (focusedWidget->objectName().toStdString() == "listWidgetElements") {
focusOnElementWidget = true;
}
}
bool noWidgetSelected = !focusOnConstraintWidget && !focusOnElementWidget;
Sketcher::SketchObject* sketchObject = getSketchObject();
if (!sketchObject) {
return false;
@@ -2736,70 +2750,73 @@ bool ViewProviderSketch::selectAll()
Gui::Selection().clearSelection();
int intGeoCount = sketchObject->getHighestCurveIndex() + 1;
int extGeoCount = sketchObject->getExternalGeometryCount();
if (focusOnElementWidget || noWidgetSelected) {
int intGeoCount = sketchObject->getHighestCurveIndex() + 1;
int extGeoCount = sketchObject->getExternalGeometryCount();
const std::vector<Part::Geometry*> geomlist = sketchObject->getCompleteGeometry();
const std::vector<Part::Geometry*> geomlist = sketchObject->getCompleteGeometry();
int VertexId = -1;
int GeoId = 0;
int VertexId = -1;
int GeoId = 0;
auto selectVertex = [this](int &vertexId, int numberOfVertices) {
for (int i = 0; i < numberOfVertices; i++) {
vertexId++;
addSelection2(fmt::format("Vertex{}", vertexId + 1));
}
};
auto selectVertex = [this](int &vertexId, int numberOfVertices) {
for (int i = 0; i < numberOfVertices; i++) {
vertexId++;
addSelection2(fmt::format("Vertex{}", vertexId + 1));
}
};
auto selectEdge = [this](int GeoId) {
if (GeoId >= 0) {
addSelection2(fmt::format("Edge{}", GeoId + 1));
} else {
addSelection2(fmt::format("ExternalEdge{}", GeoEnum::RefExt - GeoId + 1));
}
};
auto selectEdge = [this](int GeoId) {
if (GeoId >= 0) {
addSelection2(fmt::format("Edge{}", GeoId + 1));
} else {
addSelection2(fmt::format("ExternalEdge{}", GeoEnum::RefExt - GeoId + 1));
}
};
bool hasUnselectedGeometry = false;
bool hasUnselectedGeometry = false;
for (std::vector<Part::Geometry*>::const_iterator it = geomlist.begin();
it != geomlist.end() - 2; // -2 to exclude H_Axis and V_Axis
++it, ++GeoId) {
for (std::vector<Part::Geometry*>::const_iterator it = geomlist.begin();
it != geomlist.end() - 2; // -2 to exclude H_Axis and V_Axis
++it, ++GeoId) {
if (GeoId >= intGeoCount) {
GeoId = -extGeoCount;
if (GeoId >= intGeoCount) {
GeoId = -extGeoCount;
}
if ((*it)->is<Part::GeomPoint>()) {
selectVertex(VertexId, 1);
}
else if ((*it)->is<Part::GeomLineSegment>() || (*it)->is<Part::GeomBSplineCurve>()) {
selectVertex(VertexId, 2); // Start + End
selectEdge(GeoId);
}
else if ((*it)->isDerivedFrom<Part::GeomConic>()) {
selectVertex(VertexId, 1); // Center
selectEdge(GeoId);
}
else if ((*it)->isDerivedFrom<Part::GeomArcOfConic>()) {
selectVertex(VertexId, 3); // Start + End + Center
selectEdge(GeoId);
}
else {
hasUnselectedGeometry = true;
}
}
if ((*it)->is<Part::GeomPoint>()) {
selectVertex(VertexId, 1);
}
else if ((*it)->is<Part::GeomLineSegment>() || (*it)->is<Part::GeomBSplineCurve>()) {
selectVertex(VertexId, 2); // Start + End
selectEdge(GeoId);
}
else if ((*it)->isDerivedFrom<Part::GeomConic>()) {
selectVertex(VertexId, 1); // Center
selectEdge(GeoId);
}
else if ((*it)->isDerivedFrom<Part::GeomArcOfConic>()) {
selectVertex(VertexId, 3); // Start + End + Center
selectEdge(GeoId);
}
else {
hasUnselectedGeometry = true;
// get root point if they exist
addSelection2("RootPoint");
if (hasUnselectedGeometry) {
Base::Console().error("Select All: Not all geometry was selected");
}
}
// select constraints too
const std::vector<Sketcher::Constraint*>& constraints = sketchObject->Constraints.getValues();
for (size_t i = 0; i < constraints.size(); ++i) {
addSelection2(fmt::format("Constraint{}", i + 1));
}
// get root point if they exist
addSelection2("RootPoint");
if (hasUnselectedGeometry) {
Base::Console().error("Select All: Not all geometry was selected");
if (focusOnConstraintWidget || noWidgetSelected) {
const std::vector<Sketcher::Constraint*>& constraints = sketchObject->Constraints.getValues();
for (size_t i = 0; i < constraints.size(); ++i) {
addSelection2(fmt::format("Constraint{}", i + 1));
}
}
return true;