Merge branch 'FreeCAD:main' into cleanmodPart
This commit is contained in:
@@ -14,6 +14,10 @@ include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
${CMAKE_CURRENT_BINARY_DIR}/..
|
||||
)
|
||||
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${OCC_INCLUDE_DIR}
|
||||
${ZIPIOS_INCLUDES}
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
#include "SolverGeometryExtension.h"
|
||||
|
||||
#include "ExternalGeometryFacade.h"
|
||||
#include <Mod/Part/App/Datums.h>
|
||||
|
||||
|
||||
#undef DEBUG
|
||||
@@ -8265,6 +8266,9 @@ void SketchObject::validateExternalLinks()
|
||||
const Part::Datum* datum = static_cast<const Part::Datum*>(Obj);
|
||||
refSubShape = datum->getShape();
|
||||
}
|
||||
else if (Obj->isDerivedFrom<App::DatumElement>()) {
|
||||
// do nothing - shape will be calculated later during rebuild
|
||||
}
|
||||
else {
|
||||
const Part::Feature* refObj = static_cast<const Part::Feature*>(Obj);
|
||||
const Part::TopoShape& refShape = refObj->Shape.getShape();
|
||||
@@ -9202,6 +9206,35 @@ void SketchObject::rebuildExternalGeometry(std::optional<ExternalToAdd> extToAdd
|
||||
TopoDS_Face f = TopoDS::Face(fBuilder.Shape());
|
||||
refSubShape = f;
|
||||
}
|
||||
else if (Obj->isDerivedFrom<Part::DatumLine>()) {
|
||||
auto* line = static_cast<const Part::DatumLine*>(Obj);
|
||||
Base::Placement plm = line->Placement.getValue();
|
||||
Base::Vector3d base = plm.getPosition();
|
||||
Base::Vector3d dir = line->getDirection();
|
||||
gp_Lin l(gp_Pnt(base.x, base.y, base.z), gp_Dir(dir.x, dir.y, dir.z));
|
||||
BRepBuilderAPI_MakeEdge eBuilder(l);
|
||||
if (!eBuilder.IsDone()) {
|
||||
throw Base::RuntimeError(
|
||||
"Sketcher: addExternal(): Failed to build edge from Part::DatumLine");
|
||||
}
|
||||
|
||||
TopoDS_Edge e = TopoDS::Edge(eBuilder.Shape());
|
||||
refSubShape = e;
|
||||
}
|
||||
else if (Obj->isDerivedFrom<Part::DatumPoint>()) {
|
||||
auto* point = static_cast<const Part::DatumPoint*>(Obj);
|
||||
Base::Placement plm = point->Placement.getValue();
|
||||
Base::Vector3d base = plm.getPosition();
|
||||
gp_Pnt p(base.x, base.y, base.z);
|
||||
BRepBuilderAPI_MakeVertex eBuilder(p);
|
||||
if (!eBuilder.IsDone()) {
|
||||
throw Base::RuntimeError(
|
||||
"Sketcher: addExternal(): Failed to build vertex from Part::DatumPoint");
|
||||
}
|
||||
|
||||
TopoDS_Vertex v = TopoDS::Vertex(eBuilder.Shape());
|
||||
refSubShape = v;
|
||||
}
|
||||
else {
|
||||
throw Base::TypeError(
|
||||
"Datum feature type is not yet supported as external geometry for a sketch");
|
||||
|
||||
@@ -3,6 +3,10 @@ include_directories(
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_BINARY_DIR}/src
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${OCC_INCLUDE_DIR}
|
||||
${COIN3D_INCLUDE_DIRS}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "GeometryCreationMode.h"
|
||||
#include "Utils.h"
|
||||
#include "ViewProviderSketch.h"
|
||||
#include <Mod/Part/App/Datums.h>
|
||||
|
||||
|
||||
namespace SketcherGui
|
||||
@@ -97,18 +98,25 @@ public:
|
||||
// return false;
|
||||
//}
|
||||
|
||||
if (pObj->isDerivedFrom<Part::DatumLine>() || pObj->isDerivedFrom<Part::DatumPoint>()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pObj->isDerivedFrom<App::Plane>() || pObj->isDerivedFrom<Part::Datum>()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Base::Tools::isNullOrEmpty(sSubName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string element(sSubName);
|
||||
if ((element.size() > 4 && element.substr(0, 4) == "Edge")
|
||||
|| (element.size() > 6 && element.substr(0, 6) == "Vertex")
|
||||
|| (element.size() > 4 && element.substr(0, 4) == "Face")) {
|
||||
return true;
|
||||
}
|
||||
if (pObj->isDerivedFrom<App::Plane>() || pObj->isDerivedFrom<Part::Datum>()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -159,6 +167,7 @@ public:
|
||||
}
|
||||
std::string subName(msg.pSubName);
|
||||
if (obj->isDerivedFrom<App::Plane>() || obj->isDerivedFrom<Part::Datum>()
|
||||
|| obj->isDerivedFrom<Part::DatumLine>() || obj->isDerivedFrom<Part::DatumPoint>()
|
||||
|| (subName.size() > 4 && subName.substr(0, 4) == "Edge")
|
||||
|| (subName.size() > 6 && subName.substr(0, 6) == "Vertex")
|
||||
|| (subName.size() > 4 && subName.substr(0, 4) == "Face")) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "Mod/Sketcher/App/ExternalGeometryFacade.h"
|
||||
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
#include <Gui/ViewParams.h>
|
||||
|
||||
#include "EditModeCoinManagerParameters.h"
|
||||
@@ -59,10 +59,10 @@ SbColor DrawingParameters::CreateCurveColor(0.5f, 0.5f, 0.5f); // ##7f7f7f -> (
|
||||
namespace
|
||||
{ // Anonymous namespace to avoid making those variables global
|
||||
unsigned long HColorLong = Gui::ViewParams::instance()->getAxisXColor();
|
||||
App::Color Hcolor = App::Color(static_cast<uint32_t>(HColorLong));
|
||||
Base::Color Hcolor = Base::Color(static_cast<uint32_t>(HColorLong));
|
||||
|
||||
unsigned long VColorLong = Gui::ViewParams::instance()->getAxisYColor();
|
||||
App::Color Vcolor = App::Color(static_cast<uint32_t>(VColorLong));
|
||||
Base::Color Vcolor = Base::Color(static_cast<uint32_t>(VColorLong));
|
||||
} // namespace
|
||||
SbColor DrawingParameters::CrossColorH(Hcolor.r, Hcolor.g, Hcolor.b);
|
||||
SbColor DrawingParameters::CrossColorV(Vcolor.r, Vcolor.g, Vcolor.b);
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <Inventor/nodes/SoText2.h>
|
||||
#include <Inventor/nodes/SoTranslation.h>
|
||||
|
||||
#include <App/Color.h>
|
||||
#include <Base/Color.h>
|
||||
#include <Gui/ViewParams.h>
|
||||
#include <Gui/Inventor/SmSwitchboard.h>
|
||||
#include <Mod/Sketcher/App/GeoList.h>
|
||||
@@ -153,14 +153,14 @@ struct DrawingParameters
|
||||
DrawingParameters()
|
||||
{
|
||||
unsigned long colorLong;
|
||||
App::Color color;
|
||||
Base::Color color;
|
||||
|
||||
colorLong = Gui::ViewParams::instance()->getAxisXColor();
|
||||
color = App::Color(static_cast<uint32_t>(colorLong));
|
||||
color = Base::Color(static_cast<uint32_t>(colorLong));
|
||||
CrossColorH = SbColor(color.r, color.g, color.b);
|
||||
|
||||
colorLong = Gui::ViewParams::instance()->getAxisYColor();
|
||||
color = App::Color(static_cast<uint32_t>(colorLong));
|
||||
color = Base::Color(static_cast<uint32_t>(colorLong));
|
||||
CrossColorV = SbColor(color.r, color.g, color.b);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -141,7 +141,7 @@ void ViewProviderSketch::ParameterObserver::updateColorProperty(const std::strin
|
||||
|
||||
colorprop->setValue(r, g, b);
|
||||
|
||||
App::Color elementAppColor = colorprop->getValue();
|
||||
Base::Color elementAppColor = colorprop->getValue();
|
||||
unsigned long color = (unsigned long)(elementAppColor.getPackedValue());
|
||||
color = hGrp->GetUnsigned(string.c_str(), color);
|
||||
elementAppColor.setPackedValue((uint32_t)color);
|
||||
@@ -345,7 +345,7 @@ void ViewProviderSketch::ParameterObserver::initParameters()
|
||||
{[this, packedDefaultGridColor](const std::string& string,
|
||||
[[maybe_unused]] App::Property* property) {
|
||||
auto v = getSketcherGeneralParameter(string, packedDefaultGridColor);
|
||||
auto color = App::Color(v);
|
||||
auto color = Base::Color(v);
|
||||
Client.setGridLineColor(color);
|
||||
},
|
||||
nullptr}},
|
||||
@@ -353,7 +353,7 @@ void ViewProviderSketch::ParameterObserver::initParameters()
|
||||
{[this, packedDefaultGridColor](const std::string& string,
|
||||
[[maybe_unused]] App::Property* property) {
|
||||
auto v = getSketcherGeneralParameter(string, packedDefaultGridColor);
|
||||
auto color = App::Color(v);
|
||||
auto color = Base::Color(v);
|
||||
Client.setGridDivLineColor(color);
|
||||
},
|
||||
nullptr}},
|
||||
@@ -2941,7 +2941,7 @@ void SketcherGui::ViewProviderSketch::finishRestoring()
|
||||
// that meaans that we need to run migration strategy and come up with a proper value
|
||||
if (!AutoColor.isTouched()) {
|
||||
// white is the normally provided default for FreeCAD sketch colors
|
||||
auto white = App::Color(1.f, 1.f, 1.f, 1.f);
|
||||
auto white = Base::Color(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
auto colorWasNeverChanged =
|
||||
LineColor.getValue() == white &&
|
||||
|
||||
Reference in New Issue
Block a user