Surface: Provide geometry to Measure module (#26479)
* [Surf]provide geometry to Measure * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -498,6 +498,7 @@ Part::CallbackRegistrationList Part::MeasureClient::reportLengthCB()
|
||||
callbacks.emplace_back("Part", "Length", MeasureLengthHandler);
|
||||
callbacks.emplace_back("PartDesign", "Length", MeasureLengthHandler);
|
||||
callbacks.emplace_back("Sketcher", "Length", MeasureLengthHandler);
|
||||
callbacks.emplace_back("Surface", "Length", MeasureLengthHandler);
|
||||
return callbacks;
|
||||
}
|
||||
|
||||
@@ -507,6 +508,7 @@ Part::CallbackRegistrationList Part::MeasureClient::reportPositionCB()
|
||||
callbacks.emplace_back("Part", "Position", MeasurePositionHandler);
|
||||
callbacks.emplace_back("PartDesign", "Position", MeasurePositionHandler);
|
||||
callbacks.emplace_back("Sketcher", "Position", MeasurePositionHandler);
|
||||
callbacks.emplace_back("Surface", "Position", MeasurePositionHandler);
|
||||
return callbacks;
|
||||
}
|
||||
|
||||
@@ -516,6 +518,7 @@ Part::CallbackRegistrationList Part::MeasureClient::reportAreaCB()
|
||||
callbacks.emplace_back("Part", "Area", MeasureAreaHandler);
|
||||
callbacks.emplace_back("PartDesign", "Area", MeasureAreaHandler);
|
||||
callbacks.emplace_back("Sketcher", "Area", MeasureAreaHandler);
|
||||
callbacks.emplace_back("Surface", "Area", MeasureAreaHandler);
|
||||
return callbacks;
|
||||
}
|
||||
|
||||
@@ -526,6 +529,7 @@ Part::CallbackRegistrationList Part::MeasureClient::reportAngleCB()
|
||||
callbacks.emplace_back("Part", "Angle", MeasureAngleHandler);
|
||||
callbacks.emplace_back("PartDesign", "Angle", MeasureAngleHandler);
|
||||
callbacks.emplace_back("Sketcher", "Angle", MeasureAngleHandler);
|
||||
callbacks.emplace_back("Surface", "Angle", MeasureAngleHandler);
|
||||
return callbacks;
|
||||
}
|
||||
|
||||
@@ -536,6 +540,7 @@ Part::CallbackRegistrationList Part::MeasureClient::reportDistanceCB()
|
||||
callbacks.emplace_back("Part", "Distance", MeasureDistanceHandler);
|
||||
callbacks.emplace_back("PartDesign", "Distance", MeasureDistanceHandler);
|
||||
callbacks.emplace_back("Sketcher", "Distance", MeasureDistanceHandler);
|
||||
callbacks.emplace_back("Surface", "Distance", MeasureDistanceHandler);
|
||||
return callbacks;
|
||||
}
|
||||
|
||||
@@ -546,5 +551,6 @@ Part::CallbackRegistrationList Part::MeasureClient::reportRadiusCB()
|
||||
callbacks.emplace_back("Part", "Radius", MeasureRadiusHandler);
|
||||
callbacks.emplace_back("PartDesign", "Radius", MeasureRadiusHandler);
|
||||
callbacks.emplace_back("Sketcher", "Radius", MeasureRadiusHandler);
|
||||
callbacks.emplace_back("Surface", "Radius", MeasureRadiusHandler);
|
||||
return callbacks;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include "FeatureSections.h"
|
||||
#include "FeatureSewing.h"
|
||||
|
||||
#include "Measure.h"
|
||||
|
||||
|
||||
namespace Surface
|
||||
{
|
||||
@@ -87,5 +89,8 @@ PyMOD_INIT_FUNC(Surface)
|
||||
Surface::Sections ::init();
|
||||
// clang-format on
|
||||
|
||||
// connect to unified measurement facility
|
||||
Surface::Measure ::initialize();
|
||||
|
||||
PyMOD_Return(mod);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ SET(Surface_SRCS
|
||||
FeatureSewing.h
|
||||
FeatureCut.cpp
|
||||
FeatureCut.h
|
||||
Measure.cpp
|
||||
Measure.h
|
||||
)
|
||||
|
||||
add_library(Surface SHARED ${Surface_SRCS})
|
||||
|
||||
37
src/Mod/Surface/App/Measure.cpp
Normal file
37
src/Mod/Surface/App/Measure.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2025 Wandererfan <wandererfan@gmail.com> *
|
||||
* *
|
||||
* 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 *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
//! a class for establishing our connection with the unified measurement facility
|
||||
//! we are treating surfaces like Part objects for now
|
||||
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/MeasureManager.h>
|
||||
#include "Base/Console.h"
|
||||
#include "Measure.h"
|
||||
|
||||
|
||||
void Surface::Measure::initialize()
|
||||
{
|
||||
const App::MeasureHandler& handler = App::MeasureManager::getMeasureHandler("Part");
|
||||
|
||||
App::MeasureManager::addMeasureHandler("Surface", handler.typeCb);
|
||||
}
|
||||
43
src/Mod/Surface/App/Measure.h
Normal file
43
src/Mod/Surface/App/Measure.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2025 Wandererfan <wandererfan@gmail.com> *
|
||||
* *
|
||||
* 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 *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
//! a class for establishing our connection with the unified measurement facility
|
||||
|
||||
#ifndef SURFACE_MEASURE_H
|
||||
#define SURFACE_MEASURE_H
|
||||
|
||||
#include <Mod/Surface/SurfaceGlobal.h>
|
||||
|
||||
|
||||
namespace Surface
|
||||
{
|
||||
|
||||
|
||||
class SurfaceExport Measure
|
||||
{
|
||||
public:
|
||||
static void initialize();
|
||||
};
|
||||
|
||||
|
||||
} // namespace Surface
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user