[Sketcher] Add tests for split and trim
Includes: * Tests for splitting and trimming of various types of curves * Assertions on constraints expected to be added on these curves
This commit is contained in:
@@ -6967,6 +6967,39 @@ int SketchObject::deleteUnusedInternalGeometry(int GeoId, bool delgeoid)
|
||||
}
|
||||
}
|
||||
|
||||
int SketchObject::deleteUnusedInternalGeometryAndUpdateGeoId(int& GeoId, bool delgeoid)
|
||||
{
|
||||
const Part::Geometry* geo = getGeometry(GeoId);
|
||||
|
||||
if (!hasInternalGeometry(geo)) {
|
||||
return -1;
|
||||
}
|
||||
// We need to remove the internal geometry of the BSpline, as BSplines change in number
|
||||
// of poles and knots We save the tags of the relevant geometry to retrieve the new
|
||||
// GeoIds later on.
|
||||
boost::uuids::uuid GeoIdTag;
|
||||
|
||||
GeoIdTag = geo->getTag();
|
||||
|
||||
int returnValue = deleteUnusedInternalGeometry(GeoId, delgeoid);
|
||||
|
||||
if (delgeoid) {
|
||||
GeoId = GeoEnum::GeoUndef;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
auto vals = getCompleteGeometry();
|
||||
|
||||
for (size_t i = 0; i < vals.size(); i++) {
|
||||
if (vals[i]->getTag() == GeoIdTag) {
|
||||
GeoId = getGeoIdFromCompleteGeometryIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
bool SketchObject::convertToNURBS(int GeoId)
|
||||
{
|
||||
// no need to check input data validity as this is an sketchobject managed operation.
|
||||
|
||||
@@ -460,6 +460,14 @@ public:
|
||||
geometry \retval int - returns -1 on error, otherwise the number of deleted elements
|
||||
*/
|
||||
int deleteUnusedInternalGeometry(int GeoId, bool delgeoid = false);
|
||||
/*!
|
||||
\brief Same as `deleteUnusedInternalGeometry`, but changes `GeoId` to the new Id of the
|
||||
geometry, or to `GeoEnum::GeoUndef` if the geometry is deleted as well. \param GeoId - the
|
||||
geometry having the internal geometry to delete \param delgeoid - if true in addition to the
|
||||
unused internal geometry also deletes the GeoId geometry \retval int - returns -1 on error,
|
||||
otherwise the number of deleted elements
|
||||
*/
|
||||
int deleteUnusedInternalGeometryAndUpdateGeoId(int& GeoId, bool delgeoid = false);
|
||||
/*!
|
||||
\brief Approximates the given geometry with a B-spline
|
||||
\param GeoId - the geometry to approximate
|
||||
|
||||
Reference in New Issue
Block a user