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 eafd18dac0
commit 25c3ba7338
2390 changed files with 154630 additions and 115818 deletions

View File

@@ -90,13 +90,15 @@ Handle(Geom_BezierCurve) BlendCurve::compute()
for (size_t i = 0; i < nb_pts; ++i) {
math_Matrix bezier_eval(1, blendPoints[i].nbVectors(), 1, num_poles, 0.0);
Standard_Integer first_non_zero;
BSplCLib::EvalBsplineBasis(blendPoints[i].nbVectors() - 1,
num_poles,
knots,
params(cons_idx),
first_non_zero,
bezier_eval,
Standard_False);
BSplCLib::EvalBsplineBasis(
blendPoints[i].nbVectors() - 1,
num_poles,
knots,
params(cons_idx),
first_non_zero,
bezier_eval,
Standard_False
);
int idx2 = 1;
for (int it2 = 0; it2 < blendPoints[i].nbVectors(); ++it2) {
OCCmatrix.SetRow(row_idx, bezier_eval.Row(idx2));

View File

@@ -49,12 +49,14 @@ int BlendCurvePy::PyInit(PyObject* args, PyObject* /*kwds*/)
PyObject* b1;
PyObject* b2;
if (!PyArg_ParseTuple(args,
"O!O!",
&(Surface::BlendPointPy::Type),
&b1,
&(Surface::BlendPointPy::Type),
&b2)) {
if (!PyArg_ParseTuple(
args,
"O!O!",
&(Surface::BlendPointPy::Type),
&b1,
&(Surface::BlendPointPy::Type),
&b2
)) {
return -1;
}

View File

@@ -92,8 +92,7 @@ int BlendPointPy::PyInit(PyObject* args, PyObject*)
if (PyArg_ParseTuple(args, "O!di", &(Part::TopoShapePy::Type), &pcObj, &param, &cont)) {
try {
gp_Pnt Pt;
TopoDS_Shape shape =
static_cast<Part::TopoShapePy*>(pcObj)->getTopoShapePtr()->getShape();
TopoDS_Shape shape = static_cast<Part::TopoShapePy*>(pcObj)->getTopoShapePtr()->getShape();
const TopoDS_Edge& e = TopoDS::Edge(shape);
BRepAdaptor_Curve adapt(e);
if (param < adapt.FirstParameter() || param > adapt.LastParameter()) {
@@ -120,11 +119,13 @@ int BlendPointPy::PyInit(PyObject* args, PyObject*)
}
}
PyErr_SetString(PyExc_TypeError,
"supported signatures:\n"
"BlendPoint()\n"
"BlendPoint(list of Vector)\n"
"BlendPoint(edge, parameter and continiuity)\n");
PyErr_SetString(
PyExc_TypeError,
"supported signatures:\n"
"BlendPoint()\n"
"BlendPoint(list of Vector)\n"
"BlendPoint(edge, parameter and continiuity)\n"
);
return -1;
}

View File

@@ -47,52 +47,38 @@ PROPERTY_SOURCE(Surface::FeatureBlendCurve, Part::Spline)
FeatureBlendCurve::FeatureBlendCurve()
{
ADD_PROPERTY_TYPE(StartEdge,
(nullptr),
"FirstEdge",
App::Prop_None,
"Edge support of the start point");
ADD_PROPERTY_TYPE(StartContinuity,
(2),
"FirstEdge",
App::Prop_None,
"Geometric continuity at start point");
ADD_PROPERTY_TYPE(StartEdge, (nullptr), "FirstEdge", App::Prop_None, "Edge support of the start point");
ADD_PROPERTY_TYPE(
StartContinuity,
(2),
"FirstEdge",
App::Prop_None,
"Geometric continuity at start point"
);
StartContinuity.setConstraints(&ContinuityConstraint);
ADD_PROPERTY_TYPE(StartParameter,
(0.0f),
"FirstEdge",
App::Prop_None,
"Parameter of start point along edge");
ADD_PROPERTY_TYPE(
StartParameter,
(0.0f),
"FirstEdge",
App::Prop_None,
"Parameter of start point along edge"
);
StartParameter.setConstraints(&ParameterConstraint);
ADD_PROPERTY_TYPE(StartSize,
(1.0f),
"FirstEdge",
App::Prop_None,
"Size of derivatives at start point");
ADD_PROPERTY_TYPE(StartSize, (1.0f), "FirstEdge", App::Prop_None, "Size of derivatives at start point");
StartSize.setConstraints(&SizeConstraint);
ADD_PROPERTY_TYPE(EndEdge,
(nullptr),
"SecondEdge",
App::Prop_None,
"Edge support of the end point");
ADD_PROPERTY_TYPE(EndContinuity,
(2),
"SecondEdge",
App::Prop_None,
"Geometric continuity at end point");
ADD_PROPERTY_TYPE(EndEdge, (nullptr), "SecondEdge", App::Prop_None, "Edge support of the end point");
ADD_PROPERTY_TYPE(EndContinuity, (2), "SecondEdge", App::Prop_None, "Geometric continuity at end point");
EndContinuity.setConstraints(&ContinuityConstraint);
ADD_PROPERTY_TYPE(EndParameter,
(0.0f),
"SecondEdge",
App::Prop_None,
"Parameter of end point along edge");
ADD_PROPERTY_TYPE(
EndParameter,
(0.0f),
"SecondEdge",
App::Prop_None,
"Parameter of end point along edge"
);
EndParameter.setConstraints(&ParameterConstraint);
ADD_PROPERTY_TYPE(EndSize,
(1.0f),
"SecondEdge",
App::Prop_None,
"Size of derivatives at end point");
ADD_PROPERTY_TYPE(EndSize, (1.0f), "SecondEdge", App::Prop_None, "Size of derivatives at end point");
EndSize.setConstraints(&SizeConstraint);
Handle(Geom_BezierCurve) maxDegreeCurve;
@@ -128,23 +114,25 @@ short FeatureBlendCurve::mustExecute() const
return 0;
}
BlendPoint FeatureBlendCurve::GetBlendPoint(App::PropertyLinkSub& link,
App::PropertyFloatConstraint& param,
App::PropertyIntegerConstraint& continuity)
BlendPoint FeatureBlendCurve::GetBlendPoint(
App::PropertyLinkSub& link,
App::PropertyFloatConstraint& param,
App::PropertyIntegerConstraint& continuity
)
{
auto linked = link.getValue();
TopoDS_Shape axEdge;
if (link.getSubValues().size() > 0 && link.getSubValues()[0].length() > 0) {
axEdge = Part::Feature::getShape(linked,
Part::ShapeOption::NeedSubElement
| Part::ShapeOption::ResolveLink
| Part::ShapeOption::Transform,
link.getSubValues()[0].c_str());
axEdge = Part::Feature::getShape(
linked,
Part::ShapeOption::NeedSubElement | Part::ShapeOption::ResolveLink
| Part::ShapeOption::Transform,
link.getSubValues()[0].c_str()
);
}
else {
axEdge = Feature::getShape(linked,
Part::ShapeOption::ResolveLink | Part::ShapeOption::Transform);
axEdge = Feature::getShape(linked, Part::ShapeOption::ResolveLink | Part::ShapeOption::Transform);
}
if (axEdge.IsNull()) {

View File

@@ -62,9 +62,11 @@ public:
}
private:
BlendPoint GetBlendPoint(App::PropertyLinkSub& link,
App::PropertyFloatConstraint& param,
App::PropertyIntegerConstraint& Continuity);
BlendPoint GetBlendPoint(
App::PropertyLinkSub& link,
App::PropertyFloatConstraint& param,
App::PropertyIntegerConstraint& Continuity
);
double RelativeToRealParameters(double, double, double);
protected:

View File

@@ -56,7 +56,8 @@ App::DocumentObjectExecReturn* Cut::execute()
std::vector<App::DocumentObject*> shapes = ShapeList.getValues();
if (shapes.size() != 2) {
return new App::DocumentObjectExecReturn(
"Two shapes must be entered at a time for a cut operation");
"Two shapes must be entered at a time for a cut operation"
);
}
Part::TopoShape ts1;

View File

@@ -43,9 +43,7 @@
using namespace Surface;
const App::PropertyIntegerConstraint::Constraints SampleRange = {2,
std::numeric_limits<int>::max(),
1};
const App::PropertyIntegerConstraint::Constraints SampleRange = {2, std::numeric_limits<int>::max(), 1};
const App::PropertyFloatConstraint::Constraints ToleranceRange = {0.0, 10.0, 0.01};
const App::PropertyFloatConstraint::Constraints ExtendRange = {-0.5, 10.0, 0.01};
PROPERTY_SOURCE(Surface::Extend, Part::Spline)
@@ -106,8 +104,9 @@ App::DocumentObjectExecReturn* Extend::execute()
return new App::DocumentObjectExecReturn("Not exactly one sub-shape linked.");
}
TopoDS_Shape shape =
static_cast<Part::Feature*>(part)->Shape.getShape().getSubShape(faces[0].c_str());
TopoDS_Shape shape = static_cast<Part::Feature*>(part)->Shape.getShape().getSubShape(
faces[0].c_str()
);
if (shape.IsNull() || shape.ShapeType() != TopAbs_FACE) {
return new App::DocumentObjectExecReturn("Sub-shape is not a face.");
}
@@ -188,13 +187,10 @@ void Extend::onChanged(const App::Property* prop)
Part::Spline::onChanged(prop);
}
void Extend::handleChangedPropertyName(Base::XMLReader& reader,
const char* TypeName,
const char* PropName)
void Extend::handleChangedPropertyName(Base::XMLReader& reader, const char* TypeName, const char* PropName)
{
Base::Type type = Base::Type::fromName(TypeName);
if (App::PropertyFloatConstraint::getClassTypeId() == type
&& strcmp(PropName, "ExtendU") == 0) {
if (App::PropertyFloatConstraint::getClassTypeId() == type && strcmp(PropName, "ExtendU") == 0) {
App::PropertyFloatConstraint v;
v.Restore(reader);
ExtendUNeg.setValue(v.getValue());

View File

@@ -62,9 +62,11 @@ public:
protected:
void onChanged(const App::Property* prop) override;
void handleChangedPropertyName(Base::XMLReader& reader,
const char* TypeName,
const char* PropName) override;
void handleChangedPropertyName(
Base::XMLReader& reader,
const char* TypeName,
const char* PropName
) override;
private:
bool lockOnChangeMutex {false};

View File

@@ -106,11 +106,13 @@ short Filling::mustExecute() const
return 0;
}
void Filling::addConstraints(BRepFill_Filling& builder,
const App::PropertyLinkSubList& edges,
const App::PropertyStringList& faces,
const App::PropertyIntegerList& orders,
Standard_Boolean bnd)
void Filling::addConstraints(
BRepFill_Filling& builder,
const App::PropertyLinkSubList& edges,
const App::PropertyStringList& faces,
const App::PropertyIntegerList& orders,
Standard_Boolean bnd
)
{
auto edge_obj = edges.getValues();
auto edge_sub = edges.getSubValues();
@@ -164,7 +166,8 @@ void Filling::addConstraints(BRepFill_Filling& builder,
}
else {
Standard_Failure::Raise(
"Boundary edges must be added in a consecutive order");
"Boundary edges must be added in a consecutive order"
);
}
}
}
@@ -183,7 +186,8 @@ void Filling::addConstraints(BRepFill_Filling& builder,
}
else {
Standard_Failure::Raise(
"Boundary edges must be added in a consecutive order");
"Boundary edges must be added in a consecutive order"
);
}
}
}
@@ -204,9 +208,11 @@ void Filling::addConstraints(BRepFill_Filling& builder,
}
// Add free support faces with their continuities
void Filling::addConstraints(BRepFill_Filling& builder,
const App::PropertyLinkSubList& faces,
const App::PropertyIntegerList& orders)
void Filling::addConstraints(
BRepFill_Filling& builder,
const App::PropertyLinkSubList& faces,
const App::PropertyIntegerList& orders
)
{
auto face_obj = faces.getValues();
auto face_sub = faces.getSubValues();
@@ -268,20 +274,11 @@ App::DocumentObjectExecReturn* Filling::execute()
unsigned int maxseg = MaximumSegments.getValue();
try {
BRepFill_Filling builder(degree,
ptsoncurve,
numIter,
anisotropy,
tol2d,
tol3d,
tolG1,
tolG2,
maxdeg,
maxseg);
BRepFill_Filling
builder(degree, ptsoncurve, numIter, anisotropy, tol2d, tol3d, tolG1, tolG2, maxdeg, maxseg);
if ((BoundaryEdges.getSize()) < 1) {
return new App::DocumentObjectExecReturn(
"Border must have at least one curve defined.");
return new App::DocumentObjectExecReturn("Border must have at least one curve defined.");
}
// Load the initial surface if set

View File

@@ -43,8 +43,8 @@ public:
Filling();
// Properties of Curves
App::PropertyLinkSubList
BoundaryEdges; // Boundary Edges (C0 is required for edges without a corresponding face)
App::PropertyLinkSubList BoundaryEdges; // Boundary Edges (C0 is required for edges without a
// corresponding face)
App::PropertyStringList BoundaryFaces; // Boundary Faces (C0, G1 and G2 are possible)
App::PropertyIntegerList BoundaryOrder; // Order of constraint on border faces
App::PropertyLinkSubList UnboundEdges; // Unbound constraint edges (C0 is required for edges
@@ -78,14 +78,18 @@ public:
}
private:
void addConstraints(BRepFill_Filling& builder,
const App::PropertyLinkSubList& edges,
const App::PropertyStringList& faces,
const App::PropertyIntegerList& orders,
Standard_Boolean bnd);
void addConstraints(BRepFill_Filling& builder,
const App::PropertyLinkSubList& faces,
const App::PropertyIntegerList& orders);
void addConstraints(
BRepFill_Filling& builder,
const App::PropertyLinkSubList& edges,
const App::PropertyStringList& faces,
const App::PropertyIntegerList& orders,
Standard_Boolean bnd
);
void addConstraints(
BRepFill_Filling& builder,
const App::PropertyLinkSubList& faces,
const App::PropertyIntegerList& orders
);
void addConstraints(BRepFill_Filling& builder, const App::PropertyLinkSubList& points);
};

