// SPDX-License-Identifier: LGPL-2.1-or-later /**************************************************************************** * * * Copyright (c) 2025 Kindred Systems * * * * 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 KCSOLVE_PYIKCSOLVER_H #define KCSOLVE_PYIKCSOLVER_H #include #include #include namespace KCSolve { /// pybind11 trampoline class for IKCSolver. /// Enables Python subclasses that override virtual methods. class PyIKCSolver : public IKCSolver { public: using IKCSolver::IKCSolver; // ── Pure virtuals ────────────────────────────────────────────── std::string name() const override { PYBIND11_OVERRIDE_PURE(std::string, IKCSolver, name); } std::vector supported_joints() const override { PYBIND11_OVERRIDE_PURE(std::vector, IKCSolver, supported_joints); } SolveResult solve(const SolveContext& ctx) override { PYBIND11_OVERRIDE_PURE(SolveResult, IKCSolver, solve, ctx); } // ── Virtuals with defaults ───────────────────────────────────── SolveResult update(const SolveContext& ctx) override { PYBIND11_OVERRIDE(SolveResult, IKCSolver, update, ctx); } SolveResult pre_drag(const SolveContext& ctx, const std::vector& drag_parts) override { PYBIND11_OVERRIDE(SolveResult, IKCSolver, pre_drag, ctx, drag_parts); } SolveResult drag_step( const std::vector& drag_placements) override { PYBIND11_OVERRIDE(SolveResult, IKCSolver, drag_step, drag_placements); } void post_drag() override { PYBIND11_OVERRIDE(void, IKCSolver, post_drag); } SolveResult run_kinematic(const SolveContext& ctx) override { PYBIND11_OVERRIDE(SolveResult, IKCSolver, run_kinematic, ctx); } std::size_t num_frames() const override { PYBIND11_OVERRIDE(std::size_t, IKCSolver, num_frames); } SolveResult update_for_frame(std::size_t index) override { PYBIND11_OVERRIDE(SolveResult, IKCSolver, update_for_frame, index); } std::vector diagnose(const SolveContext& ctx) override { PYBIND11_OVERRIDE(std::vector, IKCSolver, diagnose, ctx); } bool is_deterministic() const override { PYBIND11_OVERRIDE(bool, IKCSolver, is_deterministic); } void export_native(const std::string& path) override { PYBIND11_OVERRIDE(void, IKCSolver, export_native, path); } bool supports_bundle_fixed() const override { PYBIND11_OVERRIDE(bool, IKCSolver, supports_bundle_fixed); } }; } // namespace KCSolve #endif // KCSOLVE_PYIKCSOLVER_H