From 7a578069ba4baeadaeef5a3811892b0b0a849b5c Mon Sep 17 00:00:00 2001 From: asozinov Date: Wed, 15 Nov 2023 16:48:46 +0000 Subject: [PATCH] XXXXX --- src/SketchPlugin/SketchPlugin_Circle.cpp | 10 ++++++---- src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp | 9 +++++++-- src/SketchPlugin/SketchPlugin_MacroCircle.cpp | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_Circle.cpp b/src/SketchPlugin/SketchPlugin_Circle.cpp index ca1059f55..9fa234635 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.cpp +++ b/src/SketchPlugin/SketchPlugin_Circle.cpp @@ -70,7 +70,7 @@ void SketchPlugin_Circle::initDerivedClassAttributes() ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), ANGLE_ID()); } -/*static FeaturePtr CreatePoint(FeaturePtr theCircleFeature, SketchPlugin_Sketch* theSketch, +static FeaturePtr CreatePoint(FeaturePtr theCircleFeature, SketchPlugin_Sketch* theSketch, GeomPnt2dPtr thePoint) { // create point at sewing point of circle @@ -82,7 +82,7 @@ void SketchPlugin_Circle::initDerivedClassAttributes() aCoord->setValue(thePoint); aPointFeature->execute(); return aPointFeature; -}*/ +} void SketchPlugin_Circle::execute() { @@ -132,8 +132,10 @@ void SketchPlugin_Circle::execute() aResult->setIsInHistory(false); setResult(aResult, 1); - /*if (!reference(ROTATE_REF_ID())->value()) + if (!reference(ROTATE_REF_ID())->value()) { + //this->keepCurrentFeature(); + //this->restoreCurrentFeature(); aWasBlocked = data()->blockSendAttributeUpdated(true); auto aCurCircle = this->document()->currentFeature(true); auto aCrPoint = CreatePoint(aCurCircle, sketch(), std::dynamic_pointer_cast(data()->attribute(ROTATE_ID()))->pnt()); @@ -142,7 +144,7 @@ void SketchPlugin_Circle::execute() aCrPoint->boolean(AUXILIARY_ID())->setValue(boolean(AUXILIARY_ID())->value()); reference(SketchPlugin_Circle::ROTATE_REF_ID())->setValue(aCrPoint); data()->blockSendAttributeUpdated(aWasBlocked, false); - }*/ + } } bool SketchPlugin_Circle::isFixed() { diff --git a/src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp b/src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp index 9d478833b..a563a4467 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -73,11 +74,11 @@ void SketchPlugin_ConstraintMiddle::CreatePoint() void SketchPlugin_ConstraintMiddle::initAttributes() { - data()->addAttribute(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE(), ModelAPI_AttributeString::typeId()); + data()->string(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE())->setValue(SketchPlugin_ConstraintMiddle::MIDDLE_TYPE_BY_LINE_AND_POINT()); data()->addAttribute(POINT_REF_ID(), GeomDataAPI_Point2D::typeId()); ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), POINT_REF_ID()); @@ -98,6 +99,10 @@ void SketchPlugin_ConstraintMiddle::execute() if (!attribute(ENTITY_B())->isInitialized()) CreatePoint(); // Create new point + std::cout << attribute(ENTITY_A())->attributeType() << std::endl; + std::cout << refattr(ENTITY_A())->attributeType() << std::endl; + std::wcout << refattr(ENTITY_A())->object()->data()->name() << std::endl; + std::cout << refattr(ENTITY_A())->attr() << std::endl; } } diff --git a/src/SketchPlugin/SketchPlugin_MacroCircle.cpp b/src/SketchPlugin/SketchPlugin_MacroCircle.cpp index 3cc52b32c..c9ea40477 100644 --- a/src/SketchPlugin/SketchPlugin_MacroCircle.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroCircle.cpp @@ -301,7 +301,7 @@ FeaturePtr SketchPlugin_MacroCircle::createCircleFeature() aCircleFeature->execute(); // Create point - FeaturePtr aNPoint = CreatePoint(aCircleFeature, myRotPoint); + //FeaturePtr aNPoint = CreatePoint(aCircleFeature, myRotPoint); return aCircleFeature; } -- 2.39.2