[Sketcher] Add handlers for unified measurement facility
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
#include "SketchObjectSF.h"
|
||||
#include "SketchPy.h"
|
||||
#include "SolverGeometryExtension.h"
|
||||
|
||||
#include "Measure.h"
|
||||
|
||||
namespace Sketcher
|
||||
{
|
||||
@@ -95,6 +95,10 @@ PyMOD_INIT_FUNC(Sketcher)
|
||||
Sketcher::Constraint ::init();
|
||||
Sketcher::PropertyConstraintList ::init();
|
||||
|
||||
// connect to unified measurement facility
|
||||
Sketcher::Measure ::initialize();
|
||||
|
||||
|
||||
Base::Console().Log("Loading Sketcher module... done\n");
|
||||
|
||||
PyMOD_Return(sketcherModule);
|
||||
|
||||
@@ -121,6 +121,8 @@ SET(SketchModule_SRCS
|
||||
AppSketcherPy.cpp
|
||||
PreCompiled.cpp
|
||||
PreCompiled.h
|
||||
Measure.cpp
|
||||
Measure.h
|
||||
)
|
||||
SOURCE_GROUP("Module" FILES ${SketchModule_SRCS})
|
||||
|
||||
|
||||
38
src/Mod/Sketcher/App/Measure.cpp
Normal file
38
src/Mod/Sketcher/App/Measure.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 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 sketches like Part objects for now
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/MeasureManager.h>
|
||||
#include "Base/Console.h"
|
||||
#include "Measure.h"
|
||||
|
||||
|
||||
void Sketcher::Measure::initialize()
|
||||
{
|
||||
const App::MeasureHandler& handler = App::MeasureManager::getMeasureHandler("Part");
|
||||
|
||||
App::MeasureManager::addMeasureHandler("Sketcher", handler.typeCb);
|
||||
}
|
||||
43
src/Mod/Sketcher/App/Measure.h
Normal file
43
src/Mod/Sketcher/App/Measure.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 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 SKETCHER_MEASURE_H
|
||||
#define SKETCHER_MEASURE_H
|
||||
|
||||
#include <Mod/Sketcher/SketcherGlobal.h>
|
||||
|
||||
|
||||
namespace Sketcher
|
||||
{
|
||||
|
||||
|
||||
class SketcherExport Measure
|
||||
{
|
||||
public:
|
||||
static void initialize();
|
||||
};
|
||||
|
||||
|
||||
} // namespace Sketcher
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user