From 255f0e1ac84783551347b66f395cd6609944cc5e Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 17 Jan 2017 09:05:25 +0300 Subject: [PATCH] #1964 Splitting an auxiliary line gives a non auxiliary line --- .../SketchPlugin_ConstraintSplit.cpp | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp b/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp index fcde94254..d2f64ddea 100755 --- a/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -1146,13 +1147,25 @@ void SketchPlugin_ConstraintSplit::arrangePointsOnArc( void SketchPlugin_ConstraintSplit::fillAttribute(const AttributePtr& theModifiedAttribute, const AttributePtr& theSourceAttribute) { - AttributePoint2DPtr aModifiedAttribute = std::dynamic_pointer_cast( - theModifiedAttribute); - AttributePoint2DPtr aSourceAttribute = std::dynamic_pointer_cast( - theSourceAttribute); - - if (aModifiedAttribute.get() && aSourceAttribute.get()) - aModifiedAttribute->setValue(aSourceAttribute->pnt()); + std::string anAttributeType = theModifiedAttribute->attributeType(); + if (anAttributeType == GeomDataAPI_Point2D::typeId()) { + AttributePoint2DPtr aModifiedAttribute = std::dynamic_pointer_cast( + theModifiedAttribute); + AttributePoint2DPtr aSourceAttribute = std::dynamic_pointer_cast( + theSourceAttribute); + + if (aModifiedAttribute.get() && aSourceAttribute.get()) + aModifiedAttribute->setValue(aSourceAttribute->pnt()); + } + else if (anAttributeType == ModelAPI_AttributeBoolean::typeId()) { + AttributeBooleanPtr aModifiedAttribute = std::dynamic_pointer_cast( + theModifiedAttribute); + AttributeBooleanPtr aSourceAttribute = std::dynamic_pointer_cast( + theSourceAttribute); + + if (aModifiedAttribute.get() && aSourceAttribute.get()) + aModifiedAttribute->setValue(aSourceAttribute->value()); + } } FeaturePtr SketchPlugin_ConstraintSplit::createLineFeature(const FeaturePtr& theBaseFeature, @@ -1168,6 +1181,10 @@ FeaturePtr SketchPlugin_ConstraintSplit::createLineFeature(const FeaturePtr& the fillAttribute(aFeature->attribute(SketchPlugin_Line::START_ID()), theFirstPointAttr); fillAttribute(aFeature->attribute(SketchPlugin_Line::END_ID()), theSecondPointAttr); + + fillAttribute(aFeature->attribute(SketchPlugin_SketchEntity::AUXILIARY_ID()), + theBaseFeature->attribute(SketchPlugin_SketchEntity::AUXILIARY_ID())); + aFeature->execute(); // to obtain result return aFeature; @@ -1205,6 +1222,9 @@ FeaturePtr SketchPlugin_ConstraintSplit::createArcFeature(const FeaturePtr& theB fillAttribute(aFeature->attribute(SketchPlugin_Arc::START_ID()), theFirstPointAttr); fillAttribute(aFeature->attribute(SketchPlugin_Arc::END_ID()), theSecondPointAttr); + fillAttribute(aFeature->attribute(SketchPlugin_SketchEntity::AUXILIARY_ID()), + theBaseFeature->attribute(SketchPlugin_SketchEntity::AUXILIARY_ID())); + /// fill referersed state of created arc as it is on the base arc if (theBaseFeature->getKind() == SketchPlugin_Arc::ID()) { bool aReversed = theBaseFeature->boolean(SketchPlugin_Arc::INVERSED_ID())->value(); -- 2.39.2