Skip to content

Commit

Permalink
fg
Browse files Browse the repository at this point in the history
  • Loading branch information
PaddleStroke committed Mar 5, 2024
1 parent 5c02ea2 commit f89c866
Show file tree
Hide file tree
Showing 30 changed files with 3,023 additions and 17 deletions.
4 changes: 4 additions & 0 deletions src/Mod/Assembly/App/AppAssembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
#include <Base/PyObjectBase.h>

#include "AssemblyObject.h"
#include "ExplodedView.h"
#include "JointGroup.h"
#include "ViewGroup.h"


namespace Assembly
Expand Down Expand Up @@ -57,7 +59,9 @@ PyMOD_INIT_FUNC(AssemblyApp)
// This function is responsible for adding inherited slots from a type's base class.

Assembly::AssemblyObject ::init();
Assembly::ExplodedView ::init();
Assembly::JointGroup ::init();
Assembly::ViewGroup ::init();

PyMOD_Return(mod);
}
10 changes: 10 additions & 0 deletions src/Mod/Assembly/App/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@ set(Assembly_LIBS
)

generate_from_xml(AssemblyObjectPy)
generate_from_xml(ExplodedViewPy)
generate_from_xml(JointGroupPy)
generate_from_xml(ViewGroupPy)

SET(Python_SRCS
AssemblyObjectPy.xml
AssemblyObjectPyImp.cpp
ExplodedViewPy.xml
ExplodedViewPyImp.cpp
JointGroupPy.xml
JointGroupPyImp.cpp
ViewGroupPy.xml
ViewGroupPyImp.cpp
)
SOURCE_GROUP("Python" FILES ${Python_SRCS})

Expand All @@ -39,8 +45,12 @@ SOURCE_GROUP("Module" FILES ${Module_SRCS})
SET(Assembly_SRCS
AssemblyObject.cpp
AssemblyObject.h
ExplodedView.cpp
ExplodedView.h
JointGroup.cpp
JointGroup.h
ViewGroup.cpp
ViewGroup.h
${Module_SRCS}
${Python_SRCS}
)
Expand Down
55 changes: 55 additions & 0 deletions src/Mod/Assembly/App/ExplodedView.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/****************************************************************************
* *
* Copyright (c) 2023 Ondsel <[email protected]> *
* *
* 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 "ExplodedView.h"
#include "ExplodedViewPy.h"

using namespace Assembly;


PROPERTY_SOURCE(Assembly::ExplodedView, App::DocumentObjectGroup)

ExplodedView::ExplodedView()
{}

ExplodedView::~ExplodedView() = default;

PyObject* ExplodedView::getPyObject()
{
if (PythonObject.is(Py::_None())) {
// ref counter is set to 1
PythonObject = Py::Object(new ExplodedViewPy(this), true);
}
return Py::new_reference_to(PythonObject);
}
58 changes: 58 additions & 0 deletions src/Mod/Assembly/App/ExplodedView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/****************************************************************************
* *
* Copyright (c) 2023 Ondsel <[email protected]> *
* *
* 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_ExplodedView_H
#define ASSEMBLY_ExplodedView_H

#include <Mod/Assembly/AssemblyGlobal.h>

#include <App/DocumentObjectGroup.h>
#include <App/PropertyLinks.h>


namespace Assembly
{

class AssemblyExport ExplodedView: public App::DocumentObjectGroup
{
PROPERTY_HEADER_WITH_OVERRIDE(Assembly::ExplodedView);

public:
ExplodedView();
~ExplodedView() override;

PyObject* getPyObject() override;

/// returns the type name of the ViewProvider
const char* getViewProviderName() const override
{
return "AssemblyGui::ViewProviderExplodedView";
}
};


} // namespace Assembly


#endif // ASSEMBLY_ExplodedView_H
19 changes: 19 additions & 0 deletions src/Mod/Assembly/App/ExplodedViewPy.xml
Original file line number Diff line number Diff line change
@@ -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="ExplodedViewPy"
Twin="ExplodedView"
TwinPointer="ExplodedView"
Include="Mod/Assembly/App/ExplodedView.h"
Namespace="Assembly"
FatherInclude="App/DocumentObjectGroupPy.h"
FatherNamespace="App">
<Documentation>
<Author Licence="LGPL" Name="Ondsel" EMail="[email protected]" />
<UserDocu>This class is a group subclass for joints.</UserDocu>
</Documentation>

<CustomAttributes />
</PythonExport>
</GenerateModel>
46 changes: 46 additions & 0 deletions src/Mod/Assembly/App/ExplodedViewPyImp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/***************************************************************************
* Copyright (c) 2014 Jürgen Riegel <[email protected]> *
* *
* 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 ExplodedView.xml)
#include "ExplodedViewPy.h"
#include "ExplodedViewPy.cpp"

using namespace Assembly;

// returns a string which represents the object e.g. when printed in python
std::string ExplodedViewPy::representation() const
{
return {"<Exploded View>"};
}

PyObject* ExplodedViewPy::getCustomAttributes(const char* /*attr*/) const
{
return nullptr;
}

int ExplodedViewPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}
55 changes: 55 additions & 0 deletions src/Mod/Assembly/App/ViewGroup.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/****************************************************************************
* *
* Copyright (c) 2023 Ondsel <[email protected]> *
* *
* 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);
}
58 changes: 58 additions & 0 deletions src/Mod/Assembly/App/ViewGroup.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/****************************************************************************
* *
* Copyright (c) 2023 Ondsel <[email protected]> *
* *
* 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
19 changes: 19 additions & 0 deletions src/Mod/Assembly/App/ViewGroupPy.xml
Original file line number Diff line number Diff line change
@@ -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="[email protected]" />
<UserDocu>This class is a group subclass for joints.</UserDocu>
</Documentation>

<CustomAttributes />
</PythonExport>
</GenerateModel>
Loading

0 comments on commit f89c866

Please sign in to comment.