// SPDX-License-Identifier: LGPL-2.1-or-later /*************************************************************************** * Copyright (c) 2019 Manuel Apeltauer, direkt cnc-systeme GmbH * * Copyright (c) 2024 Werner Mayer * * * * 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 * * . * * * **************************************************************************/ #ifndef PART_FEATUREPROJECTONSURFACE_H #define PART_FEATUREPROJECTONSURFACE_H #include "PartFeature.h" #include #include #include namespace Part { class PartExport ProjectOnSurface : public Part::Feature { PROPERTY_HEADER_WITH_OVERRIDE(Part::ProjectOnSurface); public: ProjectOnSurface(); App::PropertyEnumeration Mode; App::PropertyLength Height; App::PropertyDistance Offset; App::PropertyDirection Direction; App::PropertyLinkSub SupportFace; App::PropertyLinkSubList Projection; static constexpr const char* AllMode = "All"; static constexpr const char* FacesMode = "Faces"; static constexpr const char* EdgesMode = "Edges"; /** @name methods override feature */ //@{ /// recalculate the feature App::DocumentObjectExecReturn *execute() override; const char* getViewProviderName() const override; //@} private: void tryExecute(); TopoDS_Face getSupportFace() const; std::vector getProjectionShapes() const; std::vector createProjectedWire(const TopoDS_Shape& shape, const TopoDS_Face& supportFace, const gp_Dir& dir); TopoDS_Face createFaceFromWire(const std::vector& wires, const TopoDS_Face& supportFace) const; TopoDS_Face createFaceFromParametricWire(const std::vector& wires, const TopoDS_Face& supportFace) const; TopoDS_Shape createSolidIfHeight(const TopoDS_Face& face) const; std::vector createWiresFromWires(const std::vector& wires, const TopoDS_Face& supportFace) const; std::vector getWires(const TopoDS_Face& face) const; std::vector projectFace(const TopoDS_Face& face, const TopoDS_Face& supportFace, const gp_Dir& dir); std::vector projectWire(const TopoDS_Shape& wire, const TopoDS_Face& supportFace, const gp_Dir& dir); TopoDS_Wire fixWire(const TopoDS_Shape& shape, const TopoDS_Face& supportFace) const; TopoDS_Wire fixWire(const std::vector& edges, const TopoDS_Face& supportFace) const; std::vector filterShapes(const std::vector& shapes) const; TopoDS_Shape createCompound(const std::vector& shapes); TopLoc_Location getOffsetPlacement() const; }; } //namespace Part #endif // PART_FEATUREPROJECTONSURFACE_H