Improve the orientation of the curve projected onto sketch plane.
ENDIF(EXISTS ${aTestFileName})
endforeach(eachFileName ${ARGN})
ENDMACRO(ADD_UNIT_TESTS_API)
+
+
+function(ADD_RESTRICTED_TESTS)
+ SET(RESTRICTED_ROOT_DIR $ENV{RESTRICTED_ROOT_DIR} CACHE PATH "Path to the restricted repository")
+
+ if (NOT EXISTS ${RESTRICTED_ROOT_DIR})
+ message(WARNING "RESTRICTED_ROOT_DIR is not specified to run restricted tests")
+ return()
+ endif()
+
+ if (WIN32) # different separators and path to libraries variable name
+ SET(_JUSTPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${SUIT_LIB_DIR};${SALOME_KERNEL_LIBDIR};$ENV{PATH}")
+ STRING(REPLACE "\\" "/" _JUSTPATH "${_JUSTPATH}")
+ STRING(REPLACE ";" "\\;" _JUSTPATH "${_JUSTPATH}")
+ SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS};$ENV{PYTHONPATH}")
+ STRING(REPLACE "\\" "/" _PYTHONPATH "${_PYTHONPATH}")
+ STRING(REPLACE ";" "\\;" _PYTHONPATH "${_PYTHONPATH}")
+ else()
+ SET(_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${SUIT_LIB_DIR}:${SALOME_KERNEL_LIBDIR}:$ENV{LD_LIBRARY_PATH}")
+ SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS}:$ENV{PYTHONPATH}")
+ endif()
+
+ foreach(eachFileName ${ARGN})
+ # Strip the ".py" suffix
+ GET_FILENAME_COMPONENT(aTestName ${eachFileName} NAME_WE)
+
+ # Add "SubprojectName_" prefix
+ GET_FILENAME_COMPONENT(aSubprojectName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+ SET(aTestName "${aSubprojectName}_${aTestName}")
+
+ # Full path to the python test file beeing executed
+ SET(aTestFileName "${RESTRICTED_ROOT_DIR}/SHAPER/bugs/${eachFileName}")
+ IF(EXISTS ${aTestFileName})
+ ADD_TEST(NAME ${aTestName}
+ COMMAND ${PYTHON_EXECUTABLE} ${aTestFileName})
+ if (WIN32) # different path to libraries variable name
+ SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
+ ENVIRONMENT "PATH=${_JUSTPATH};PYTHONPATH=${_PYTHONPATH};SHAPER_UNIT_TEST_IN_PROGRESS=1"
+ LABELS "${aSubprojectName}")
+ else()
+ SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
+ ENVIRONMENT "LD_LIBRARY_PATH=${_LD_LIBRARY_PATH};PYTHONPATH=${_PYTHONPATH};SHAPER_UNIT_TEST_IN_PROGRESS=1"
+ LABELS "${aSubprojectName}")
+ endif()
+ # Debug output...
+ #MESSAGE(STATUS "Test added: ${aTestName} file: ${aTestFileName}")
+ ELSE(EXISTS ${aTestFileName})
+ MESSAGE(WARNING "Can not find the test file: ${aTestFileName}")
+ ENDIF(EXISTS ${aTestFileName})
+ endforeach(eachFileName ${ARGN})
+endfunction(ADD_RESTRICTED_TESTS)
TestMovePoint.py
)
endif()
+
+ADD_RESTRICTED_TESTS(
+ Test20204.py
+)
\ No newline at end of file
if (aProjectedCurve->isCircle()) {
if (aProjectedCurve->isTrimmed()) {
// ARC is a projection
- isOk = fillArc(theProjection, aProjectedCurve, aSketchPlane);
+ isOk = fillArc(theProjection, aProjectedCurve, aSketchPlane, theEdge);
}
else {
// CIRCLE is a projection
else if (aProjectedCurve->isEllipse()) {
if (aProjectedCurve->isTrimmed()) {
// ELLIPTIC ARC is a projection
- isOk = fillEllipticArc(theProjection, aProjectedCurve, aSketchPlane);
+ isOk = fillEllipticArc(theProjection, aProjectedCurve, aSketchPlane, theEdge);
}
else {
// ELLIPSE is a projection
bool SketchPlugin_Projection::fillArc(FeaturePtr& theProjection,
const GeomCurvePtr& theArc,
- const GeomPlanePtr& thePlane)
+ const GeomPlanePtr& thePlane,
+ const GeomEdgePtr& theOriginalEdge)
{
rebuildProjectedFeature(theProjection, ARC_PROJECTION(), SketchPlugin_Arc::ID());
bool isInversed = aNormalsDot < 0.;
+ GeomCirclePtr anOriginalCircle = theOriginalEdge->circle();
+ if (anOriginalCircle) {
+ double aCirclesDot = anOriginalCircle->normal()->dot(aCircle.normal());
+ if (aCirclesDot < 0.)
+ isInversed = !isInversed;
+ }
+
GeomPointPtr aCenter = thePlane->project(aCircle.center());
GeomPnt2dPtr aCenterInSketch = sketch()->to2D(aCenter);
bool SketchPlugin_Projection::fillEllipticArc(FeaturePtr& theProjection,
const GeomCurvePtr& theEllipticArc,
- const GeomPlanePtr& thePlane)
+ const GeomPlanePtr& thePlane,
+ const GeomEdgePtr& theOriginalEdge)
{
rebuildProjectedFeature(theProjection, ARC_PROJECTION(), SketchPlugin_EllipticArc::ID());
bool isInversed = aNormalsDot < 0.;
+ GeomEllipsePtr anOriginalEllipse = theOriginalEdge->ellipse();
+ if (anOriginalEllipse) {
+ double anEllipsesDot = anOriginalEllipse->normal()->dot(anEllipse.normal());
+ if (anEllipsesDot < 0.)
+ isInversed = !isInversed;
+ }
+
GeomPointPtr aCenter = thePlane->project(anEllipse.center());
GeomPnt2dPtr aCenterInSketch = sketch()->to2D(aCenter);
GeomPointPtr aFocus = thePlane->project(anEllipse.firstFocus());
/// \brief Fill attributes of the Arc feature
bool fillArc(FeaturePtr& theProjection,
const std::shared_ptr<GeomAPI_Curve>& theArc,
- const std::shared_ptr<GeomAPI_Pln>& thePlane);
+ const std::shared_ptr<GeomAPI_Pln>& thePlane,
+ const std::shared_ptr<GeomAPI_Edge>& theOriginalEdge);
/// \brief Fill attributes of the Circle feature
bool fillCircle(FeaturePtr& theProjection,
const std::shared_ptr<GeomAPI_Curve>& theCircle,
/// \brief Fill attributes of the EllipticArc feature
bool fillEllipticArc(FeaturePtr& theProjection,
const std::shared_ptr<GeomAPI_Curve>& theEllipticArc,
- const std::shared_ptr<GeomAPI_Pln>& thePlane);
+ const std::shared_ptr<GeomAPI_Pln>& thePlane,
+ const std::shared_ptr<GeomAPI_Edge>& theOriginalEdge);
/// \brief Fill attributes of the B-spline feature
bool fillBSpline(FeaturePtr& theProjection,
const std::shared_ptr<GeomAPI_Curve>& theCurve,