Part: Python Bounded Curve (bring in accordance with c++)

Inheritance correspondence:

Geometry
- GeomPoint
- GeomCurve (GeometryCurvePy)
- - GeomBoundedCurve (BoundedCurvePy)
- - - GeomBezierCurve (BezierCurvePy)
- - - GeomBSplineCurve (BSplineCurvePy)
- - - GeomTrimmedCurve (ArcPy)
- - - - GeomArcOfConic (ArcOfConicPy)
- - - - - GeomArcOfCircle (ArcOfCirclePy)
- - - - - GeomArcOfEllipse (ArcOfEllipsePy)
- - - - - GeomArcOfHyperbola (ArcOfHyperbolaPy)
- - - - - GeomArcOfParabola (ArcOfParabolaPy)
- - - - GeomLineSegment (LineSegmentPy)
- - GeomConic
- - - GeomCircle
- - - GeomEllipse
- - - GeomHyperbola
- - - GeomParabola
- - GeomLine
- - GeomOffsetCurve
This commit is contained in:
Abdullah Tahiri
2019-01-26 19:56:12 +01:00
committed by wmayer
parent eafbf5364b
commit 52cfac509a
9 changed files with 148 additions and 31 deletions

View File

@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="GeometryCurvePy"
<PythonExport
Father="ArcPy"
Name="ArcOfConicPy"
PythonName="Part.ArcOfConic"
Twin="GeomArcOfConic"
TwinPointer="GeomArcOfConic"
Include="Mod/Part/App/Geometry.h"
Namespace="Part"
FatherInclude="Mod/Part/App/GeometryCurvePy.h"
Include="Mod/Part/App/Geometry.h"
Namespace="Part"
FatherInclude="Mod/Part/App/ArcPy.h"
FatherNamespace="Part"
Constructor="true">
<Documentation>

View File

@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="GeometryCurvePy"
Name="ArcPy"
<PythonExport
Father="BoundedCurvePy"
Name="ArcPy"
PythonName="Part.Arc"
Twin="GeomTrimmedCurve"
TwinPointer="GeomTrimmedCurve"
Include="Mod/Part/App/Geometry.h"
Namespace="Part"
FatherInclude="Mod/Part/App/GeometryCurvePy.h"
Twin="GeomTrimmedCurve"
TwinPointer="GeomTrimmedCurve"
Include="Mod/Part/App/Geometry.h"
Namespace="Part"
FatherInclude="Mod/Part/App/BoundedCurvePy.h"
FatherNamespace="Part"
Constructor="true">
<Documentation>

View File

@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="GeometryCurvePy"
Father="BoundedCurvePy"
Name="BSplineCurvePy"
PythonName="Part.BSplineCurve"
PythonName="Part.BSplineCurve"
Twin="GeomBSplineCurve"
TwinPointer="GeomBSplineCurve"
Include="Mod/Part/App/Geometry.h"
Namespace="Part"
FatherInclude="Mod/Part/App/GeometryCurvePy.h"
FatherInclude="Mod/Part/App/BoundedCurvePy.h"
FatherNamespace="Part"
Constructor="true">
<Documentation>

View File

@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="GeometryCurvePy"
Father="BoundedCurvePy"
Name="BezierCurvePy"
PythonName="Part.BezierCurve"
PythonName="Part.BezierCurve"
Twin="GeomBezierCurve"
TwinPointer="GeomBezierCurve"
Include="Mod/Part/App/Geometry.h"
Namespace="Part"
FatherInclude="Mod/Part/App/GeometryCurvePy.h"
FatherInclude="Mod/Part/App/BoundedCurvePy.h"
FatherNamespace="Part"
Constructor="true">
<Documentation>

View File

