All: Reformat according to new standard

This commit is contained in:
pre-commit-ci[bot]
2025-11-11 13:49:01 +01:00
committed by Kacper Donat
parent ef997f2259
commit 9fe130cd73
2390 changed files with 154630 additions and 115818 deletions

View File

@@ -24,13 +24,13 @@
#include <Mod/Part/PartGlobal.h>
# include <BRepOffsetAPI_MakePipeShell.hxx>
# include <gp_Ax2.hxx>
# include <gp_Dir.hxx>
# include <gp_Pnt.hxx>
# include <Standard_Version.hxx>
# include <TopoDS.hxx>
# include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRepOffsetAPI_MakePipeShell.hxx>
#include <gp_Ax2.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <Standard_Version.hxx>
#include <TopoDS.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <Base/GeometryPyCXX.h>
@@ -47,12 +47,13 @@
using namespace Part;
PyObject *BRepOffsetAPI_MakePipeShellPy::PyMake(struct _typeobject *, PyObject *args, PyObject *) // Python wrapper
PyObject* BRepOffsetAPI_MakePipeShellPy::PyMake(struct _typeobject*, PyObject* args, PyObject*) // Python wrapper
{
// create a new instance of BRepOffsetAPI_MakePipeShellPy and the Twin object
PyObject* obj;
if (!PyArg_ParseTuple(args, "O!",&(TopoShapePy::Type),&obj))
if (!PyArg_ParseTuple(args, "O!", &(TopoShapePy::Type), &obj)) {
return nullptr;
}
const TopoDS_Shape& wire = static_cast<TopoShapePy*>(obj)->getTopoShapePtr()->getShape();
if (!wire.IsNull() && wire.ShapeType() == TopAbs_WIRE) {
return new BRepOffsetAPI_MakePipeShellPy(new BRepOffsetAPI_MakePipeShell(TopoDS::Wire(wire)));
@@ -74,11 +75,12 @@ std::string BRepOffsetAPI_MakePipeShellPy::representation() const
return {"<BRepOffsetAPI_MakePipeShell object>"};
}
PyObject* BRepOffsetAPI_MakePipeShellPy::setFrenetMode(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::setFrenetMode(PyObject* args)
{
PyObject *obj;
if (!PyArg_ParseTuple(args, "O!",&PyBool_Type,&obj))
PyObject* obj;
if (!PyArg_ParseTuple(args, "O!", &PyBool_Type, &obj)) {
return nullptr;
}
try {
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(Base::asBoolean(obj));
@@ -90,17 +92,17 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setFrenetMode(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::setTrihedronMode(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::setTrihedronMode(PyObject* args)
{
PyObject *pnt, *dir;
if (!PyArg_ParseTuple(args, "O!O!",&Base::VectorPy::Type,&pnt
,&Base::VectorPy::Type,&dir))
if (!PyArg_ParseTuple(args, "O!O!", &Base::VectorPy::Type, &pnt, &Base::VectorPy::Type, &dir)) {
return nullptr;
}
try {
gp_Pnt p = Base::convertTo<gp_Pnt>(Py::Vector(pnt,false).toVector());
gp_Dir d = Base::convertTo<gp_Dir>(Py::Vector(dir,false).toVector());
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(gp_Ax2(p,d));
gp_Pnt p = Base::convertTo<gp_Pnt>(Py::Vector(pnt, false).toVector());
gp_Dir d = Base::convertTo<gp_Dir>(Py::Vector(dir, false).toVector());
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(gp_Ax2(p, d));
Py_Return;
}
catch (Standard_Failure& e) {
@@ -109,14 +111,15 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setTrihedronMode(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::setBiNormalMode(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::setBiNormalMode(PyObject* args)
{
PyObject *dir;
if (!PyArg_ParseTuple(args, "O!",&Base::VectorPy::Type,&dir))
PyObject* dir;
if (!PyArg_ParseTuple(args, "O!", &Base::VectorPy::Type, &dir)) {
return nullptr;
}
try {
gp_Dir d = Base::convertTo<gp_Dir>(Py::Vector(dir,false).toVector());
gp_Dir d = Base::convertTo<gp_Dir>(Py::Vector(dir, false).toVector());
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(d);
Py_Return;
}
@@ -126,11 +129,12 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setBiNormalMode(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::setSpineSupport(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::setSpineSupport(PyObject* args)
{
PyObject *shape;
if (!PyArg_ParseTuple(args, "O!",&Part::TopoShapePy::Type,&shape))
PyObject* shape;
if (!PyArg_ParseTuple(args, "O!", &Part::TopoShapePy::Type, &shape)) {
return nullptr;
}
try {
const TopoDS_Shape& s = static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape();
@@ -143,13 +147,21 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setSpineSupport(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject* args)
{
PyObject *spine, *curv, *keep;
if (!PyArg_ParseTuple(args, "O!O!O!",&Part::TopoShapePy::Type,&spine
,&PyBool_Type,&curv
,&PyLong_Type,&keep))
if (!PyArg_ParseTuple(
args,
"O!O!O!",
&Part::TopoShapePy::Type,
&spine,
&PyBool_Type,
&curv,
&PyLong_Type,
&keep
)) {
return nullptr;
}
try {
const TopoDS_Shape& s = static_cast<Part::TopoShapePy*>(spine)->getTopoShapePtr()->getShape();
@@ -160,20 +172,18 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args)
BRepFill_TypeOfContact typeOfCantact;
switch (PyLong_AsLong(keep)) {
case 1:
typeOfCantact = BRepFill_Contact;
break;
case 2:
typeOfCantact = BRepFill_ContactOnBorder;
break;
default:
typeOfCantact = BRepFill_NoContact;
break;
case 1:
typeOfCantact = BRepFill_Contact;
break;
case 2:
typeOfCantact = BRepFill_ContactOnBorder;
break;
default:
typeOfCantact = BRepFill_NoContact;
break;
}
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(
TopoDS::Wire(s),
Base::asBoolean(curv),
typeOfCantact);
this->getBRepOffsetAPI_MakePipeShellPtr()
->SetMode(TopoDS::Wire(s), Base::asBoolean(curv), typeOfCantact);
Py_Return;
}
catch (Standard_Failure& e) {
@@ -182,15 +192,32 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args, PyObject *kwds)
PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject* args, PyObject* kwds)
{
PyObject *profile, *withContact=Py_False, *withCorrection=Py_False;
static const std::array<const char *, 4> keywords_pro{"Profile", "WithContact", "WithCorrection", nullptr};
if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!|O!O!", keywords_pro, &Part::TopoShapePy::Type, &profile,
&PyBool_Type, &withContact, &PyBool_Type, &withCorrection)) {
PyObject *profile, *withContact = Py_False, *withCorrection = Py_False;
static const std::array<const char*, 4> keywords_pro {
"Profile",
"WithContact",
"WithCorrection",
nullptr
};
if (Base::Wrapped_ParseTupleAndKeywords(
args,
kwds,
"O!|O!O!",
keywords_pro,
&Part::TopoShapePy::Type,
&profile,
&PyBool_Type,
&withContact,
&PyBool_Type,
&withCorrection
)) {
try {
const TopoDS_Shape& s = static_cast<Part::TopoShapePy*>(profile)->getTopoShapePtr()->getShape();
this->getBRepOffsetAPI_MakePipeShellPtr()->Add(s, Base::asBoolean(withContact), Base::asBoolean(withCorrection));
const TopoDS_Shape& s
= static_cast<Part::TopoShapePy*>(profile)->getTopoShapePtr()->getShape();
this->getBRepOffsetAPI_MakePipeShellPtr()
->Add(s, Base::asBoolean(withContact), Base::asBoolean(withCorrection));
Py_Return;
}
catch (Standard_Failure& e) {
@@ -200,16 +227,31 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args, PyObject *kwds)
}
PyErr_Clear();
PyObject *location;
static const std::array<const char *, 5> keywords_loc{"Profile", "Location", "WithContact", "WithCorrection",
nullptr};
if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!O!|O!O!", keywords_loc, &Part::TopoShapePy::Type, &profile,
&Part::TopoShapeVertexPy::Type, &location, &PyBool_Type, &withContact, &PyBool_Type,
&withCorrection)) {
PyObject* location;
static const std::array<const char*, 5>
keywords_loc {"Profile", "Location", "WithContact", "WithCorrection", nullptr};
if (Base::Wrapped_ParseTupleAndKeywords(
args,
kwds,
"O!O!|O!O!",
keywords_loc,
&Part::TopoShapePy::Type,
&profile,
&Part::TopoShapeVertexPy::Type,
&location,
&PyBool_Type,
&withContact,
&PyBool_Type,
&withCorrection
)) {
try {
const TopoDS_Shape& s = static_cast<Part::TopoShapePy*>(profile)->getTopoShapePtr()->getShape();
const TopoDS_Vertex& v = TopoDS::Vertex(static_cast<Part::TopoShapePy*>(location)->getTopoShapePtr()->getShape());
this->getBRepOffsetAPI_MakePipeShellPtr()->Add(s, v, Base::asBoolean(withContact), Base::asBoolean(withCorrection));
const TopoDS_Shape& s
= static_cast<Part::TopoShapePy*>(profile)->getTopoShapePtr()->getShape();
const TopoDS_Vertex& v = TopoDS::Vertex(
static_cast<Part::TopoShapePy*>(location)->getTopoShapePtr()->getShape()
);
this->getBRepOffsetAPI_MakePipeShellPtr()
->Add(s, v, Base::asBoolean(withContact), Base::asBoolean(withCorrection));
Py_Return;
}
catch (Standard_Failure& e) {
@@ -218,18 +260,21 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args, PyObject *kwds)
}
}
PyErr_SetString(PyExc_TypeError, "Wrong arguments:\n"
"add(Profile, WithContact=False, WithCorrection=False)\n"
"add(Profile, Location, WithContact=False, WithCorrection=False)"
PyErr_SetString(
PyExc_TypeError,
"Wrong arguments:\n"
"add(Profile, WithContact=False, WithCorrection=False)\n"
"add(Profile, Location, WithContact=False, WithCorrection=False)"
);
return nullptr;
}
PyObject* BRepOffsetAPI_MakePipeShellPy::remove(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::remove(PyObject* args)
{
PyObject *prof;
if (!PyArg_ParseTuple(args, "O!",&Part::TopoShapePy::Type,&prof))
PyObject* prof;
if (!PyArg_ParseTuple(args, "O!", &Part::TopoShapePy::Type, &prof)) {
return nullptr;
}
try {
const TopoDS_Shape& s = static_cast<Part::TopoShapePy*>(prof)->getTopoShapePtr()->getShape();
@@ -242,10 +287,11 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::remove(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::isReady(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::isReady(PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
try {
Standard_Boolean ok = this->getBRepOffsetAPI_MakePipeShellPtr()->IsReady();
@@ -257,10 +303,11 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::isReady(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::getStatus(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::getStatus(PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
try {
Standard_Integer val = this->getBRepOffsetAPI_MakePipeShellPtr()->GetStatus();
@@ -272,10 +319,11 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::getStatus(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::makeSolid(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::makeSolid(PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
try {
Standard_Boolean ok = this->getBRepOffsetAPI_MakePipeShellPtr()->MakeSolid();
@@ -287,10 +335,11 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::makeSolid(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::build(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::build(PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
try {
this->getBRepOffsetAPI_MakePipeShellPtr()->Build();
@@ -302,10 +351,11 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::build(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::shape(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::shape(PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
try {
const TopoDS_Shape& shape = this->getBRepOffsetAPI_MakePipeShellPtr()->Shape();
@@ -317,10 +367,11 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::shape(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::firstShape(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::firstShape(PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
try {
TopoDS_Shape shape = this->getBRepOffsetAPI_MakePipeShellPtr()->FirstShape();
@@ -332,10 +383,11 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::firstShape(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::lastShape(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::lastShape(PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
try {
TopoDS_Shape shape = this->getBRepOffsetAPI_MakePipeShellPtr()->LastShape();
@@ -347,11 +399,12 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::lastShape(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::generated(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::generated(PyObject* args)
{
PyObject *shape;
if (!PyArg_ParseTuple(args, "O!",&Part::TopoShapePy::Type,&shape))
PyObject* shape;
if (!PyArg_ParseTuple(args, "O!", &Part::TopoShapePy::Type, &shape)) {
return nullptr;
}
try {
const TopoDS_Shape& s = static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape();
@@ -371,11 +424,12 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::generated(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::setTolerance(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::setTolerance(PyObject* args)
{
double tol3d, boundTol, tolAngular;
if (!PyArg_ParseTuple(args, "ddd",&tol3d,&boundTol,&tolAngular))
if (!PyArg_ParseTuple(args, "ddd", &tol3d, &boundTol, &tolAngular)) {
return nullptr;
}
try {
this->getBRepOffsetAPI_MakePipeShellPtr()->SetTolerance(tol3d, boundTol, tolAngular);
@@ -387,14 +441,17 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setTolerance(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::setTransitionMode(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::setTransitionMode(PyObject* args)
{
int mode;
if (!PyArg_ParseTuple(args, "i",&mode))
if (!PyArg_ParseTuple(args, "i", &mode)) {
return nullptr;
}
try {
this->getBRepOffsetAPI_MakePipeShellPtr()->SetTransitionMode(BRepBuilderAPI_TransitionMode(mode));
this->getBRepOffsetAPI_MakePipeShellPtr()->SetTransitionMode(
BRepBuilderAPI_TransitionMode(mode)
);
Py_Return;
}
catch (Standard_Failure& e) {
@@ -403,11 +460,12 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setTransitionMode(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxDegree(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxDegree(PyObject* args)
{
int degree;
if (!PyArg_ParseTuple(args, "i",&degree))
if (!PyArg_ParseTuple(args, "i", &degree)) {
return nullptr;
}
try {
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMaxDegree(degree);
@@ -419,11 +477,12 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxDegree(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxSegments(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxSegments(PyObject* args)
{
int nbseg;
if (!PyArg_ParseTuple(args, "i",&nbseg))
if (!PyArg_ParseTuple(args, "i", &nbseg)) {
return nullptr;
}
try {
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMaxSegments(nbseg);
@@ -435,11 +494,12 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxSegments(PyObject *args)
}
}
PyObject* BRepOffsetAPI_MakePipeShellPy::setForceApproxC1(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::setForceApproxC1(PyObject* args)
{
PyObject *obj;
if (!PyArg_ParseTuple(args, "O!",&PyBool_Type,&obj))
PyObject* obj;
if (!PyArg_ParseTuple(args, "O!", &PyBool_Type, &obj)) {
return nullptr;
}
try {
this->getBRepOffsetAPI_MakePipeShellPtr()->SetForceApproxC1(Base::asBoolean(obj));
@@ -452,11 +512,12 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setForceApproxC1(PyObject *args)
}
PyObject* BRepOffsetAPI_MakePipeShellPy::simulate(PyObject *args)
PyObject* BRepOffsetAPI_MakePipeShellPy::simulate(PyObject* args)
{
int nbsec;
if (!PyArg_ParseTuple(args, "i",&nbsec))
if (!PyArg_ParseTuple(args, "i", &nbsec)) {
return nullptr;
}
try {
TopTools_ListOfShape list;
@@ -477,12 +538,12 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::simulate(PyObject *args)
}
PyObject *BRepOffsetAPI_MakePipeShellPy::getCustomAttributes(const char* ) const
PyObject* BRepOffsetAPI_MakePipeShellPy::getCustomAttributes(const char*) const
{
return nullptr;
}
int BRepOffsetAPI_MakePipeShellPy::setCustomAttributes(const char* , PyObject *)
int BRepOffsetAPI_MakePipeShellPy::setCustomAttributes(const char*, PyObject*)
{
return 0;
}