View File

@@ -77,8 +77,8 @@ void ShapeValidator::checkEdge(const TopoDS_Shape& shape)
Standard_Real u0; // contains output
Standard_Real u1; // contains output
Handle(Geom_Curve) c_geom = BRep_Tool::Curve(etmp, heloc, u0, u1); // The geometric curve
Handle(Geom_BezierCurve) bez_geom =
Handle(Geom_BezierCurve)::DownCast(c_geom); // Try to get Bezier curve
Handle(Geom_BezierCurve) bez_geom = Handle(Geom_BezierCurve)::DownCast(c_geom); // Try to get
// Bezier curve
// if not a Bezier then try to create a B-spline surface from the edges
if (bez_geom.IsNull()) {
@@ -98,9 +98,11 @@ void ShapeValidator::checkAndAdd(const TopoDS_Shape& shape, Handle(ShapeExtend_W
}
}
void ShapeValidator::checkAndAdd(const Part::TopoShape& ts,
const char* subName,
Handle(ShapeExtend_WireData) * aWD)
void ShapeValidator::checkAndAdd(
const Part::TopoShape& ts,
const char* subName,
Handle(ShapeExtend_WireData) * aWD
)
{
try {
if (subName && *subName != '\0') {
@@ -181,7 +183,8 @@ App::DocumentObjectExecReturn* GeomFillSurface::execute()
}
catch (StdFail_NotDone&) {
return new App::DocumentObjectExecReturn(
"A curve was not a B-spline and could not be converted into one.");
"A curve was not a B-spline and could not be converted into one."
);
}
catch (Standard_Failure& e) {
return new App::DocumentObjectExecReturn(e.GetMessageString());
@@ -197,8 +200,7 @@ GeomFill_FillingStyle GeomFillSurface::getFillingStyle()
case GeomFill_CurvedStyle:
return static_cast<GeomFill_FillingStyle>(FillType.getValue());
default:
Standard_Failure::Raise(
"Filling style must be 0 (Stretch), 1 (Coons), or 2 (Curved).\n");
Standard_Failure::Raise("Filling style must be 0 (Stretch), 1 (Coons), or 2 (Curved).\n");
return GeomFill_StretchStyle; // this is to shut up the compiler
}
}
@@ -217,8 +219,7 @@ bool GeomFillSurface::getWire(TopoDS_Wire& aWire)
for (const auto& set : boundary) {
if (set.first->isDerivedFrom<Part::Feature>()) {
for (const auto& jt : set.second) {
const Part::TopoShape& ts =
static_cast<Part::Feature*>(set.first)->Shape.getShape();
const Part::TopoShape& ts = static_cast<Part::Feature*>(set.first)->Shape.getShape();
validator.checkAndAdd(ts, jt.c_str(), &aWD);
}
}
@@ -279,8 +280,8 @@ void GeomFillSurface::createBezierSurface(TopoDS_Wire& aWire)
const TopoDS_Edge hedge = TopoDS::Edge(anExp.Current());
TopLoc_Location heloc; // this will be output
Handle(Geom_Curve) c_geom = BRep_Tool::Curve(hedge, heloc, u1, u2); // The geometric curve
Handle(Geom_BezierCurve) bezier =
Handle(Geom_BezierCurve)::DownCast(c_geom); // Try to get Bezier curve
Handle(Geom_BezierCurve) bezier = Handle(Geom_BezierCurve)::DownCast(c_geom); // Try to get
// Bezier curve
if (!bezier.IsNull()) {
bezier->Segment(u1, u2); // DownCast(c_geom) will not trim bezier, so DIY
@@ -330,8 +331,9 @@ void GeomFillSurface::createBSplineSurface(TopoDS_Wire& aWire)
const TopoDS_Edge& edge = TopoDS::Edge(anExp.Current());
TopLoc_Location heloc; // this will be output
Handle(Geom_Curve) c_geom = BRep_Tool::Curve(edge, heloc, u1, u2); // The geometric curve
Handle(Geom_BSplineCurve) bspline =
Handle(Geom_BSplineCurve)::DownCast(c_geom); // Try to get BSpline curve
Handle(Geom_BSplineCurve) bspline = Handle(Geom_BSplineCurve)::DownCast(
c_geom
); // Try to get BSpline curve
gp_Trsf transf = heloc.Transformation();
if (!bspline.IsNull()) {
@@ -355,11 +357,12 @@ void GeomFillSurface::createBSplineSurface(TopoDS_Wire& aWire)
else {
// GeomConvert failed, try ShapeConstruct_Curve now
ShapeConstruct_Curve scc;
Handle(Geom_BSplineCurve) spline =
scc.ConvertToBSpline(c_geom, u1, u2, Precision::Confusion());
Handle(Geom_BSplineCurve) spline
= scc.ConvertToBSpline(c_geom, u1, u2, Precision::Confusion());
if (spline.IsNull()) {
Standard_Failure::Raise(
"A curve was not a B-spline and could not be converted into one.");
"A curve was not a B-spline and could not be converted into one."
);
}
spline->Transform(transf); // apply original transformation to control points
curves.push_back(spline);

View File

@@ -49,9 +49,11 @@ public:
void initValidator();
void checkEdge(const TopoDS_Shape& shape);
void checkAndAdd(const TopoDS_Shape& shape, Handle(ShapeExtend_WireData) * aWD = nullptr);
void checkAndAdd(const Part::TopoShape& ts,
const char* subName,
Handle(ShapeExtend_WireData) * aWire = nullptr);
void checkAndAdd(
const Part::TopoShape& ts,
const char* subName,
Handle(ShapeExtend_WireData) * aWire = nullptr
);
bool isBezier() const
{

View File

@@ -63,10 +63,11 @@ App::DocumentObjectExecReturn* Sections::execute()
if (!edge.IsNull() && edge.ShapeType() == TopAbs_EDGE) {
BRepAdaptor_Curve curve_adapt(TopoDS::Edge(edge));
const TopLoc_Location& loc = edge.Location();
Handle(Geom_TrimmedCurve) hCurve =
new Geom_TrimmedCurve(curve_adapt.Curve().Curve(),
curve_adapt.FirstParameter(),
curve_adapt.LastParameter());
Handle(Geom_TrimmedCurve) hCurve = new Geom_TrimmedCurve(
curve_adapt.Curve().Curve(),
curve_adapt.FirstParameter(),
curve_adapt.LastParameter()
);
if (!loc.IsIdentity()) {
hCurve->Transform(loc.Transformation());
}

View File

@@ -39,17 +39,9 @@ PROPERTY_SOURCE(Surface::Sewing, Part::Feature)
Sewing::Sewing()
{
ADD_PROPERTY_TYPE(ShapeList, (nullptr, ""), "Sewing", App::Prop_None, "Input shapes");
ADD_PROPERTY_TYPE(Tolerance,
(Precision::Confusion()),
"Sewing",
App::Prop_None,
"Sewing tolerance");
ADD_PROPERTY_TYPE(Tolerance, (Precision::Confusion()), "Sewing", App::Prop_None, "Sewing tolerance");
ADD_PROPERTY_TYPE(SewingOption, (true), "Sewing", App::Prop_None, "Sewing option");
ADD_PROPERTY_TYPE(DegenerateShape,
(true),
"Sewing",
App::Prop_None,
"Analysis of degenerated shapes");
ADD_PROPERTY_TYPE(DegenerateShape, (true), "Sewing", App::Prop_None, "Analysis of degenerated shapes");
ADD_PROPERTY_TYPE(CutFreeEdges, (true), "Sewing", App::Prop_None, "Cutting of free edges");
ADD_PROPERTY_TYPE(Nonmanifold, (false), "Sewing", App::Prop_None, "Non-manifold processing");