@@ -47,7 +47,7 @@ std::string BezierCurvePy::representation(void) const
PyObject *BezierCurvePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// create a new instance of BezierCurvePy and the Twin object
// create a new instance of BezierCurvePy and the Twin object
return new BezierCurvePy(new GeomBezierCurve);
}
@@ -347,21 +347,21 @@ Py::Long BezierCurvePy::getDegree(void) const
{
Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast
(getGeometryPtr()->handle());
return Py::Long(curve->Degree());
return Py::Long(curve->Degree());
}
Py::Long BezierCurvePy::getMaxDegree(void) const
{
Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast
(getGeometryPtr()->handle());
return Py::Long(curve->MaxDegree());
return Py::Long(curve->MaxDegree());
}
Py::Long BezierCurvePy::getNbPoles(void) const
{
Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast
(getGeometryPtr()->handle());
return Py::Long(curve->NbPoles());
return Py::Long(curve->NbPoles());
}
Py::Object BezierCurvePy::getStartPoint(void) const
@@ -387,5 +387,5 @@ PyObject *BezierCurvePy::getCustomAttributes(const char* /*attr*/) const
int BezierCurvePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
return 0;
}

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="GeometryCurvePy"
Name="BoundedCurvePy"
PythonName="Part.BoundedCurve"
Twin="GeomBoundedCurve"
TwinPointer="GeomBoundedCurve"
Include="Mod/Part/App/Geometry.h"
Namespace="Part"
FatherInclude="Mod/Part/App/GeometryCurvePy.h"
FatherNamespace="Part"
Constructor="true">
<Documentation>
<Author Licence="LGPL" Name="Abdullah Tahiri" EMail="abdullah.tahiri.yo@gmail.com" />
<UserDocu>
The abstract class BoundedCurve is the root class of all bounded curve objects.
</UserDocu>
</Documentation>
<Attribute Name="StartPoint" ReadOnly="true">
<Documentation>
<UserDocu>
Returns the starting point of the bounded curve.
</UserDocu>
</Documentation>
<Parameter Name="StartPoint" Type="Object"/>
</Attribute>
<Attribute Name="EndPoint" ReadOnly="true">
<Documentation>
<UserDocu>
Returns the end point of the bounded curve.
</UserDocu>
</Documentation>
<Parameter Name="EndPoint" Type="Object"/>
</Attribute>
</PythonExport>
</GenerateModel>

View File

@@ -0,0 +1,77 @@
/***************************************************************************
* Copyright (c) 2009 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 "PreCompiled.h"
#ifndef _PreComp_
# include <sstream>
#endif
#include <Base/GeometryPyCXX.h>
#include <Base/VectorPy.h>
#include "Geometry.h"
#include "BoundedCurvePy.h"
#include "BoundedCurvePy.cpp"
using namespace Part;
// returns a string which represents the object e.g. when printed in python
std::string BoundedCurvePy::representation(void) const
{
return "<Curve object>";
}
PyObject *BoundedCurvePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// never create such objects with the constructor
PyErr_SetString(PyExc_RuntimeError,
"You cannot create an instance of the abstract class 'BoundedCurve'.");
return 0;
}
// constructor method
int BoundedCurvePy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
{
return 0;
}
Py::Object BoundedCurvePy::getStartPoint(void) const
{
return Py::Vector(getGeomBoundedCurvePtr()->getStartPoint());
}
Py::Object BoundedCurvePy::getEndPoint(void) const
{
return Py::Vector(getGeomBoundedCurvePtr()->getEndPoint());
}
PyObject *BoundedCurvePy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
}
int BoundedCurvePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}

View File

@@ -52,6 +52,7 @@ generate_from_xml(ParabolaPy)
generate_from_xml(OffsetCurvePy)
generate_from_xml(GeometryPy)
generate_from_xml(GeometryCurvePy)
generate_from_xml(BoundedCurvePy)
generate_from_xml(GeometrySurfacePy)
generate_from_xml(LinePy)
generate_from_xml(LineSegmentPy)
@@ -211,6 +212,8 @@ SET(Python_SRCS
GeometryPyImp.cpp
GeometryCurvePy.xml
GeometryCurvePyImp.cpp
BoundedCurvePy.xml
BoundedCurvePyImp.cpp
GeometrySurfacePy.xml
GeometrySurfacePyImp.cpp
LinePy.xml

View File

@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="GeometryCurvePy"
<PythonExport
Father="ArcPy"
Name="LineSegmentPy"
PythonName="Part.LineSegment"
Twin="GeomLineSegment"
TwinPointer="GeomLineSegment"
Include="Mod/Part/App/Geometry.h"
Namespace="Part"
FatherInclude="Mod/Part/App/GeometryCurvePy.h"
Twin="GeomLineSegment"
TwinPointer="GeomLineSegment"
Include="Mod/Part/App/Geometry.h"
Namespace="Part"
FatherInclude="Mod/Part/App/ArcPy.h"
FatherNamespace="Part"
Constructor="true">
<Documentation>