Assembly: Introduce 'Exploded Views'

This commit is contained in:
PaddleStroke
2024-03-08 09:58:12 +01:00
committed by Yorik van Havre
parent 6a834422e7
commit 687843ff41
18 changed files with 2402 additions and 1 deletions

View File

@@ -29,6 +29,7 @@
#include "AssemblyObject.h"
#include "JointGroup.h"
#include "ViewGroup.h"
namespace Assembly
@@ -58,6 +59,7 @@ PyMOD_INIT_FUNC(AssemblyApp)
Assembly::AssemblyObject ::init();
Assembly::JointGroup ::init();
Assembly::ViewGroup ::init();
PyMOD_Return(mod);
}

View File

@@ -19,12 +19,15 @@ set(Assembly_LIBS
generate_from_xml(AssemblyObjectPy)
generate_from_xml(JointGroupPy)
generate_from_xml(ViewGroupPy)
SET(Python_SRCS
AssemblyObjectPy.xml
AssemblyObjectPyImp.cpp
JointGroupPy.xml
JointGroupPyImp.cpp
ViewGroupPy.xml
ViewGroupPyImp.cpp
)
SOURCE_GROUP("Python" FILES ${Python_SRCS})
@@ -41,6 +44,8 @@ SET(Assembly_SRCS
AssemblyObject.h
JointGroup.cpp
JointGroup.h
ViewGroup.cpp
ViewGroup.h
${Module_SRCS}
${Python_SRCS}
)

View File

@@ -0,0 +1,55 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/****************************************************************************
* *
* Copyright (c) 2023 Ondsel <development@ondsel.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/>. *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#endif
#include <App/Application.h>
#include <App/Document.h>
#include <App/FeaturePythonPyImp.h>
#include <App/PropertyPythonObject.h>
#include <Base/Console.h>
#include <Base/Tools.h>
#include "ViewGroup.h"
#include "ViewGroupPy.h"
using namespace Assembly;
PROPERTY_SOURCE(Assembly::ViewGroup, App::DocumentObjectGroup)
ViewGroup::ViewGroup()
{}
ViewGroup::~ViewGroup() = default;
PyObject* ViewGroup::getPyObject()
{
if (PythonObject.is(Py::_None())) {
// ref counter is set to 1
PythonObject = Py::Object(new ViewGroupPy(this), true);
}
return Py::new_reference_to(PythonObject);
}

View File

@@ -0,0 +1,58 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/****************************************************************************
* *
* Copyright (c) 2023 Ondsel <development@ondsel.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/>. *
* *
***************************************************************************/
#ifndef ASSEMBLY_ViewGroup_H
#define ASSEMBLY_ViewGroup_H
#include <Mod/Assembly/AssemblyGlobal.h>
#include <App/DocumentObjectGroup.h>
#include <App/PropertyLinks.h>
namespace Assembly
{
class AssemblyExport ViewGroup: public App::DocumentObjectGroup
{
PROPERTY_HEADER_WITH_OVERRIDE(Assembly::ViewGroup);
public:
ViewGroup();
~ViewGroup() override;
PyObject* getPyObject() override;
/// returns the type name of the ViewProvider
const char* getViewProviderName() const override
{
return "AssemblyGui::ViewProviderViewGroup";
}
};
} // namespace Assembly
#endif // ASSEMBLY_ViewGroup_H

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="DocumentObjectGroupPy"
Name="ViewGroupPy"
Twin="ViewGroup"
TwinPointer="ViewGroup"
Include="Mod/Assembly/App/ViewGroup.h"
Namespace="Assembly"
FatherInclude="App/DocumentObjectGroupPy.h"
FatherNamespace="App">
<Documentation>
<Author Licence="LGPL" Name="Ondsel" EMail="development@ondsel.com" />
<UserDocu>This class is a group subclass for joints.</UserDocu>
</Documentation>
<CustomAttributes />
</PythonExport>
</GenerateModel>

View File

@@ -0,0 +1,46 @@
/***************************************************************************
* Copyright (c) 2014 Jürgen Riegel <juergen.riegel@web.de> *
* *
* 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 "PreCompiled.h"
// inclusion of the generated files (generated out of ViewGroup.xml)
#include "ViewGroupPy.h"
#include "ViewGroupPy.cpp"
using namespace Assembly;
// returns a string which represents the object e.g. when printed in python
std::string ViewGroupPy::representation() const
{
return {"<Exploded View Group>"};
}
PyObject* ViewGroupPy::getCustomAttributes(const char* /*attr*/) const
{
return nullptr;
}
int ViewGroupPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}