diff --git a/src/Mod/Part/App/Attacher.cpp b/src/Mod/Part/App/Attacher.cpp index cce95345fa..5138333a68 100644 --- a/src/Mod/Part/App/Attacher.cpp +++ b/src/Mod/Part/App/Attacher.cpp @@ -31,6 +31,7 @@ # include # include # include +# include # include # include # include @@ -133,6 +134,8 @@ const char* AttachEngine::eMapModeStrings[]= { "OYZ", "OYX", + "ParallelPlane", + nullptr}; //this list must be in sync with eRefType enum. @@ -1041,6 +1044,11 @@ AttachEngine3D::AttachEngine3D() modeRefTypes[mmObjectXZ] = ss; modeRefTypes[mmObjectYZ] = ss; + modeRefTypes[mmParallelPlane].push_back( + cat(eRefType(rtFlatFace | rtFlagHasPlacement), rtVertex)); + modeRefTypes[mmParallelPlane].push_back( + cat(eRefType(rtAnything | rtFlagHasPlacement), rtVertex)); + modeRefTypes[mmInertialCS].push_back(cat(rtAnything)); modeRefTypes[mmInertialCS].push_back(cat(rtAnything,rtAnything)); modeRefTypes[mmInertialCS].push_back(cat(rtAnything,rtAnything,rtAnything)); @@ -1194,7 +1202,8 @@ AttachEngine3D::_calculateAttachedPlacement(const std::vectortranslate("Attacher3D", "Object's Y Z X","Attachment3D mode caption"), qApp->translate("Attacher3D", "X', Y', Z' axes are matched with object's local Y, Z, X, respectively.","Attachment3D mode tooltip")); + case mmParallelPlane: + return TwoStrings(qApp->translate("Attacher3D", "XY parallel to plane","Attachment3D mode caption"), + qApp->translate("Attacher3D", "X' Y' plane is parallel to the plane (object's XY) and passes through the vertex.","Attachment3D mode tooltip")); case mmFlatFace: return TwoStrings(qApp->translate("Attacher3D", "XY on plane","Attachment3D mode caption"), qApp->translate("Attacher3D", "X' Y' plane is aligned to coincide planar face.","Attachment3D mode tooltip")); @@ -138,6 +141,9 @@ TextSet getUIStrings(Base::Type attacherType, eMapMode mmode) case mmObjectYZ: return TwoStrings(qApp->translate("Attacher2D", "Object's YZ","AttachmentPlane mode caption"), qApp->translate("Attacher2D", "Plane is aligned to YZ local plane of linked object.","AttachmentPlane mode tooltip")); + case mmParallelPlane: + return TwoStrings(qApp->translate("Attacher2D", "XY parallel to plane","AttachmentPlane mode caption"), + qApp->translate("Attacher2D", "X' Y' plane is parallel to the plane (object's XY) and passes through the vertex","AttachmentPlane mode tooltip")); case mmFlatFace: return TwoStrings(qApp->translate("Attacher2D", "Plane face","AttachmentPlane mode caption"), qApp->translate("Attacher2D", "Plane is aligned to coincide planar face.","AttachmentPlane mode tooltip")); diff --git a/tests/src/Mod/Part/App/Attacher.cpp b/tests/src/Mod/Part/App/Attacher.cpp index 53ac4819ee..67b25e466b 100644 --- a/tests/src/Mod/Part/App/Attacher.cpp +++ b/tests/src/Mod/Part/App/Attacher.cpp @@ -171,6 +171,8 @@ TEST_F(AttacherTest, TestAllStringModesValid) "OXZ", "OYZ", "OYX", + + "ParallelPlane", }; int index = 0; for (auto mode : modes) { @@ -197,6 +199,9 @@ TEST_F(AttacherTest, TestAllModesBoundaries) _boxes[1]->recomputeFeature(); EXPECT_TRUE(boxesMatch(_boxes[1]->Shape.getBoundingBox(), Base::BoundBox3d(0, 0, 0, 3, 1, 2))); + _boxes[1]->MapMode.setValue(mmParallelPlane); + _boxes[1]->recomputeFeature(); + EXPECT_TRUE(boxesMatch(_boxes[1]->Shape.getBoundingBox(), Base::BoundBox3d(0, 0, 0, 3, 1, 2))); _boxes[1]->MapMode.setValue(mmFlatFace); _boxes[1]->recomputeFeature(); EXPECT_TRUE(boxesMatch(_boxes[1]->Shape.getBoundingBox(), Base::BoundBox3d(0, 0, 0, 3, 1, 2)));