const TColStd_Array1OfInteger& aBSplMults = MY_BSPLINE->Multiplicities();
return std::list<int>(aBSplMults.begin(), aBSplMults.end());
}
+
+bool GeomAPI_BSpline::isPeriodic() const
+{
+ return MY_BSPLINE->IsPeriodic();
+}
/// Multiplicities of B-spline knots
GEOMAPI_EXPORT std::list<int> mults() const;
+
+ /// Return \c true if the curve is periodic
+ GEOMAPI_EXPORT bool isPeriodic() const;
};
//! Pointer on the object
%template(PointList) std::list<std::shared_ptr<GeomAPI_Pnt> >;
%template(PointSet) std::set<std::shared_ptr<GeomAPI_Pnt> >;
-// Geometry casts
-%template(shapeToEdge) shared_ptr_cast<GeomAPI_Edge, GeomAPI_Shape>;
-
template<class T1, class T2> std::shared_ptr<T1> shared_ptr_cast(std::shared_ptr<T2> theObject);
%template(featureToPresentation) shared_ptr_cast<GeomAPI_IPresentable, ModelAPI_Feature>;
%include "doxyhelp.i"
// import other modules
+%import "GeomAPI.i"
%import "ModelAPI.i"
%import "ModelHighAPI.i"
#include <SketchPlugin_Arc.h>
#include <SketchPlugin_BSpline.h>
+#include <SketchPlugin_BSplinePeriodic.h>
#include <SketchPlugin_Circle.h>
#include <SketchPlugin_Ellipse.h>
#include <SketchPlugin_EllipticArc.h>
static const std::set<std::string>& BSPLINE_PROJECTION()
{
static std::set<std::string> aProj;
- if (aProj.empty())
+ if (aProj.empty()) {
aProj.insert(SketchPlugin_BSpline::ID());
+ aProj.insert(SketchPlugin_BSplinePeriodic::ID());
+ }
return aProj;
}
const GeomCurvePtr& theCurve,
const GeomPlanePtr& thePlane)
{
- rebuildProjectedFeature(theProjection, BSPLINE_PROJECTION(), SketchPlugin_BSpline::ID());
-
GeomAPI_BSpline aBSpline(theCurve);
+ rebuildProjectedFeature(theProjection, BSPLINE_PROJECTION(),
+ aBSpline.isPeriodic() ? SketchPlugin_BSplinePeriodic::ID() : SketchPlugin_BSpline::ID());
+
theProjection->integer(SketchPlugin_BSpline::DEGREE_ID())->setValue(aBSpline.degree());
AttributePoint2DArrayPtr aPolesAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2DArray>(
self.checkPointOnEllipse(thePoint, anEllipse)
# check angles
TOLERANCE = 1.e-5
- startAngle = 0; startPoint = GeomAPI_Pnt(theArc.startPoint().x(), theArc.startPoint().y(), 0)
- startAngle = anEllipse.parameter(startPoint, TOLERANCE, startAngle)
- endAngle = 0; endPoint = GeomAPI_Pnt(theArc.endPoint().x(), theArc.endPoint().y(), 0)
- endAngle = anEllipse.parameter(endPoint, TOLERANCE, endAngle)
- midAngle = 0; midPoint = GeomAPI_Pnt(thePoint.x(), thePoint.y(), 0)
- midAngle = anEllipse.parameter(midPoint, TOLERANCE, midAngle)
+ startPoint = GeomAPI_Pnt(theArc.startPoint().x(), theArc.startPoint().y(), 0)
+ isCalculated, startAngle = anEllipse.parameter(startPoint, TOLERANCE)
+ endPoint = GeomAPI_Pnt(theArc.endPoint().x(), theArc.endPoint().y(), 0)
+ isCalculated, endAngle = anEllipse.parameter(endPoint, TOLERANCE)
+ midPoint = GeomAPI_Pnt(thePoint.x(), thePoint.y(), 0)
+ isCalculated, midAngle = anEllipse.parameter(midPoint, TOLERANCE)
diffMS = self.toPeriod(midAngle - startAngle)
diffEM = self.toPeriod(endAngle - midAngle)
self.assertAlmostEqual(diffMS, diffEM)
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
-Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10, 180)
-Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_5"))
-SketchCircle_1 = Sketch_1.addCircle(-0.87355746875896, 7.873567272779828, 3.095312696967586)
-model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), [model.selection("SOLID", "Cylinder_1_1")])
-Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_1_1")], model.selection("EDGE", "PartSet/OX"), 45)
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "[Rotation_1_1/MF:Rotated&Cylinder_1_1/Face_1][(Rotation_1_1/MF:Rotated&Cylinder_1_1/Face_1)(Rotation_1_1/MF:Rotated&Cylinder_1_1/Face_5)(Rotation_1_1/MF:Rotated&Cylinder_1_1/Face_4)(Rotation_1_1/MF:Rotated&Cylinder_1_1/Face_3)2]")], False)
+Point_2 = model.addPoint(Part_1_doc, -10, 5, 10)
+Point_3 = model.addPoint(Part_1_doc, -5, 10, 15)
+Point_4 = model.addPoint(Part_1_doc, 10, 0, 20)
+Point_5 = model.addPoint(Part_1_doc, 10, -10, 15)
+Point_6 = model.addPoint(Part_1_doc, -5, -5, 12)
+Interpolation_1_objects = [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2"), model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_4"), model.selection("VERTEX", "Point_5")]
+Interpolation_1 = model.addInterpolation(Part_1_doc, Interpolation_1_objects, False, False)
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Edge_1_1"), True)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Interpolation_1_1"), True)
SketchBSpline_1 = SketchProjection_1.createdFeature()
model.do()
Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
-SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "Edge_1_1"), True)
+SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "Interpolation_1_1"), True)
SketchBSpline_2 = SketchProjection_2.createdFeature()
model.do()
Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
-SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Edge_1_1"), True)
+SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Interpolation_1_1"), True)
SketchBSpline_3 = SketchProjection_3.createdFeature()
model.do()
math.fabs((p2d.z() - p3d.z()) * theFlags.z()) < TOLERANCE)
-bspline0 = GeomAPI_BSpline(GeomAPI_Curve(Edge_1.results()[-1].resultSubShapePair()[0].shape()))
+bspline0 = GeomAPI_BSpline(GeomAPI_Curve(Interpolation_1.results()[-1].resultSubShapePair()[0].shape()))
bsplineShape1 = SketchBSpline_1.results()[-1].resultSubShapePair()[0].shape()
checkProjection(bspline0, bsplineShape1, GeomAPI_Pnt(1, 1, 0))
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
-Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10, 180)
-Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_5"))
-SketchCircle_1 = Sketch_1.addCircle(-0.9379111501048892, 5.54816019935757, 2.957303770750356)
-model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), [model.selection("SOLID", "Cylinder_1_1")])
-Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_1_1")], model.selection("EDGE", "PartSet/OX"), 45)
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "[Rotation_1_1/MF:Rotated&Cylinder_1_1/Face_1][Rotation_1_1/MF:Rotated&Sketch_1/SketchCircle_1_2]")], False)
+Point_2 = model.addPoint(Part_1_doc, -10, 5, 10)
+Point_3 = model.addPoint(Part_1_doc, -5, 10, 15)
+Point_4 = model.addPoint(Part_1_doc, 10, 0, 20)
+Point_5 = model.addPoint(Part_1_doc, 10, -10, 15)
+Point_6 = model.addPoint(Part_1_doc, -5, -5, 12)
+Interpolation_1_objects = [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2"), model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_4"), model.selection("VERTEX", "Point_5")]
+Interpolation_1 = model.addInterpolation(Part_1_doc, Interpolation_1_objects, True, False)
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Edge_1_1"), True)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Interpolation_1_1"), True)
SketchBSpline_1 = SketchProjection_1.createdFeature()
model.do()
Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
-SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "Edge_1_1"), True)
+SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "Interpolation_1_1"), True)
SketchBSpline_2 = SketchProjection_2.createdFeature()
model.do()
Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
-SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Edge_1_1"), True)
+SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Interpolation_1_1"), True)
SketchBSpline_3 = SketchProjection_3.createdFeature()
model.do()
math.fabs((p2d.z() - p3d.z()) * theFlags.z()) < TOLERANCE)
-bspline0 = GeomAPI_BSpline(GeomAPI_Curve(Edge_1.results()[-1].resultSubShapePair()[0].shape()))
+bspline0 = GeomAPI_BSpline(GeomAPI_Curve(Interpolation_1.results()[-1].resultSubShapePair()[0].shape()))
bsplineShape1 = SketchBSpline_1.results()[-1].resultSubShapePair()[0].shape()
checkProjection(bspline0, bsplineShape1, GeomAPI_Pnt(1, 1, 0))