diff --git a/src/Mod/Part/App/GeometryCurvePy.xml b/src/Mod/Part/App/GeometryCurvePy.xml
index bc2d624548..2efb4fa3dc 100644
--- a/src/Mod/Part/App/GeometryCurvePy.xml
+++ b/src/Mod/Part/App/GeometryCurvePy.xml
@@ -90,6 +90,11 @@ parameterAtDistance([abscissa, startingParameter]) -> Float the
Get intersection points with another curve lying on a plane.
+
+
+ Computes the continuity of two curves
+
+
Returns the parameter on the curve
diff --git a/src/Mod/Part/App/GeometryCurvePyImp.cpp b/src/Mod/Part/App/GeometryCurvePyImp.cpp
index 91e88967a3..0a02449d8f 100644
--- a/src/Mod/Part/App/GeometryCurvePyImp.cpp
+++ b/src/Mod/Part/App/GeometryCurvePyImp.cpp
@@ -43,6 +43,7 @@
# include
# include
# include
+# include
# include
# include
# include
@@ -708,6 +709,84 @@ PyObject* GeometryCurvePy::approximateBSpline(PyObject *args)
}
}
+PyObject* GeometryCurvePy::continuityWith(PyObject *args)
+{
+ double u1 = -1.0, u2 = -1.0;
+ double tl = -1.0, ta = -1.0;
+ PyObject* curve;
+ PyObject* rev1 = Py_False;
+ PyObject* rev2 = Py_False;
+ if (!PyArg_ParseTuple(args, "O!|ddO!O!dd",
+ &GeometryCurvePy::Type, &curve,
+ &u1, &u2,
+ &PyBool_Type, &rev1,
+ &PyBool_Type, &rev2,
+ &tl, &ta))
+ return nullptr;
+
+ Handle(Geom_Geometry) g1 = getGeometryPtr()->handle();
+ Handle(Geom_Curve) c1 = Handle(Geom_Curve)::DownCast(g1);
+ Handle(Geom_Geometry) g2 = static_cast(curve)->getGeomCurvePtr()->handle();
+ Handle(Geom_Curve) c2 = Handle(Geom_Curve)::DownCast(g2);
+
+ // if no parameter value is given then by default use the end of the parameter range
+ if (u1 < 0.0)
+ u1 = c1->LastParameter();
+
+ // if no parameter value is given then by default use the start of the parameter range
+ if (u2 < 0.0)
+ u2 = c2->FirstParameter();
+
+ Standard_Boolean r1 = PyObject_IsTrue(rev1) ? Standard_True : Standard_False;
+ Standard_Boolean r2 = PyObject_IsTrue(rev2) ? Standard_True : Standard_False;
+
+ try {
+ if (!c1.IsNull() && !c2.IsNull()) {
+ GeomAbs_Shape c;
+ if (tl >= 0.0 && ta >= 0.0)
+ c = GeomLProp::Continuity(c1, c2, u1, u2, r1, r2, tl, ta);
+ else
+ c = GeomLProp::Continuity(c1, c2, u1, u2, r1, r2);
+
+ std::string str;
+ switch (c) {
+ case GeomAbs_C0:
+ str = "C0";
+ break;
+ case GeomAbs_G1:
+ str = "G1";
+ break;
+ case GeomAbs_C1:
+ str = "C1";
+ break;
+ case GeomAbs_G2:
+ str = "G2";
+ break;
+ case GeomAbs_C2:
+ str = "C2";
+ break;
+ case GeomAbs_C3:
+ str = "C3";
+ break;
+ case GeomAbs_CN:
+ str = "CN";
+ break;
+ default:
+ str = "Unknown";
+ break;
+ }
+ return Py_BuildValue("s", str.c_str());
+ }
+ }
+ catch (Standard_Failure& e) {
+ PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
+ return 0;
+ }
+
+ PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
+ return 0;
+}
+
Py::String GeometryCurvePy::getContinuity(void) const
{
GeomAbs_Shape c = Handle(Geom_Curve)::DownCast
diff --git a/src/Mod/Part/App/OpenCascadeAll.h b/src/Mod/Part/App/OpenCascadeAll.h
index e7ed8a1810..c12221502a 100644
--- a/src/Mod/Part/App/OpenCascadeAll.h
+++ b/src/Mod/Part/App/OpenCascadeAll.h
@@ -389,6 +389,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/src/Mod/Part/App/TopoShapeEdgePy.xml b/src/Mod/Part/App/TopoShapeEdgePy.xml
index 6dc69dec92..770b4e76f7 100644
--- a/src/Mod/Part/App/TopoShapeEdgePy.xml
+++ b/src/Mod/Part/App/TopoShapeEdgePy.xml
@@ -522,7 +522,13 @@ coordinate system.
-
+
+
+ Returns the continuity
+
+
+
+
diff --git a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp
index 0ce6e0babe..bee42e6612 100644
--- a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp
+++ b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp
@@ -747,6 +747,37 @@ PyObject* TopoShapeEdgePy::lastVertex(PyObject *args)
// ====== Attributes ======================================================================
+Py::String TopoShapeEdgePy::getContinuity() const
+{
+ BRepAdaptor_Curve adapt(TopoDS::Edge(getTopoShapePtr()->getShape()));
+ std::string cont;
+ switch (adapt.Continuity()) {
+ case GeomAbs_C0:
+ cont = "C0";
+ break;
+ case GeomAbs_G1:
+ cont = "G1";
+ break;
+ case GeomAbs_C1:
+ cont = "C1";
+ break;
+ case GeomAbs_G2:
+ cont = "G2";
+ break;
+ case GeomAbs_C2:
+ cont = "C2";
+ break;
+ case GeomAbs_C3:
+ cont = "C3";
+ break;
+ case GeomAbs_CN:
+ cont = "CN";
+ break;
+ }
+
+ return Py::String(cont);
+}
+
Py::Float TopoShapeEdgePy::getTolerance(void) const
{
const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape());
diff --git a/src/Mod/Part/App/TopoShapeWirePy.xml b/src/Mod/Part/App/TopoShapeWirePy.xml
index 96c37f4318..4d4eb5b663 100644
--- a/src/Mod/Part/App/TopoShapeWirePy.xml
+++ b/src/Mod/Part/App/TopoShapeWirePy.xml
@@ -158,6 +158,12 @@ coordinate system.
+
+
+ Returns the continuity
+
+
+
List of ordered vertexes in this shape.
diff --git a/src/Mod/Part/App/TopoShapeWirePyImp.cpp b/src/Mod/Part/App/TopoShapeWirePyImp.cpp
index 5522896ec8..24abdf2cf1 100644
--- a/src/Mod/Part/App/TopoShapeWirePyImp.cpp
+++ b/src/Mod/Part/App/TopoShapeWirePyImp.cpp
@@ -528,6 +528,37 @@ PyObject* TopoShapeWirePy::discretize(PyObject *args, PyObject *kwds)
return 0;
}
+Py::String TopoShapeWirePy::getContinuity() const
+{
+ BRepAdaptor_CompCurve adapt(TopoDS::Wire(getTopoShapePtr()->getShape()));
+ std::string cont;
+ switch (adapt.Continuity()) {
+ case GeomAbs_C0:
+ cont = "C0";
+ break;
+ case GeomAbs_G1:
+ cont = "G1";
+ break;
+ case GeomAbs_C1:
+ cont = "C1";
+ break;
+ case GeomAbs_G2:
+ cont = "G2";
+ break;
+ case GeomAbs_C2:
+ cont = "C2";
+ break;
+ case GeomAbs_C3:
+ cont = "C3";
+ break;
+ case GeomAbs_CN:
+ cont = "CN";
+ break;
+ }
+
+ return Py::String(cont);
+}
+
Py::Object TopoShapeWirePy::getMass(void) const
{
GProp_GProps props;