py3: ported Part to python3
This commit is contained in:
parent
e594ade52e
commit
ed23c0d3c4
|
@ -219,7 +219,7 @@ PyTypeObject LinePyOld::Type = {
|
|||
}
|
||||
// --->
|
||||
|
||||
PyMODINIT_FUNC initPart()
|
||||
PyMOD_INIT_FUNC(Part)
|
||||
{
|
||||
Base::Console().Log("Module: Part\n");
|
||||
|
||||
|
@ -337,10 +337,14 @@ PyMODINIT_FUNC initPart()
|
|||
::Type,partModule,"RectangularTrimmedSurface");
|
||||
|
||||
Base::Interpreter().addType(&Part::PartFeaturePy ::Type,partModule,"Feature");
|
||||
|
||||
Base::Interpreter().addType(&Attacher::AttachEnginePy ::Type,partModule,"AttachEngine");
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
static struct PyModuleDef BRepOffsetAPIDef = {PyModuleDef_HEAD_INIT,"BRepOffsetAPI", "BRepOffsetAPI", -1, 0};
|
||||
PyObject* brepModule = PyModule_Create(&BRepOffsetAPIDef);
|
||||
#else
|
||||
PyObject* brepModule = Py_InitModule3("BRepOffsetAPI", 0, "BrepOffsetAPI");
|
||||
#endif
|
||||
Py_INCREF(brepModule);
|
||||
PyModule_AddObject(partModule, "BRepOffsetAPI", brepModule);
|
||||
Base::Interpreter().addType(&Part::BRepOffsetAPI_MakePipeShellPy::Type,brepModule,"MakePipeShell");
|
||||
|
@ -588,4 +592,6 @@ PyMODINIT_FUNC initPart()
|
|||
Interface_Static::SetCVal("write.step.schema", ap.c_str());
|
||||
Interface_Static::SetCVal("write.step.product.name", hStepGrp->GetASCII("Product",
|
||||
Interface_Static::CVal("write.step.product.name")).c_str());
|
||||
|
||||
PyMOD_Return(partModule);
|
||||
}
|
||||
|
|
|
@ -1569,8 +1569,14 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
//FIXME: Test this!
|
||||
if (PyBytes_Check(intext)) {
|
||||
PyObject *p = Base::PyAsUnicodeObject(PyBytes_AsString(intext));
|
||||
#else
|
||||
if (PyString_Check(intext)) {
|
||||
PyObject *p = Base::PyAsUnicodeObject(PyString_AsString(intext));
|
||||
PyObject *p = Base::PyAsUnicodeObject(PyString_AsString(intext));
|
||||
#endif
|
||||
if (!p) {
|
||||
throw Py::TypeError("** makeWireString can't convert PyString.");
|
||||
}
|
||||
|
@ -1645,8 +1651,13 @@ private:
|
|||
PyErr_Clear();
|
||||
PyObject* index_or_value;
|
||||
if (PyArg_ParseTuple(args.ptr(), "sO", &name, &index_or_value)) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
if (PyLong_Check(index_or_value)) {
|
||||
int ival = (int)PyLong_AsLong(index_or_value);
|
||||
#else
|
||||
if (PyInt_Check(index_or_value)) {
|
||||
int ival = (int)PyInt_AsLong(index_or_value);
|
||||
#endif
|
||||
if (!Interface_Static::SetIVal(name, ival)) {
|
||||
std::stringstream str;
|
||||
str << "Failed to set '" << name << "'";
|
||||
|
|
|
@ -117,7 +117,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args)
|
|||
PyObject *spine, *curv, *keep;
|
||||
if (!PyArg_ParseTuple(args, "O!O!O!",&Part::TopoShapePy::Type,&spine
|
||||
,&PyBool_Type,&curv
|
||||
,&PyInt_Type,&keep))
|
||||
,&PyLong_Type,&keep))
|
||||
return 0;
|
||||
const TopoDS_Shape& s = static_cast<Part::TopoShapePy*>(spine)->getTopoShapePtr()->getShape();
|
||||
if (s.IsNull() || s.ShapeType() != TopAbs_WIRE) {
|
||||
|
@ -199,7 +199,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::getStatus(PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
Standard_Integer val = this->getBRepOffsetAPI_MakePipeShellPtr()->GetStatus();
|
||||
return Py::new_reference_to(Py::Int(val));
|
||||
return Py::new_reference_to(Py::Long(val));
|
||||
}
|
||||
|
||||
PyObject* BRepOffsetAPI_MakePipeShellPy::makeSolid(PyObject *args)
|
||||
|
|
|
@ -19,21 +19,21 @@
|
|||
<Documentation>
|
||||
<UserDocu>Returns the polynomial degree of this B-Spline curve.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Degree" Type="Int"/>
|
||||
<Parameter Name="Degree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="MaxDegree" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the value of the maximum polynomial degree of any
|
||||
B-Spline curve curve. This value is 25.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="MaxDegree" Type="Int"/>
|
||||
<Parameter Name="MaxDegree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="NbPoles" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the number of poles of this B-Spline curve.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="NbPoles" Type="Int"/>
|
||||
<Parameter Name="NbPoles" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="NbKnots" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
@ -41,7 +41,7 @@ B-Spline curve curve. This value is 25.</UserDocu>
|
|||
Returns the number of knots of this B-Spline curve.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="NbPoles" Type="Int"/>
|
||||
<Parameter Name="NbPoles" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="StartPoint" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
|
|
@ -225,7 +225,7 @@ PyObject* BSplineCurvePy::insertKnots(PyObject * args)
|
|||
TColStd_Array1OfInteger m(1,mults.size());
|
||||
index=1;
|
||||
for (Py::Sequence::iterator it = mults.begin(); it != mults.end(); ++it) {
|
||||
Py::Int val(*it);
|
||||
Py::Long val(*it);
|
||||
m(index++) = (int)val;
|
||||
}
|
||||
|
||||
|
@ -662,7 +662,7 @@ PyObject* BSplineCurvePy::getMultiplicities(PyObject * args)
|
|||
curve->Multiplicities(m);
|
||||
Py::List mults;
|
||||
for (Standard_Integer i=m.Lower(); i<=m.Upper(); i++) {
|
||||
mults.append(Py::Int(m(i)));
|
||||
mults.append(Py::Long(m(i)));
|
||||
}
|
||||
return Py::new_reference_to(mults);
|
||||
}
|
||||
|
@ -673,32 +673,32 @@ PyObject* BSplineCurvePy::getMultiplicities(PyObject * args)
|
|||
}
|
||||
}
|
||||
|
||||
Py::Int BSplineCurvePy::getDegree(void) const
|
||||
Py::Long BSplineCurvePy::getDegree(void) const
|
||||
{
|
||||
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(curve->Degree());
|
||||
return Py::Long(curve->Degree());
|
||||
}
|
||||
|
||||
Py::Int BSplineCurvePy::getMaxDegree(void) const
|
||||
Py::Long BSplineCurvePy::getMaxDegree(void) const
|
||||
{
|
||||
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(curve->MaxDegree());
|
||||
return Py::Long(curve->MaxDegree());
|
||||
}
|
||||
|
||||
Py::Int BSplineCurvePy::getNbPoles(void) const
|
||||
Py::Long BSplineCurvePy::getNbPoles(void) const
|
||||
{
|
||||
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(curve->NbPoles());
|
||||
return Py::Long(curve->NbPoles());
|
||||
}
|
||||
|
||||
Py::Int BSplineCurvePy::getNbKnots(void) const
|
||||
Py::Long BSplineCurvePy::getNbKnots(void) const
|
||||
{
|
||||
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(curve->NbKnots());
|
||||
return Py::Long(curve->NbKnots());
|
||||
}
|
||||
|
||||
Py::Object BSplineCurvePy::getStartPoint(void) const
|
||||
|
@ -721,14 +721,14 @@ Py::Object BSplineCurvePy::getFirstUKnotIndex(void) const
|
|||
{
|
||||
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(curve->FirstUKnotIndex());
|
||||
return Py::Long(curve->FirstUKnotIndex());
|
||||
}
|
||||
|
||||
Py::Object BSplineCurvePy::getLastUKnotIndex(void) const
|
||||
{
|
||||
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(curve->LastUKnotIndex());
|
||||
return Py::Long(curve->LastUKnotIndex());
|
||||
}
|
||||
|
||||
Py::List BSplineCurvePy::getKnotSequence(void) const
|
||||
|
@ -1211,11 +1211,11 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key
|
|||
Py::Sequence multssq(mults);
|
||||
Standard_Integer index = 1;
|
||||
for (Py::Sequence::iterator it = multssq.begin(); it != multssq.end() && index <= occmults.Length(); ++it) {
|
||||
Py::Int mult(*it);
|
||||
Py::Long mult(*it);
|
||||
if (index < occmults.Length() || PyObject_Not(periodic)) {
|
||||
sum_of_mults += mult; //sum up the mults to compare them against the number of poles later
|
||||
sum_of_mults += static_cast<int>(mult); //sum up the mults to compare them against the number of poles later
|
||||
}
|
||||
occmults(index++) = mult;
|
||||
occmults(index++) = static_cast<int>(mult);
|
||||
}
|
||||
}
|
||||
else { //mults are 1 or degree+1 at the ends
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
Returns the degree of this B-Spline surface in the u parametric direction.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="UDegree" Type="Int"/>
|
||||
<Parameter Name="UDegree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="VDegree" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
@ -29,7 +29,7 @@
|
|||
Returns the degree of this B-Spline surface in the v parametric direction.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="VDegree" Type="Int"/>
|
||||
<Parameter Name="VDegree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="MaxDegree" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
@ -39,7 +39,7 @@
|
|||
This value is 25.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="MaxDegree" Type="Int"/>
|
||||
<Parameter Name="MaxDegree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="NbUPoles" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
@ -47,7 +47,7 @@
|
|||
Returns the number of poles of this B-Spline surface in the u parametric direction.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="NbUPoles" Type="Int"/>
|
||||
<Parameter Name="NbUPoles" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="NbVPoles" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
@ -55,7 +55,7 @@
|
|||
Returns the number of poles of this B-Spline surface in the v parametric direction.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="NbVPoles" Type="Int"/>
|
||||
<Parameter Name="NbVPoles" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="NbUKnots" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
@ -63,7 +63,7 @@
|
|||
Returns the number of knots of this B-Spline surface in the u parametric direction.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="NbUKnots" Type="Int"/>
|
||||
<Parameter Name="NbUKnots" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="NbVKnots" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
@ -71,7 +71,7 @@
|
|||
Returns the number of knots of this B-Spline surface in the v parametric direction.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="NbVKnots" Type="Int"/>
|
||||
<Parameter Name="NbVKnots" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="FirstUKnotIndex" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
|
|
@ -286,7 +286,7 @@ PyObject* BSplineSurfacePy::insertUKnots(PyObject *args)
|
|||
TColStd_Array1OfInteger m(1,mults.size());
|
||||
index=1;
|
||||
for (Py::Sequence::iterator it = mults.begin(); it != mults.end(); ++it) {
|
||||
Py::Int val(*it);
|
||||
Py::Long val(*it);
|
||||
m(index++) = (int)val;
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ PyObject* BSplineSurfacePy::insertVKnots(PyObject *args)
|
|||
TColStd_Array1OfInteger m(1,mults.size());
|
||||
index=1;
|
||||
for (Py::Sequence::iterator it = mults.begin(); it != mults.end(); ++it) {
|
||||
Py::Int val(*it);
|
||||
Py::Long val(*it);
|
||||
m(index++) = (int)val;
|
||||
}
|
||||
|
||||
|
@ -1092,7 +1092,7 @@ PyObject* BSplineSurfacePy::getUMultiplicities(PyObject *args)
|
|||
surf->UMultiplicities(m);
|
||||
Py::List mults;
|
||||
for (Standard_Integer i=m.Lower(); i<=m.Upper(); i++) {
|
||||
mults.append(Py::Int(m(i)));
|
||||
mults.append(Py::Long(m(i)));
|
||||
}
|
||||
return Py::new_reference_to(mults);
|
||||
}
|
||||
|
@ -1114,7 +1114,7 @@ PyObject* BSplineSurfacePy::getVMultiplicities(PyObject *args)
|
|||
surf->VMultiplicities(m);
|
||||
Py::List mults;
|
||||
for (Standard_Integer i=m.Lower(); i<=m.Upper(); i++) {
|
||||
mults.append(Py::Int(m(i)));
|
||||
mults.append(Py::Long(m(i)));
|
||||
}
|
||||
return Py::new_reference_to(mults);
|
||||
}
|
||||
|
@ -1467,20 +1467,20 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k
|
|||
Py::Sequence umultssq(umults);
|
||||
Standard_Integer index = 1;
|
||||
for (Py::Sequence::iterator it = umultssq.begin(); it != umultssq.end() && index <= occumults.Length(); ++it) {
|
||||
Py::Int mult(*it);
|
||||
Py::Long mult(*it);
|
||||
if (index < occumults.Length() || PyObject_Not(uperiodic)) {
|
||||
sum_of_umults += mult; //sum up the mults to compare them against the number of poles later
|
||||
sum_of_umults += static_cast<int>(mult); //sum up the mults to compare them against the number of poles later
|
||||
}
|
||||
occumults(index++) = mult;
|
||||
occumults(index++) = static_cast<int>(mult);
|
||||
}
|
||||
Py::Sequence vmultssq(vmults);
|
||||
index = 1;
|
||||
for (Py::Sequence::iterator it = vmultssq.begin(); it != vmultssq.end() && index <= occvmults.Length(); ++it) {
|
||||
Py::Int mult(*it);
|
||||
Py::Long mult(*it);
|
||||
if (index < occvmults.Length() || PyObject_Not(vperiodic)) {
|
||||
sum_of_vmults += mult; //sum up the mults to compare them against the number of poles later
|
||||
sum_of_vmults += static_cast<int>(mult); //sum up the mults to compare them against the number of poles later
|
||||
}
|
||||
occvmults(index++) = mult;
|
||||
occvmults(index++) = static_cast<int>(mult);
|
||||
}
|
||||
//copy or generate knots
|
||||
if (uknots != Py_None) { //uknots are given
|
||||
|
@ -1537,55 +1537,55 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k
|
|||
}
|
||||
}
|
||||
|
||||
Py::Int BSplineSurfacePy::getUDegree(void) const
|
||||
Py::Long BSplineSurfacePy::getUDegree(void) const
|
||||
{
|
||||
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
int deg = surf->UDegree();
|
||||
return Py::Int(deg);
|
||||
return Py::Long(deg);
|
||||
}
|
||||
|
||||
Py::Int BSplineSurfacePy::getVDegree(void) const
|
||||
Py::Long BSplineSurfacePy::getVDegree(void) const
|
||||
{
|
||||
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
int deg = surf->VDegree();
|
||||
return Py::Int(deg);
|
||||
return Py::Long(deg);
|
||||
}
|
||||
|
||||
Py::Int BSplineSurfacePy::getMaxDegree(void) const
|
||||
Py::Long BSplineSurfacePy::getMaxDegree(void) const
|
||||
{
|
||||
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(surf->MaxDegree());
|
||||
return Py::Long(surf->MaxDegree());
|
||||
}
|
||||
|
||||
Py::Int BSplineSurfacePy::getNbUPoles(void) const
|
||||
Py::Long BSplineSurfacePy::getNbUPoles(void) const
|
||||
{
|
||||
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(surf->NbUPoles());
|
||||
return Py::Long(surf->NbUPoles());
|
||||
}
|
||||
|
||||
Py::Int BSplineSurfacePy::getNbVPoles(void) const
|
||||
Py::Long BSplineSurfacePy::getNbVPoles(void) const
|
||||
{
|
||||
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(surf->NbVPoles());
|
||||
return Py::Long(surf->NbVPoles());
|
||||
}
|
||||
|
||||
Py::Int BSplineSurfacePy::getNbUKnots(void) const
|
||||
Py::Long BSplineSurfacePy::getNbUKnots(void) const
|
||||
{
|
||||
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(surf->NbUKnots());
|
||||
return Py::Long(surf->NbUKnots());
|
||||
}
|
||||
|
||||
Py::Int BSplineSurfacePy::getNbVKnots(void) const
|
||||
Py::Long BSplineSurfacePy::getNbVKnots(void) const
|
||||
{
|
||||
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(surf->NbVKnots());
|
||||
return Py::Long(surf->NbVKnots());
|
||||
}
|
||||
|
||||
Py::Object BSplineSurfacePy::getFirstUKnotIndex(void) const
|
||||
|
@ -1593,7 +1593,7 @@ Py::Object BSplineSurfacePy::getFirstUKnotIndex(void) const
|
|||
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
int index = surf->FirstUKnotIndex();
|
||||
return Py::Int(index);
|
||||
return Py::Long(index);
|
||||
}
|
||||
|
||||
Py::Object BSplineSurfacePy::getLastUKnotIndex(void) const
|
||||
|
@ -1601,7 +1601,7 @@ Py::Object BSplineSurfacePy::getLastUKnotIndex(void) const
|
|||
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
int index = surf->LastUKnotIndex();
|
||||
return Py::Int(index);
|
||||
return Py::Long(index);
|
||||
}
|
||||
|
||||
Py::Object BSplineSurfacePy::getFirstVKnotIndex(void) const
|
||||
|
@ -1609,7 +1609,7 @@ Py::Object BSplineSurfacePy::getFirstVKnotIndex(void) const
|
|||
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
int index = surf->FirstVKnotIndex();
|
||||
return Py::Int(index);
|
||||
return Py::Long(index);
|
||||
}
|
||||
|
||||
Py::Object BSplineSurfacePy::getLastVKnotIndex(void) const
|
||||
|
@ -1617,7 +1617,7 @@ Py::Object BSplineSurfacePy::getLastVKnotIndex(void) const
|
|||
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
int index = surf->LastVKnotIndex();
|
||||
return Py::Int(index);
|
||||
return Py::Long(index);
|
||||
}
|
||||
|
||||
Py::List BSplineSurfacePy::getUKnotSequence(void) const
|
||||
|
|
|
@ -24,21 +24,21 @@
|
|||
<UserDocu>Returns the polynomial degree of this Bezier curve,
|
||||
which is equal to the number of poles minus 1.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Degree" Type="Int"/>
|
||||
<Parameter Name="Degree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="MaxDegree" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the value of the maximum polynomial degree of any
|
||||
Bezier curve curve. This value is 25.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="MaxDegree" Type="Int"/>
|
||||
<Parameter Name="MaxDegree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="NbPoles" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the number of poles of this Bezier curve.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="NbPoles" Type="Int"/>
|
||||
<Parameter Name="NbPoles" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="StartPoint" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
|
|
@ -356,25 +356,25 @@ PyObject* BezierCurvePy::getResolution(PyObject* args)
|
|||
}
|
||||
}
|
||||
|
||||
Py::Int BezierCurvePy::getDegree(void) const
|
||||
Py::Long BezierCurvePy::getDegree(void) const
|
||||
{
|
||||
Handle_Geom_BezierCurve curve = Handle_Geom_BezierCurve::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(curve->Degree());
|
||||
return Py::Long(curve->Degree());
|
||||
}
|
||||
|
||||
Py::Int BezierCurvePy::getMaxDegree(void) const
|
||||
Py::Long BezierCurvePy::getMaxDegree(void) const
|
||||
{
|
||||
Handle_Geom_BezierCurve curve = Handle_Geom_BezierCurve::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(curve->MaxDegree());
|
||||
return Py::Long(curve->MaxDegree());
|
||||
}
|
||||
|
||||
Py::Int BezierCurvePy::getNbPoles(void) const
|
||||
Py::Long BezierCurvePy::getNbPoles(void) const
|
||||
{
|
||||
Handle_Geom_BezierCurve curve = Handle_Geom_BezierCurve::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(curve->NbPoles());
|
||||
return Py::Long(curve->NbPoles());
|
||||
}
|
||||
|
||||
Py::Object BezierCurvePy::getStartPoint(void) const
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
which is equal to the number of poles minus 1.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="UDegree" Type="Int"/>
|
||||
<Parameter Name="UDegree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="VDegree" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
@ -34,7 +34,7 @@
|
|||
which is equal to the number of poles minus 1.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="VDegree" Type="Int"/>
|
||||
<Parameter Name="VDegree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="MaxDegree" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
@ -43,7 +43,7 @@
|
|||
Bezier surface. This value is 25.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="MaxDegree" Type="Int"/>
|
||||
<Parameter Name="MaxDegree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="NbUPoles" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
@ -51,7 +51,7 @@
|
|||
Returns the number of poles in u direction of this Bezier surface.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="NbUPoles" Type="Int"/>
|
||||
<Parameter Name="NbUPoles" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="NbVPoles" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
@ -59,7 +59,7 @@
|
|||
Returns the number of poles in v direction of this Bezier surface.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="NbVPoles" Type="Int"/>
|
||||
<Parameter Name="NbVPoles" Type="Long"/>
|
||||
</Attribute>
|
||||
<Methode Name="bounds">
|
||||
<Documentation>
|
||||
|
|
|
@ -729,39 +729,39 @@ PyObject* BezierSurfacePy::vIso(PyObject * args)
|
|||
}
|
||||
}
|
||||
|
||||
Py::Int BezierSurfacePy::getUDegree(void) const
|
||||
Py::Long BezierSurfacePy::getUDegree(void) const
|
||||
{
|
||||
Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(surf->UDegree());
|
||||
return Py::Long(surf->UDegree());
|
||||
}
|
||||
|
||||
Py::Int BezierSurfacePy::getVDegree(void) const
|
||||
Py::Long BezierSurfacePy::getVDegree(void) const
|
||||
{
|
||||
Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(surf->VDegree());
|
||||
return Py::Long(surf->VDegree());
|
||||
}
|
||||
|
||||
Py::Int BezierSurfacePy::getMaxDegree(void) const
|
||||
Py::Long BezierSurfacePy::getMaxDegree(void) const
|
||||
{
|
||||
Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(surf->MaxDegree());
|
||||
return Py::Long(surf->MaxDegree());
|
||||
}
|
||||
|
||||
Py::Int BezierSurfacePy::getNbUPoles(void) const
|
||||
Py::Long BezierSurfacePy::getNbUPoles(void) const
|
||||
{
|
||||
Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(surf->NbUPoles());
|
||||
return Py::Long(surf->NbUPoles());
|
||||
}
|
||||
|
||||
Py::Int BezierSurfacePy::getNbVPoles(void) const
|
||||
Py::Long BezierSurfacePy::getNbVPoles(void) const
|
||||
{
|
||||
Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
return Py::Int(surf->NbVPoles());
|
||||
return Py::Long(surf->NbVPoles());
|
||||
}
|
||||
|
||||
PyObject *BezierSurfacePy::getCustomAttributes(const char* /*attr*/) const
|
||||
|
|
|
@ -145,10 +145,17 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds)
|
|||
// use no kwds
|
||||
PyObject* dist_or_num;
|
||||
if (PyArg_ParseTuple(args, "O", &dist_or_num)) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
if (PyLong_Check(dist_or_num)) {
|
||||
numPoints = PyLong_AsLong(dist_or_num);
|
||||
uniformAbscissaPoints = true;
|
||||
}
|
||||
#else
|
||||
if (PyInt_Check(dist_or_num)) {
|
||||
numPoints = PyInt_AsLong(dist_or_num);
|
||||
uniformAbscissaPoints = true;
|
||||
}
|
||||
#endif
|
||||
else if (PyFloat_Check(dist_or_num)) {
|
||||
distance = PyFloat_AsDouble(dist_or_num);
|
||||
uniformAbscissaDistance = true;
|
||||
|
|
|
@ -501,7 +501,7 @@ PyObject *PropertyFilletEdges::getPyObject(void)
|
|||
int index = 0;
|
||||
for (it = _lValueList.begin(); it != _lValueList.end(); ++it) {
|
||||
Py::Tuple ent(3);
|
||||
ent.setItem(0, Py::Int(it->edgeid));
|
||||
ent.setItem(0, Py::Long(it->edgeid));
|
||||
ent.setItem(1, Py::Float(it->radius1));
|
||||
ent.setItem(2, Py::Float(it->radius2));
|
||||
list[index++] = ent;
|
||||
|
@ -518,7 +518,7 @@ void PropertyFilletEdges::setPyObject(PyObject *value)
|
|||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
FilletElement fe;
|
||||
Py::Tuple ent(*it);
|
||||
fe.edgeid = (int)Py::Int(ent.getItem(0));
|
||||
fe.edgeid = (int)Py::Long(ent.getItem(0));
|
||||
fe.radius1 = (double)Py::Float(ent.getItem(1));
|
||||
fe.radius2 = (double)Py::Float(ent.getItem(2));
|
||||
values.push_back(fe);
|
||||
|
|
|
@ -412,10 +412,17 @@ PyObject* TopoShapeEdgePy::discretize(PyObject *args, PyObject *kwds)
|
|||
// use no kwds
|
||||
PyObject* dist_or_num;
|
||||
if (PyArg_ParseTuple(args, "O", &dist_or_num)) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
if (PyLong_Check(dist_or_num)) {
|
||||
numPoints = PyLong_AsLong(dist_or_num);
|
||||
uniformAbscissaPoints = true;
|
||||
}
|
||||
#else
|
||||
if (PyInt_Check(dist_or_num)) {
|
||||
numPoints = PyInt_AsLong(dist_or_num);
|
||||
uniformAbscissaPoints = true;
|
||||
}
|
||||
#endif
|
||||
else if (PyFloat_Check(dist_or_num)) {
|
||||
distance = PyFloat_AsDouble(dist_or_num);
|
||||
uniformAbscissaDistance = true;
|
||||
|
|
|
@ -750,7 +750,7 @@ PyObject* TopoShapePy::check(PyObject *args)
|
|||
if (!getTopoShapePtr()->getShape().IsNull()) {
|
||||
std::stringstream str;
|
||||
if (!getTopoShapePtr()->analyze(str)) {
|
||||
PyErr_SetString(PyExc_StandardError, str.str().c_str());
|
||||
PyErr_SetString(PyExc_ValueError, str.str().c_str());
|
||||
PyErr_Print();
|
||||
}
|
||||
}
|
||||
|
@ -1758,9 +1758,9 @@ PyObject* TopoShapePy::tessellate(PyObject *args)
|
|||
for (std::vector<Data::ComplexGeoData::Facet>::const_iterator
|
||||
it = Facets.begin(); it != Facets.end(); ++it) {
|
||||
Py::Tuple f(3);
|
||||
f.setItem(0,Py::Int((int)it->I1));
|
||||
f.setItem(1,Py::Int((int)it->I2));
|
||||
f.setItem(2,Py::Int((int)it->I3));
|
||||
f.setItem(0,Py::Long((long)it->I1));
|
||||
f.setItem(1,Py::Long((long)it->I2));
|
||||
f.setItem(2,Py::Long((long)it->I3));
|
||||
facet.append(f);
|
||||
}
|
||||
tuple.setItem(1, facet);
|
||||
|
@ -1870,9 +1870,9 @@ PyObject* TopoShapePy::makeShapeFromMesh(PyObject *args)
|
|||
for (Py::Sequence::iterator it = facets.begin(); it != facets.end(); ++it) {
|
||||
Data::ComplexGeoData::Facet face;
|
||||
Py::Tuple f(*it);
|
||||
face.I1 = (int)Py::Int(f[0]);
|
||||
face.I2 = (int)Py::Int(f[1]);
|
||||
face.I3 = (int)Py::Int(f[2]);
|
||||
face.I1 = (int)Py::Long(f[0]);
|
||||
face.I2 = (int)Py::Long(f[1]);
|
||||
face.I3 = (int)Py::Long(f[2]);
|
||||
Facets.push_back(face);
|
||||
}
|
||||
|
||||
|
@ -2245,7 +2245,11 @@ PyObject* _getSupportIndex(char* suppStr, TopoShape* ts, TopoDS_Shape suppShape)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
return PyLong_FromLong(supportIndex);
|
||||
#else
|
||||
return PyInt_FromLong(supportIndex);
|
||||
#endif
|
||||
}
|
||||
|
||||
PyObject* TopoShapePy::proximity(PyObject *args)
|
||||
|
@ -2341,20 +2345,32 @@ PyObject* TopoShapePy::distToShape(PyObject *args)
|
|||
suppS1 = extss.SupportOnShape1(i);
|
||||
switch (supportType1) {
|
||||
case BRepExtrema_IsVertex:
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
pSuppType1 = PyBytes_FromString("Vertex");
|
||||
#else
|
||||
pSuppType1 = PyString_FromString("Vertex");
|
||||
#endif
|
||||
pSupportIndex1 = _getSupportIndex("Vertex",ts1,suppS1);
|
||||
pParm1 = Py_None;
|
||||
pParm2 = Py_None;
|
||||
break;
|
||||
case BRepExtrema_IsOnEdge:
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
pSuppType1 = PyBytes_FromString("Edge");
|
||||
#else
|
||||
pSuppType1 = PyString_FromString("Edge");
|
||||
#endif
|
||||
pSupportIndex1 = _getSupportIndex("Edge",ts1,suppS1);
|
||||
extss.ParOnEdgeS1(i,t1);
|
||||
pParm1 = PyFloat_FromDouble(t1);
|
||||
pParm2 = Py_None;
|
||||
break;
|
||||
case BRepExtrema_IsInFace:
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
pSuppType1 = PyBytes_FromString("Face");
|
||||
#else
|
||||
pSuppType1 = PyString_FromString("Face");
|
||||
#endif
|
||||
pSupportIndex1 = _getSupportIndex("Face",ts1,suppS1);
|
||||
extss.ParOnFaceS1(i,u1,v1);
|
||||
pParm1 = PyTuple_New(2);
|
||||
|
@ -2364,8 +2380,13 @@ PyObject* TopoShapePy::distToShape(PyObject *args)
|
|||
break;
|
||||
default:
|
||||
Base::Console().Message("distToShape: supportType1 is unknown: %d \n",supportType1);
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
pSuppType1 = PyBytes_FromString("Unknown");
|
||||
pSupportIndex1 = PyLong_FromLong(-1);
|
||||
#else
|
||||
pSuppType1 = PyString_FromString("Unknown");
|
||||
pSupportIndex1 = PyInt_FromLong(-1);
|
||||
#endif
|
||||
pParm1 = Py_None;
|
||||
pParm2 = Py_None;
|
||||
}
|
||||
|
@ -2376,18 +2397,30 @@ PyObject* TopoShapePy::distToShape(PyObject *args)
|
|||
suppS2 = extss.SupportOnShape2(i);
|
||||
switch (supportType2) {
|
||||
case BRepExtrema_IsVertex:
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
pSuppType2 = PyBytes_FromString("Vertex");
|
||||
#else
|
||||
pSuppType2 = PyString_FromString("Vertex");
|
||||
#endif
|
||||
pSupportIndex2 = _getSupportIndex("Vertex",ts2,suppS2);
|
||||
pParm2 = Py_None;
|
||||
break;
|
||||
case BRepExtrema_IsOnEdge:
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
pSuppType2 = PyBytes_FromString("Edge");
|
||||
#else
|
||||
pSuppType2 = PyString_FromString("Edge");
|
||||
#endif
|
||||
pSupportIndex2 = _getSupportIndex("Edge",ts2,suppS2);
|
||||
extss.ParOnEdgeS2(i,t2);
|
||||
pParm2 = PyFloat_FromDouble(t2);
|
||||
break;
|
||||
case BRepExtrema_IsInFace:
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
pSuppType2 = PyBytes_FromString("Face");
|
||||
#else
|
||||
pSuppType2 = PyString_FromString("Face");
|
||||
#endif
|
||||
pSupportIndex2 = _getSupportIndex("Face",ts2,suppS2);
|
||||
extss.ParOnFaceS2(i,u2,v2);
|
||||
pParm2 = PyTuple_New(2);
|
||||
|
@ -2396,8 +2429,13 @@ PyObject* TopoShapePy::distToShape(PyObject *args)
|
|||
break;
|
||||
default:
|
||||
Base::Console().Message("distToShape: supportType2 is unknown: %d \n",supportType1);
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
pSuppType2 = PyBytes_FromString("Unknown");
|
||||
pSupportIndex2 = PyLong_FromLong(-1);
|
||||
#else
|
||||
pSuppType2 = PyString_FromString("Unknown");
|
||||
pSupportIndex2 = PyInt_FromLong(-1);
|
||||
#endif
|
||||
}
|
||||
pts = PyTuple_New(2);
|
||||
PyTuple_SetItem(pts,0,pPt1);
|
||||
|
|
|
@ -362,10 +362,17 @@ PyObject* TopoShapeWirePy::discretize(PyObject *args, PyObject *kwds)
|
|||
// use no kwds
|
||||
PyObject* dist_or_num;
|
||||
if (PyArg_ParseTuple(args, "O", &dist_or_num)) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
if (PyLong_Check(dist_or_num)) {
|
||||
numPoints = PyLong_AsLong(dist_or_num);
|
||||
uniformAbscissaPoints = true;
|
||||
}
|
||||
#else
|
||||
if (PyInt_Check(dist_or_num)) {
|
||||
numPoints = PyInt_AsLong(dist_or_num);
|
||||
uniformAbscissaPoints = true;
|
||||
}
|
||||
#endif
|
||||
else if (PyFloat_Check(dist_or_num)) {
|
||||
distance = PyFloat_AsDouble(dist_or_num);
|
||||
uniformAbscissaDistance = true;
|
||||
|
|
|
@ -102,11 +102,11 @@ PyObject* initModule()
|
|||
|
||||
} // namespace PartGui
|
||||
|
||||
PyMODINIT_FUNC initPartGui()
|
||||
PyMOD_INIT_FUNC(PartGui)
|
||||
{
|
||||
if (!Gui::Application::Instance) {
|
||||
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
|
||||
return;
|
||||
PyMOD_Return(0);
|
||||
}
|
||||
|
||||
// load needed modules
|
||||
|
@ -115,10 +115,11 @@ PyMODINIT_FUNC initPartGui()
|
|||
}
|
||||
catch(const Base::Exception& e) {
|
||||
PyErr_SetString(PyExc_ImportError, e.what());
|
||||
return;
|
||||
PyMOD_Return(0);
|
||||
}
|
||||
|
||||
PyObject* partGuiModule = PartGui::initModule();
|
||||
|
||||
Base::Console().Log("Loading GUI of Part module... done\n");
|
||||
|
||||
PyObject* pAttachEngineTextsModule = Py_InitModule3("AttachEngineResources", AttacherGui::AttacherGuiPy::Methods,
|
||||
|
@ -207,4 +208,6 @@ PyMODINIT_FUNC initPartGui()
|
|||
Gui::BitmapFactoryInst& rclBmpFactory = Gui::BitmapFactory();
|
||||
rclBmpFactory.addXPM("PartFeature",(const char**) PartFeature_xpm);
|
||||
rclBmpFactory.addXPM("PartFeatureImport",(const char**) PartFeatureImport_xpm);
|
||||
|
||||
PyMOD_Return(partGuiModule);
|
||||
}
|
||||
|
|
|
@ -606,12 +606,12 @@ void CmdPartCompJoinFeatures::languageChange()
|
|||
|
||||
if (!_pcAction)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
|
||||
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
QList<QAction*> a = pcAction->actions();
|
||||
|
||||
|
||||
Gui::Command* joinConnect = rcCmdMgr.getCommandByName("Part_JoinConnect");
|
||||
if (joinConnect) {
|
||||
QAction* cmd0 = a[0];
|
||||
|
@ -635,6 +635,7 @@ void CmdPartCompJoinFeatures::languageChange()
|
|||
cmd2->setToolTip(QApplication::translate("Part_JoinFeatures", joinCutout->getToolTipText()));
|
||||
cmd2->setStatusTip(QApplication::translate("Part_JoinFeatures", joinCutout->getStatusTip()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CmdPartCompJoinFeatures::isActive(void)
|
||||
|
|
Loading…
Reference in New Issue
Block a user