FreeCAD WebAssembly development snapshot
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Stale Issues / stale (push) Has been cancelled

This commit is contained in:
2026-08-20 07:00:53 +08:00
commit b5a086fda5
12718 changed files with 7841410 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/***************************************************************************
* Copyright (c) YEAR YOUR NAME <Your e-mail address> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include <Python.h>
#include <Base/Console.h>
#include <Base/Interpreter.h>
#include <Base/PyObjectBase.h>
#include <CXX/Extensions.hxx>
#include <CXX/Objects.hxx>
namespace _TEMPLATE_
{
class Module: public Py::ExtensionModule<Module>
{
public:
Module()
: Py::ExtensionModule<Module>("_TEMPLATE_")
{
initialize("This module is the _TEMPLATE_ module."); // register with Python
}
virtual ~Module()
{}
private:
};
PyObject* initModule()
{
return Base::Interpreter().addModule(new Module);
}
} // namespace _TEMPLATE_
/* Python entry */
PyMOD_INIT_FUNC(_TEMPLATE_)
{
// ADD YOUR CODE HERE
//
//
PyObject* mod = _TEMPLATE_::initModule();
Base::Console().log("Loading _TEMPLATE_ module... done\n");
PyMOD_Return(mod);
}

View File

@@ -0,0 +1,19 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
set(_TEMPLATE__LIBS
FreeCADApp
)
SET(_TEMPLATE__SRCS
App_TEMPLATE_.cpp
PreCompiled.h
)
add_library(_TEMPLATE_ SHARED ${_TEMPLATE__SRCS})
target_link_libraries(_TEMPLATE_ ${_TEMPLATE__LIBS})
SET_BIN_DIR(_TEMPLATE_ _TEMPLATE_ /Mod/_TEMPLATE_)
SET_PYTHON_PREFIX_SUFFIX(_TEMPLATE_)
install(TARGETS _TEMPLATE_ DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@@ -0,0 +1,55 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/***************************************************************************
* Copyright (c) YEAR YOUR NAME <Your e-mail address> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#pragma once
#include <FCConfig.h>
// Exporting of App classes
#ifdef FC_OS_WIN32
# define _TEMPLATE_AppExport __declspec(dllexport)
#else // for Linux
# define _TEMPLATE_AppExport
#endif
// standard
#include <cassert>
#include <cstdio>
#include <iostream>
// STL
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
// Xerces
#include <xercesc/util/XercesDefs.hpp>

View File

@@ -0,0 +1,31 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
add_subdirectory(App)
if(BUILD_GUI)
add_subdirectory(Gui)
endif(BUILD_GUI)
set(_TEMPLATE__Scripts
Init.py
)
if(BUILD_GUI)
list (APPEND _TEMPLATE__Scripts InitGui.py)
endif(BUILD_GUI)
add_custom_target(_TEMPLATE_Scripts ALL
SOURCES ${_TEMPLATE__Scripts}
)
fc_target_copy_resource_flat(_TEMPLATE_Scripts
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_BINARY_DIR}/Mod/_TEMPLATE_
${_TEMPLATE__Scripts}
)
install(
FILES
${_TEMPLATE__Scripts}
DESTINATION
Mod/_TEMPLATE_
)

View File

@@ -0,0 +1,86 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/***************************************************************************
* Copyright (c) YEAR YOUR NAME <Your e-mail address> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include <Python.h>
#include <Base/Console.h>
#include <Base/Interpreter.h>
#include <Base/PyObjectBase.h>
#include <Gui/Application.h>
#include "Workbench.h"
#include <CXX/Extensions.hxx>
#include <CXX/Objects.hxx>
// use a different name to CreateCommand()
void Create_TEMPLATE_Commands(void);
namespace _TEMPLATE_Gui
{
class Module: public Py::ExtensionModule<Module>
{
public:
Module()
: Py::ExtensionModule<Module>("_TEMPLATE_Gui")
{
initialize("This module is the _TEMPLATE_Gui module."); // register with Python
}
virtual ~Module()
{}
private:
};
PyObject* initModule()
{
return Base::Interpreter().addModule(new Module);
}
} // namespace _TEMPLATE_Gui
/* Python entry */
PyMOD_INIT_FUNC(_TEMPLATE_Gui)
{
if (!Gui::Application::Instance) {
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
PyMOD_Return(0);
}
// instantiating the commands
Create_TEMPLATE_Commands();
_TEMPLATE_Gui::Workbench::init();
// ADD YOUR CODE HERE
//
//
PyObject* mod = _TEMPLATE_Gui::initModule();
Base::Console().log("Loading GUI of _TEMPLATE_ module... done\n");
PyMOD_Return(mod);
}

View File

@@ -0,0 +1,30 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
include_directories(
${CMAKE_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}
)
set(_TEMPLATE_Gui_LIBS
_TEMPLATE_
FreeCADGui
)
qt_add_resources(_TEMPLATE__QRC_SRCS Resources/_TEMPLATE_.qrc)
SET(_TEMPLATE_Gui_SRCS
${_TEMPLATE__QRC_SRCS}
App_TEMPLATE_Gui.cpp
Command.cpp
PreCompiled.h
Workbench.cpp
Workbench.h
)
add_library(_TEMPLATE_Gui SHARED ${_TEMPLATE_Gui_SRCS})
target_link_libraries(_TEMPLATE_Gui ${_TEMPLATE_Gui_LIBS})
SET_BIN_DIR(_TEMPLATE_Gui _TEMPLATE_Gui /Mod/_TEMPLATE_)
SET_PYTHON_PREFIX_SUFFIX(_TEMPLATE_Gui)
install(TARGETS _TEMPLATE_Gui DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@@ -0,0 +1,60 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/***************************************************************************
* Copyright (c) YEAR YOUR NAME <Your e-mail address> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include <App/Document.h>
#include <Base/Console.h>
#include <Gui/Application.h>
#include <Gui/Command.h>
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//===========================================================================
// Cmd_TEMPLATE_Test THIS IS JUST A TEST COMMAND
//===========================================================================
DEF_STD_CMD(Cmd_TEMPLATE_Test)
Cmd_TEMPLATE_Test::Cmd_TEMPLATE_Test()
: Command("_TEMPLATE__Test")
{
sAppModule = "_TEMPLATE_";
sGroup = QT_TR_NOOP("_TEMPLATE_");
sMenuText = QT_TR_NOOP("Hello");
sToolTipText = QT_TR_NOOP("_TEMPLATE_ Test function");
sWhatsThis = "_TEMPLATE__Test";
sStatusTip = QT_TR_NOOP("_TEMPLATE_ Test function");
sPixmap = "_TEMPLATE_Workbench";
sAccel = "CTRL+H";
}
void Cmd_TEMPLATE_Test::activated(int)
{
Base::Console().message("Hello, World!\n");
}
void Create_TEMPLATE_Commands(void)
{
Gui::CommandManager& rcCmdMgr = Gui::Application::Instance->commandManager();
rcCmdMgr.addCommand(new Cmd_TEMPLATE_Test());
}

View File

@@ -0,0 +1,63 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/***************************************************************************
* Copyright (c) YEAR YOUR NAME <Your e-mail address> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#pragma once
#include <FCConfig.h>
// Importing of App classes
#ifdef FC_OS_WIN32
# define _TEMPLATE_AppExport __declspec(dllimport)
# define _TEMPLATE_GuiExport __declspec(dllexport)
#else // for Linux
# define _TEMPLATE_AppExport
# define _TEMPLATE_GuiExport
#endif
// standard
#include <cassert>
#include <cstdio>
// STL
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
// Xerces
#include <xercesc/util/XercesDefs.hpp>
#ifdef FC_OS_WIN32
# include <windows.h>
#endif
// Qt Toolkit
#include <Gui/QtAll.h>

View File

@@ -0,0 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>icons/_TEMPLATE_Workbench.svg</file>
</qresource>
</RCC>

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="64"
height="64"
id="svg3140"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs3142" />
<metadata
id="metadata3145">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1">
<g
id="layer1-4"
transform="translate(-6e-6,-0.36363683)">
<g
transform="matrix(0.8506406,0,0,0.8506406,187.82699,-0.1960013)"
id="g3813-3">
<g
id="g2"
transform="matrix(2.7626237,0,0,2.7626237,-216.92708,5.3602404)">
<path
d="m 22,3.9997423 -3.999742,4.0002581 h -8 V 10.999806 H 14 v 4.000259 h -3.999742 v 4.999678 L 5.9999997,24 h 4.0503843 c 0.30326,-1e-6 0.571883,-0.195269 0.66559,-0.48369 l 0.723985,-2.22828 c 0.06925,-0.213087 0.236489,-0.379833 0.449583,-0.449065 l 0.556553,-0.180868 c 0.213108,-0.06926 0.446577,-0.03248 0.627866,0.09922 l 1.894968,1.377173 c 0.245331,0.178232 0.57787,0.178229 0.823203,0 l 1.698598,-1.234547 c 0.245363,-0.178242 0.347963,-0.493948 0.254247,-0.782378 l -0.723984,-2.22828 c -0.06926,-0.213109 -0.03197,-0.446575 0.09974,-0.627866 l 0.344164,-0.473355 c 0.131697,-0.181276 0.34179,-0.288856 0.565855,-0.28887 l 2.343001,5.1e-4 c 0.303278,10e-6 0.571885,-0.19577 0.66559,-0.484207 l 0.649054,-1.996771 c 0.0937,-0.288413 -0.0089,-0.60465 -0.254247,-0.782895 L 19.538664,11.858666 C 19.357381,11.726957 19.250306,11.516889 19.250311,11.292812 V 10.70732 c 1.9e-5,-0.224072 0.107062,-0.434681 0.288353,-0.566372 L 21.711646,8.5622376 C 21.892924,8.4305313 21.999999,8.219938 22,7.9958659 Z"
style="fill:#418fde;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.64567;stroke-linecap:square"
id="path8" />
<path
id="path7"
style="display:inline;fill:#ff585d;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.64567;stroke-linecap:square"
d="m 18,0 -4,4 h 4 V 8 L 22,4 V 0 Z M 6,16 2,20 v 4 h 4 l 4,-4 H 6 Z" />
<path
d="M 6,0 2,4 V 20 L 6,16 V 4 h 8 l 4,-4 z"
style="fill:#cb333b;fill-rule:evenodd;stroke-width:2.64567;stroke-linecap:square"
id="path3" />
<path
d="M 5.9999997,19.999743 H 10.000258 V 15.000065 H 14 V 10.999806 H 10.000258 V 8.0000004 h 8 V 3.9997423 H 5.9999997 Z"
style="fill:#fefefe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.64567;stroke-linecap:square"
id="path9" />
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -0,0 +1,58 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/***************************************************************************
* Copyright (c) YEAR YOUR NAME <Your e-mail address> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "Workbench.h"
#include <Gui/MenuManager.h>
#include <Gui/ToolBarManager.h>
using namespace _TEMPLATE_Gui;
/// @namespace _TEMPLATE_Gui @class Workbench
TYPESYSTEM_SOURCE(_TEMPLATE_Gui::Workbench, Gui::StdWorkbench)
Workbench::Workbench()
{}
Workbench::~Workbench()
{}
Gui::MenuItem* Workbench::setupMenuBar() const
{
Gui::MenuItem* root = StdWorkbench::setupMenuBar();
Gui::MenuItem* item = root->findItem("&Windows");
Gui::MenuItem* test = new Gui::MenuItem;
root->insertItem(item, test);
test->setCommand("_TEMPLATE_");
*test << "_TEMPLATE__Test";
return root;
}
Gui::ToolBarItem* Workbench::setupToolBars() const
{
Gui::ToolBarItem* root = StdWorkbench::setupToolBars();
Gui::ToolBarItem* test = new Gui::ToolBarItem(root);
test->setCommand("_TEMPLATE_ Tools");
*test << "_TEMPLATE__Test";
return root;
}

View File

@@ -0,0 +1,46 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/***************************************************************************
* Copyright (c) YEAR YOUR NAME <Your e-mail address> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#pragma once
#include <Gui/Workbench.h>
namespace _TEMPLATE_Gui
{
class Workbench: public Gui::StdWorkbench
{
TYPESYSTEM_HEADER();
public:
Workbench();
virtual ~Workbench();
protected:
Gui::MenuItem* setupMenuBar() const;
Gui::ToolBarItem* setupToolBars() const;
};
} // namespace _TEMPLATE_Gui

View File

@@ -0,0 +1,4 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
# FreeCAD init script of the _TEMPLATE_ module
# (c) 2001 Juergen Riegel LGPL

View File

@@ -0,0 +1,21 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
# _TEMPLATE_ gui init module
# (c) 2001 Juergen Riegel LGPL
class _TEMPLATE_Workbench(Workbench):
"_TEMPLATE_ workbench object"
MenuText = "_TEMPLATE_"
ToolTip = "_TEMPLATE_ workbench"
def Initialize(self):
# load the module
import _TEMPLATE_Gui
def GetClassName(self):
return "_TEMPLATE_Gui::Workbench"
Gui.addWorkbench(_TEMPLATE_Workbench())

View File

@@ -0,0 +1,2 @@
/** \defgroup TEMPLATE _TEMPLATE_
* \ingroup WORKBENCHES */

View File

@@ -0,0 +1,46 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/***************************************************************************
* Copyright (c) 2022 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include <FCGlobal.h>
#pragma once
// _TEMPLATE_
#ifndef _TEMPLATE_Export
# ifdef _TEMPLATE__EXPORTS
# define _TEMPLATE_Export FREECAD_DECL_EXPORT
# else
# define _TEMPLATE_Export FREECAD_DECL_IMPORT
# endif
#endif
// _TEMPLATE_Gui
#ifndef _TEMPLATE_GuiExport
# ifdef _TEMPLATE_Gui_EXPORTS
# define _TEMPLATE_GuiExport FREECAD_DECL_EXPORT
# else
# define _TEMPLATE_GuiExport FREECAD_DECL_IMPORT
# endif
#endif