Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Path: added support to get Path.Area from Path::FeatureArea
- Loading branch information
1 parent
9afefdc
commit 1913f6c
Showing
7 changed files
with
167 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd"> | ||
<PythonExport | ||
Father="DocumentObjectPy" | ||
Name="FeatureAreaPy" | ||
Twin="FeatureArea" | ||
TwinPointer="FeatureArea" | ||
Include="Mod/Path/App/FeatureArea.h" | ||
Namespace="Path" | ||
FatherInclude="App/DocumentObjectPy.h" | ||
FatherNamespace="App"> | ||
<Documentation> | ||
<Author Licence="LGPL" Name="Zheng, Lei" EMail="realthunder.dev@gmail.com" /> | ||
<UserDocu>This class handles Path Area features</UserDocu> | ||
</Documentation> | ||
<Methode Name="getArea"> | ||
<Documentation> | ||
<UserDocu>Return a copy of the encapsulated Python Area object.</UserDocu> | ||
</Documentation> | ||
</Methode> | ||
<Methode Name="setParams" Keyword="true"> | ||
<Documentation> | ||
<UserDocu>setParams(key=value...): Convenient function to configure this feature.\n | ||
Same usage as Path.Area.setParams(). This function stores the parameters in the properties.</UserDocu> | ||
</Documentation> | ||
</Methode> | ||
<CustomAttributes /> | ||
</PythonExport> | ||
</GenerateModel> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/**************************************************************************** | ||
* Copyright (c) 2017 Zheng, Lei (realthunder) <realthunder.dev@gmail.com>* | ||
* * | ||
* 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" | ||
|
||
#include <CXX/Objects.hxx> | ||
#include "FeatureArea.h" | ||
|
||
// inclusion of the generated files (generated out of FeatureAreaPy.xml) | ||
#include "FeatureAreaPy.h" | ||
#include "FeatureAreaPy.cpp" | ||
|
||
#include "AreaPy.h" | ||
|
||
using namespace Path; | ||
|
||
|
||
// returns a string which represent the object e.g. when printed in python | ||
std::string FeatureAreaPy::representation(void) const | ||
{ | ||
return std::string("<Path::FeatureArea>"); | ||
} | ||
|
||
|
||
PyObject* FeatureAreaPy::getArea(PyObject *args) | ||
{ | ||
if (!PyArg_ParseTuple(args, "")) | ||
return NULL; | ||
|
||
return new AreaPy(new Area(getFeatureAreaPtr()->myArea)); | ||
} | ||
|
||
PyObject* FeatureAreaPy::setParams(PyObject *args, PyObject *keywds) | ||
{ | ||
static char *kwlist[] = {PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_CONF),NULL}; | ||
|
||
//Declare variables defined in the NAME field of the CONF parameter list | ||
PARAM_PY_DECLARE(PARAM_FNAME,AREA_PARAMS_CONF); | ||
|
||
FeatureArea *feature = getFeatureAreaPtr(); | ||
|
||
#define AREA_SET(_param) \ | ||
PARAM_FNAME(_param) = \ | ||
PARAM_TYPED(PARAM_PY_CAST_,_param)(feature->PARAM_FNAME(_param).getValue()); | ||
//populate the CONF variables with values in properties | ||
PARAM_FOREACH(AREA_SET,AREA_PARAMS_CONF) | ||
|
||
//Parse arguments to overwrite CONF variables | ||
if (!PyArg_ParseTupleAndKeywords(args, keywds, | ||
"|" PARAM_PY_KWDS(AREA_PARAMS_CONF), kwlist, | ||
PARAM_REF(PARAM_FNAME,AREA_PARAMS_CONF))) | ||
Py_Error(Base::BaseExceptionFreeCADError, | ||
"Wrong parameters, call getParamsDesc() to get supported params"); | ||
|
||
#define AREA_GET(_param) \ | ||
feature->PARAM_FNAME(_param).setValue(\ | ||
PARAM_TYPED(PARAM_CAST_PY_,_param)(PARAM_FNAME(_param))); | ||
//populate properties with the CONF variables | ||
PARAM_FOREACH(AREA_GET,AREA_PARAMS_CONF) | ||
|
||
return Py_None; | ||
} | ||
|
||
PyObject *FeatureAreaPy::getCustomAttributes(const char* /*attr*/) const | ||
{ | ||
return 0; | ||
} | ||
|
||
|
||
int FeatureAreaPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) | ||
{ | ||
return 0; | ||
} | ||
|