From: dbv Date: Mon, 20 Mar 2017 07:29:31 +0000 (+0300) Subject: Issue #2024: Redesign of circle and arc of circle X-Git-Tag: V_2.7.0~194 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bd953380ed26bbef84337e8b2148d930969b5abe;p=modules%2Fshaper.git Issue #2024: Redesign of circle and arc of circle Redesigned circle creation. Now Circle feature is a macro which creates Circle feature with center and radius attributes. --- diff --git a/src/GeomData/GeomData_Point2D.cpp b/src/GeomData/GeomData_Point2D.cpp index 30b47115d..ced572f4e 100644 --- a/src/GeomData/GeomData_Point2D.cpp +++ b/src/GeomData/GeomData_Point2D.cpp @@ -29,6 +29,14 @@ void GeomData_Point2D::reinit() } } +void GeomData_Point2D::reset() +{ + myIsInitialized = false; + for(int aComponent = 0; aComponent < NUM_COMPONENTS; ++aComponent) { + myExpression[aComponent]->reset(); + } +} + void GeomData_Point2D::setCalculatedValue(const double theX, const double theY) { if (!myIsInitialized || x() != theX || y() != theY) { diff --git a/src/GeomData/GeomData_Point2D.h b/src/GeomData/GeomData_Point2D.h index a4864c6c4..3bb62e8a0 100644 --- a/src/GeomData/GeomData_Point2D.h +++ b/src/GeomData/GeomData_Point2D.h @@ -72,6 +72,9 @@ class GeomData_Point2D : public GeomDataAPI_Point2D /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) virtual void reinit(); + /// Resets attribute to deafult state. + virtual void reset(); + friend class Model_Data; }; diff --git a/src/Model/Model_AttributeDouble.cpp b/src/Model/Model_AttributeDouble.cpp index 4efa7bedc..1e942faa6 100644 --- a/src/Model/Model_AttributeDouble.cpp +++ b/src/Model/Model_AttributeDouble.cpp @@ -24,6 +24,12 @@ void Model_AttributeDouble::reinit() myIsInitialized = myExpression->isInitialized(); } +void Model_AttributeDouble::reset() +{ + myExpression->reset(); + myIsInitialized = false; +} + void Model_AttributeDouble::setCalculatedValue(const double theValue) { if (!myIsInitialized || value() != theValue) { diff --git a/src/Model/Model_AttributeDouble.h b/src/Model/Model_AttributeDouble.h index 883b9b545..17b82ea65 100644 --- a/src/Model/Model_AttributeDouble.h +++ b/src/Model/Model_AttributeDouble.h @@ -63,6 +63,9 @@ class Model_AttributeDouble : public ModelAPI_AttributeDouble /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) virtual void reinit(); + /// Resets attribute to deafult state. + virtual void reset(); + friend class Model_Data; }; diff --git a/src/ModelAPI/ModelAPI_Attribute.cpp b/src/ModelAPI/ModelAPI_Attribute.cpp index 97373a087..69465bf61 100644 --- a/src/ModelAPI/ModelAPI_Attribute.cpp +++ b/src/ModelAPI/ModelAPI_Attribute.cpp @@ -85,3 +85,5 @@ void ModelAPI_Attribute::setID(const std::string theID) } void ModelAPI_Attribute::reinit() {} + +void ModelAPI_Attribute::reset() {} diff --git a/src/ModelAPI/ModelAPI_Attribute.h b/src/ModelAPI/ModelAPI_Attribute.h index 1ea1523b7..ba23fe9e7 100644 --- a/src/ModelAPI/ModelAPI_Attribute.h +++ b/src/ModelAPI/ModelAPI_Attribute.h @@ -73,6 +73,9 @@ class ModelAPI_Attribute /// ID of the attribute in Data MODELAPI_EXPORT const std::string& id() const; + /// Resets attribute to deafult state. + MODELAPI_EXPORT virtual void reset(); + protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_Attribute(); diff --git a/src/ModelAPI/ModelAPI_Expression.h b/src/ModelAPI/ModelAPI_Expression.h index fd00670cc..769a4eebc 100644 --- a/src/ModelAPI/ModelAPI_Expression.h +++ b/src/ModelAPI/ModelAPI_Expression.h @@ -62,6 +62,10 @@ class ModelAPI_Expression MODELAPI_EXPORT ModelAPI_Expression(); /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) MODELAPI_EXPORT virtual void reinit() = 0; + /// Resets attribute to deafult state. + MODELAPI_EXPORT virtual void reset() { + myIsInitialized = false; + }; bool myIsInitialized; ///< is some value assigned to this attribute diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp index 3cbc1cc5d..36ae78513 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include @@ -599,9 +599,9 @@ bool PartSet_SketcherReetntrantMgr::copyReetntrantAttributes(const FeaturePtr& t aSFData->attribute(SketchPlugin_Line::END_ID())); aNPoint->setValue(aSPoint->x(), aSPoint->y()); } - else if (aFeatureKind == SketchPlugin_Circle::ID()) { + else if (aFeatureKind == SketchPlugin_MacroCircle::ID()) { // set circle type - std::string aTypeAttributeId = SketchPlugin_Circle::CIRCLE_TYPE(); + std::string aTypeAttributeId = SketchPlugin_MacroCircle::CIRCLE_TYPE(); AttributeStringPtr aSourceFeatureTypeAttr = theSourceFeature->data()->string(aTypeAttributeId); AttributeStringPtr aNewFeatureTypeAttr = theNewFeature->data()->string(aTypeAttributeId); aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value()); diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index 03995e897..2a8d1a0aa 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -67,6 +67,8 @@ const double MaxCoordinate = 1e12; static QStringList MyFeaturesForCoincedence; +#define DEBUG_SELECTION + PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, const Config_WidgetAPI* theData) @@ -572,7 +574,9 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo bool isAuxiliaryFeature = false; if (getPoint2d(aView, aShape, aX, aY)) { setPoint(aX, aY); +#ifndef DEBUG_SELECTION feature()->execute(); +#endif setConstraintToPoint(aX, aY); } @@ -780,7 +784,11 @@ bool PartSet_WidgetPoint2D::shapeContainsPoint(const GeomShapePtr& theShape, if (aVertex.get()) aContainPoint = aPoint->isEqual(aVertex->point()); } +#ifdef DEBUG_SELECTION + return true; +#else return aContainPoint; +#endif } AttributeRefAttrPtr PartSet_WidgetPoint2D::attributeRefAttr() const diff --git a/src/SketchAPI/CMakeLists.txt b/src/SketchAPI/CMakeLists.txt index 18db87fc5..0b8b8914a 100644 --- a/src/SketchAPI/CMakeLists.txt +++ b/src/SketchAPI/CMakeLists.txt @@ -9,6 +9,7 @@ SET(PROJECT_HEADERS SketchAPI_Constraint.h SketchAPI_IntersectionPoint.h SketchAPI_Line.h + SketchAPI_MacroCircle.h SketchAPI_Mirror.h SketchAPI_Sketch.h SketchAPI_SketchEntity.h @@ -25,6 +26,7 @@ SET(PROJECT_SOURCES SketchAPI_Constraint.cpp SketchAPI_IntersectionPoint.cpp SketchAPI_Line.cpp + SketchAPI_MacroCircle.cpp SketchAPI_Mirror.cpp SketchAPI_Sketch.cpp SketchAPI_SketchEntity.cpp diff --git a/src/SketchAPI/SketchAPI.i b/src/SketchAPI/SketchAPI.i index 6bc6cf6c6..c5ceee14d 100644 --- a/src/SketchAPI/SketchAPI.i +++ b/src/SketchAPI/SketchAPI.i @@ -27,6 +27,7 @@ // shared pointers %shared_ptr(SketchAPI_Arc) %shared_ptr(SketchAPI_Circle) +%shared_ptr(SketchAPI_MacroCircle) %shared_ptr(SketchAPI_Constraint) %shared_ptr(SketchAPI_IntersectionPoint) %shared_ptr(SketchAPI_Line) @@ -207,6 +208,7 @@ %include "SketchAPI_IntersectionPoint.h" %include "SketchAPI_Line.h" %include "SketchAPI_Circle.h" +%include "SketchAPI_MacroCircle.h" %include "SketchAPI_Arc.h" %include "SketchAPI_Projection.h" %include "SketchAPI_Mirror.h" diff --git a/src/SketchAPI/SketchAPI_Circle.cpp b/src/SketchAPI/SketchAPI_Circle.cpp index 9cac0bd31..ddb26aef5 100644 --- a/src/SketchAPI/SketchAPI_Circle.cpp +++ b/src/SketchAPI/SketchAPI_Circle.cpp @@ -43,30 +43,6 @@ SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr& theF } } -//================================================================================================== -SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr& theFeature, - double theX1, double theY1, - double theX2, double theY2, - double theX3, double theY3) -: SketchAPI_SketchEntity(theFeature) -{ - if (initialize()) { - setByThreePoints(theX1, theY1, theX2, theY2, theX3, theY3); - } -} - -//================================================================================================== -SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr& theFeature, - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3) -: SketchAPI_SketchEntity(theFeature) -{ - if (initialize()) { - setByThreePoints(thePoint1, thePoint2, thePoint3); - } -} - //================================================================================================== SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr& theFeature, const ModelHighAPI_Selection& theExternal) @@ -96,7 +72,6 @@ SketchAPI_Circle::~SketchAPI_Circle() //================================================================================================== void SketchAPI_Circle::setByCenterAndRadius(double theCenterX, double theCenterY, double theRadius) { - fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType); fillAttribute(center(), theCenterX, theCenterY); fillAttribute(theRadius, myradius); @@ -107,39 +82,12 @@ void SketchAPI_Circle::setByCenterAndRadius(double theCenterX, double theCenterY void SketchAPI_Circle::setByCenterAndRadius(const std::shared_ptr& theCenter, double theRadius) { - fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType); fillAttribute(theCenter, mycenter); fillAttribute(theRadius, myradius); execute(); } -//================================================================================================== -void SketchAPI_Circle::setByThreePoints(double theX1, double theY1, - double theX2, double theY2, - double theX3, double theY3) -{ - fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType); - fillAttribute(firstPoint(), theX1, theY1); - fillAttribute(secondPoint(), theX2, theY2); - fillAttribute(thirdPoint(), theX3, theY3); - - execute(); -} - -//================================================================================================== -void SketchAPI_Circle::setByThreePoints(const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3) -{ - fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType); - fillAttribute(thePoint1, myfirstPoint); - fillAttribute(thePoint2, mysecondPoint); - fillAttribute(thePoint3, mythirdPoint); - - execute(); -} - //================================================================================================== void SketchAPI_Circle::setByExternal(const ModelHighAPI_Selection & theExternal) { @@ -159,7 +107,6 @@ void SketchAPI_Circle::setByExternalName(const std::string & theExternalName) //================================================================================================== void SketchAPI_Circle::setCenter(double theX, double theY) { - fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType); fillAttribute(center(), theX, theY); execute(); @@ -168,7 +115,6 @@ void SketchAPI_Circle::setCenter(double theX, double theY) //================================================================================================== void SketchAPI_Circle::setCenter(const std::shared_ptr & theCenter) { - fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType); fillAttribute(theCenter, mycenter); execute(); @@ -177,66 +123,11 @@ void SketchAPI_Circle::setCenter(const std::shared_ptr & theCente //================================================================================================== void SketchAPI_Circle::setRadius(double theRadius) { - fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType); fillAttribute(ModelHighAPI_Double(theRadius), myradius); execute(); } -//================================================================================================== -void SketchAPI_Circle::setFirstPoint(double theX, double theY) -{ - fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType); - fillAttribute(firstPoint(), theX, theY); - - execute(); -} - -//================================================================================================== -void SketchAPI_Circle::setFirstPoint(const std::shared_ptr& thePoint) -{ - fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType); - fillAttribute(thePoint, myfirstPoint); - - execute(); -} - -//================================================================================================== -void SketchAPI_Circle::setSecondPoint(double theX, double theY) -{ - fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType); - fillAttribute(secondPoint(), theX, theY); - - execute(); -} - -//================================================================================================== -void SketchAPI_Circle::setSecondPoint(const std::shared_ptr& thePoint) -{ - fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType); - fillAttribute(thePoint, mysecondPoint); - - execute(); -} - -//================================================================================================== -void SketchAPI_Circle::setThirdPoint(double theX, double theY) -{ - fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType); - fillAttribute(thirdPoint(), theX, theY); - - execute(); -} - -//================================================================================================== -void SketchAPI_Circle::setThirdPoint(const std::shared_ptr& thePoint) -{ - fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType); - fillAttribute(thePoint, mythirdPoint); - - execute(); -} - //================================================================================================== void SketchAPI_Circle::dump(ModelHighAPI_Dumper& theDumper) const { @@ -251,16 +142,9 @@ void SketchAPI_Circle::dump(ModelHighAPI_Dumper& theDumper) const // circle is external theDumper << aBase << " = " << aSketchName << ".addCircle(" << anExternal << ")" << std::endl; } else { - AttributeStringPtr aType = circleType(); - if (aType->value() == SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS()) { - // circle given by center and radius - theDumper << aBase << " = " << aSketchName << ".addCircle(" - << center() << ", " << radius() << ")" << std::endl; - } else { - // circle given by three points - theDumper << aBase << " = " << aSketchName << ".addCircle(" << firstPoint() << ", " - << secondPoint() << ", " << thirdPoint() << ")" << std::endl; - } + // circle given by center and radius + theDumper << aBase << " = " << aSketchName << ".addCircle(" + << center() << ", " << radius() << ")" << std::endl; } // dump "auxiliary" flag if necessary SketchAPI_SketchEntity::dump(theDumper); diff --git a/src/SketchAPI/SketchAPI_Circle.h b/src/SketchAPI/SketchAPI_Circle.h index 99e0aefc1..fe5e5f473 100644 --- a/src/SketchAPI/SketchAPI_Circle.h +++ b/src/SketchAPI/SketchAPI_Circle.h @@ -37,20 +37,6 @@ public: const std::shared_ptr& theCenter, double theRadius); - /// Constructor with values. - SKETCHAPI_EXPORT - SketchAPI_Circle(const std::shared_ptr& theFeature, - double theX1, double theY1, - double theX2, double theY2, - double theX3, double theY3); - - /// Constructor with values. - SKETCHAPI_EXPORT - SketchAPI_Circle(const std::shared_ptr& theFeature, - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3); - /// Constructor with values. SKETCHAPI_EXPORT SketchAPI_Circle(const std::shared_ptr& theFeature, @@ -65,19 +51,11 @@ public: SKETCHAPI_EXPORT virtual ~SketchAPI_Circle(); - INTERFACE_7(SketchPlugin_Circle::ID(), - circleType, SketchPlugin_Circle::CIRCLE_TYPE(), - ModelAPI_AttributeString, /** Circle type */, + INTERFACE_3(SketchPlugin_Circle::ID(), center, SketchPlugin_Circle::CENTER_ID(), GeomDataAPI_Point2D, /** Center point */, radius, SketchPlugin_Circle::RADIUS_ID(), ModelAPI_AttributeDouble, /** Radius */, - firstPoint, SketchPlugin_Circle::FIRST_POINT_ID(), - GeomDataAPI_Point2D, /** First point */, - secondPoint, SketchPlugin_Circle::SECOND_POINT_ID(), - GeomDataAPI_Point2D, /** Second point */, - thirdPoint, SketchPlugin_Circle::THIRD_POINT_ID(), - GeomDataAPI_Point2D, /** Third point */, external, SketchPlugin_Circle::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */) @@ -89,18 +67,6 @@ public: SKETCHAPI_EXPORT void setByCenterAndRadius(const std::shared_ptr& theCenter, double theRadius); - /// Set by three points. - SKETCHAPI_EXPORT - void setByThreePoints(double theX1, double theY1, - double theX2, double theY2, - double theX3, double theY3); - - /// Set by three points. - SKETCHAPI_EXPORT - void setByThreePoints(const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3); - /// Set by external. SKETCHAPI_EXPORT void setByExternal(const ModelHighAPI_Selection& theExternal); @@ -121,30 +87,6 @@ public: SKETCHAPI_EXPORT void setRadius(double theRadius); - /// Set first point. - SKETCHAPI_EXPORT - void setFirstPoint(double theX, double theY); - - /// Set first point. - SKETCHAPI_EXPORT - void setFirstPoint(const std::shared_ptr& thePoint); - - /// Set second point. - SKETCHAPI_EXPORT - void setSecondPoint(double theX, double theY); - - /// Set second point. - SKETCHAPI_EXPORT - void setSecondPoint(const std::shared_ptr& thePoint); - - /// Set third point. - SKETCHAPI_EXPORT - void setThirdPoint(double theX, double theY); - - /// Set third point. - SKETCHAPI_EXPORT - void setThirdPoint(const std::shared_ptr& thePoint); - /// Dump wrapped feature SKETCHAPI_EXPORT virtual void dump(ModelHighAPI_Dumper& theDumper) const; diff --git a/src/SketchAPI/SketchAPI_MacroCircle.cpp b/src/SketchAPI/SketchAPI_MacroCircle.cpp new file mode 100644 index 000000000..e326efbd2 --- /dev/null +++ b/src/SketchAPI/SketchAPI_MacroCircle.cpp @@ -0,0 +1,215 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: SketchAPI_MacroCircle.cpp +// Created: 09 June 2016 +// Author: Dmitry Bobylev + +#include "SketchAPI_MacroCircle.h" + +#include + +#include +#include +#include +#include + +//================================================================================================== +SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr& theFeature) +: SketchAPI_SketchEntity(theFeature) +{ + initialize(); +} + +//================================================================================================== +SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr& theFeature, + double theCenterX, + double theCenterY, + double thePassedX, + double thePassedY) +: SketchAPI_SketchEntity(theFeature) +{ + if(initialize()) { + setByCenterAndPassedPoints(theCenterX, theCenterY, thePassedX, thePassedY); + } +} + +//================================================================================================== +SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr& theFeature, + const std::shared_ptr& theCenterPoint, + const std::shared_ptr& thePassedPoint) +: SketchAPI_SketchEntity(theFeature) +{ + if(initialize()) { + setByCenterAndPassedPoints(theCenterPoint, thePassedPoint); + } +} + +//================================================================================================== +SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr& theFeature, + double theX1, double theY1, + double theX2, double theY2, + double theX3, double theY3) +: SketchAPI_SketchEntity(theFeature) +{ + if(initialize()) { + setByThreePoints(theX1, theY1, theX2, theY2, theX3, theY3); + } +} + +//================================================================================================== +SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr& theFeature, + const std::shared_ptr& thePoint1, + const std::shared_ptr& thePoint2, + const std::shared_ptr& thePoint3) +: SketchAPI_SketchEntity(theFeature) +{ + if(initialize()) { + setByThreePoints(thePoint1, thePoint2, thePoint3); + } +} + +//================================================================================================== +SketchAPI_MacroCircle::~SketchAPI_MacroCircle() +{ +} + +//================================================================================================== +void SketchAPI_MacroCircle::setByCenterAndPassedPoints(double theCenterX, + double theCenterY, + double thePassedX, + double thePassedY) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType); + fillAttribute(centerPoint(), theCenterX, theCenterY); + fillAttribute(passedPoint(), thePassedX, thePassedY); + + execute(); +} + +//================================================================================================== +void SketchAPI_MacroCircle::setByCenterAndPassedPoints( + const std::shared_ptr& theCenterPoint, + const std::shared_ptr& thePassedPoint) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType); + fillAttribute(theCenterPoint, mycenterPoint); + fillAttribute(thePassedPoint, mypassedPoint); + + execute(); +} + +//================================================================================================== +void SketchAPI_MacroCircle::setByThreePoints(double theX1, double theY1, + double theX2, double theY2, + double theX3, double theY3) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType); + fillAttribute(firstPoint(), theX1, theY1); + fillAttribute(secondPoint(), theX2, theY2); + fillAttribute(thirdPoint(), theX3, theY3); + + execute(); +} + +//================================================================================================== +void SketchAPI_MacroCircle::setByThreePoints(const std::shared_ptr& thePoint1, + const std::shared_ptr& thePoint2, + const std::shared_ptr& thePoint3) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType); + fillAttribute(thePoint1, myfirstPoint); + fillAttribute(thePoint2, mysecondPoint); + fillAttribute(thePoint3, mythirdPoint); + + execute(); +} + +//================================================================================================== +void SketchAPI_MacroCircle::setCenterPoint(double theX, double theY) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType); + fillAttribute(centerPoint(), theX, theY); + + execute(); +} + +//================================================================================================== +void SketchAPI_MacroCircle::setCenterPoint(const std::shared_ptr& theCenterPoint) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType); + fillAttribute(theCenterPoint, mycenterPoint); + + execute(); +} + +//================================================================================================== +void SketchAPI_MacroCircle::setPassedPoint(double theX, double theY) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType); + fillAttribute(passedPoint(), theX, theY); + + execute(); +} + +//================================================================================================== +void SketchAPI_MacroCircle::setPassedPoint(const std::shared_ptr& thePassedPoint) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType); + fillAttribute(thePassedPoint, mypassedPoint); + + execute(); +} + +//================================================================================================== +void SketchAPI_MacroCircle::setFirstPoint(double theX, double theY) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType); + fillAttribute(firstPoint(), theX, theY); + + execute(); +} + +//================================================================================================== +void SketchAPI_MacroCircle::setFirstPoint(const std::shared_ptr& thePoint) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType); + fillAttribute(thePoint, myfirstPoint); + + execute(); +} + +//================================================================================================== +void SketchAPI_MacroCircle::setSecondPoint(double theX, double theY) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType); + fillAttribute(secondPoint(), theX, theY); + + execute(); +} + +//================================================================================================== +void SketchAPI_MacroCircle::setSecondPoint(const std::shared_ptr& thePoint) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType); + fillAttribute(thePoint, mysecondPoint); + + execute(); +} + +//================================================================================================== +void SketchAPI_MacroCircle::setThirdPoint(double theX, double theY) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType); + fillAttribute(thirdPoint(), theX, theY); + + execute(); +} + +//================================================================================================== +void SketchAPI_MacroCircle::setThirdPoint(const std::shared_ptr& thePoint) +{ + fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType); + fillAttribute(thePoint, mythirdPoint); + + execute(); +} diff --git a/src/SketchAPI/SketchAPI_MacroCircle.h b/src/SketchAPI/SketchAPI_MacroCircle.h new file mode 100644 index 000000000..ccf1f74ce --- /dev/null +++ b/src/SketchAPI/SketchAPI_MacroCircle.h @@ -0,0 +1,139 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: SketchAPI_MacroCircle.h +// Created: 09 June 2016 +// Author: Dmitry Bobylev + +#ifndef SketchAPI_MacroCircle_H_ +#define SketchAPI_MacroCircle_H_ + +#include "SketchAPI.h" +#include "SketchAPI_SketchEntity.h" + +#include + +class ModelHighAPI_Selection; + +/// \class SketchAPI_MacroCircle +/// \ingroup CPPHighAPI +/// \brief Interface for Circle feature. +class SketchAPI_MacroCircle: public SketchAPI_SketchEntity +{ +public: + /// Constructor without values. + SKETCHAPI_EXPORT + explicit SketchAPI_MacroCircle(const std::shared_ptr& theFeature); + + /// Constructor with values. + SKETCHAPI_EXPORT + SketchAPI_MacroCircle(const std::shared_ptr& theFeature, + double theCenterX, + double theCenterY, + double thePassedX, + double thePassedY); + + /// Constructor with values. + SKETCHAPI_EXPORT + SketchAPI_MacroCircle(const std::shared_ptr& theFeature, + const std::shared_ptr& theCenterPoint, + const std::shared_ptr& thePassedPoint); + + /// Constructor with values. + SKETCHAPI_EXPORT + SketchAPI_MacroCircle(const std::shared_ptr& theFeature, + double theX1, double theY1, + double theX2, double theY2, + double theX3, double theY3); + + /// Constructor with values. + SKETCHAPI_EXPORT + SketchAPI_MacroCircle(const std::shared_ptr& theFeature, + const std::shared_ptr& thePoint1, + const std::shared_ptr& thePoint2, + const std::shared_ptr& thePoint3); + + /// Destructor. + SKETCHAPI_EXPORT + virtual ~SketchAPI_MacroCircle(); + + INTERFACE_6(SketchPlugin_MacroCircle::ID(), + circleType, SketchPlugin_MacroCircle::CIRCLE_TYPE(), + ModelAPI_AttributeString, /** Circle type */, + centerPoint, SketchPlugin_MacroCircle::CENTER_POINT_ID(), + GeomDataAPI_Point2D, /** Center point */, + passedPoint, SketchPlugin_MacroCircle::PASSED_POINT_ID(), + GeomDataAPI_Point2D, /** Passed point */, + firstPoint, SketchPlugin_MacroCircle::FIRST_POINT_ID(), + GeomDataAPI_Point2D, /** First point */, + secondPoint, SketchPlugin_MacroCircle::SECOND_POINT_ID(), + GeomDataAPI_Point2D, /** Second point */, + thirdPoint, SketchPlugin_MacroCircle::THIRD_POINT_ID(), + GeomDataAPI_Point2D, /** Third point */) + + /// Set by center and passed points. + SKETCHAPI_EXPORT + void setByCenterAndPassedPoints(double theCenterX, double theCenterY, + double thePassedX, double thePassedY); + + /// Set by center and passed points. + SKETCHAPI_EXPORT + void setByCenterAndPassedPoints(const std::shared_ptr& theCenterPoint, + const std::shared_ptr& thePassedPoint); + + /// Set by three points. + SKETCHAPI_EXPORT + void setByThreePoints(double theX1, double theY1, + double theX2, double theY2, + double theX3, double theY3); + + /// Set by three points. + SKETCHAPI_EXPORT + void setByThreePoints(const std::shared_ptr& thePoint1, + const std::shared_ptr& thePoint2, + const std::shared_ptr& thePoint3); + + /// Set center point. + SKETCHAPI_EXPORT + void setCenterPoint(double theX, double theY); + + /// Set center point. + SKETCHAPI_EXPORT + void setCenterPoint(const std::shared_ptr& theCenterPoint); + + /// Set passed point. + SKETCHAPI_EXPORT + void setPassedPoint(double theX, double theY); + + /// Set passed point. + SKETCHAPI_EXPORT + void setPassedPoint(const std::shared_ptr& thePassedPoint); + + /// Set first point. + SKETCHAPI_EXPORT + void setFirstPoint(double theX, double theY); + + /// Set first point. + SKETCHAPI_EXPORT + void setFirstPoint(const std::shared_ptr& thePoint); + + /// Set second point. + SKETCHAPI_EXPORT + void setSecondPoint(double theX, double theY); + + /// Set second point. + SKETCHAPI_EXPORT + void setSecondPoint(const std::shared_ptr& thePoint); + + /// Set third point. + SKETCHAPI_EXPORT + void setThirdPoint(double theX, double theY); + + /// Set third point. + SKETCHAPI_EXPORT + void setThirdPoint(const std::shared_ptr& thePoint); +}; + +/// Pointer on Circle object. +typedef std::shared_ptr MacroCirclePtr; + +#endif // SketchAPI_MacroCircle_H_ diff --git a/src/SketchAPI/SketchAPI_Sketch.cpp b/src/SketchAPI/SketchAPI_Sketch.cpp index 11c22f0ae..e126efdfa 100644 --- a/src/SketchAPI/SketchAPI_Sketch.cpp +++ b/src/SketchAPI/SketchAPI_Sketch.cpp @@ -42,6 +42,7 @@ #include "SketchAPI_Circle.h" #include "SketchAPI_IntersectionPoint.h" #include "SketchAPI_Line.h" +#include "SketchAPI_MacroCircle.h" #include "SketchAPI_Mirror.h" #include "SketchAPI_Point.h" #include "SketchAPI_Projection.h" @@ -294,23 +295,45 @@ std::shared_ptr SketchAPI_Sketch::addCircle( return CirclePtr(new SketchAPI_Circle(aFeature, theCenter, theRadius)); } -std::shared_ptr SketchAPI_Sketch::addCircle(double theX1, double theY1, - double theX2, double theY2, - double theX3, double theY3) +std::shared_ptr SketchAPI_Sketch::addCircle(double theCenterX, + double theCenterY, + double thePassedX, + double thePassedY) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID()); - return CirclePtr(new SketchAPI_Circle(aFeature, theX1, theY1, theX2, theY2, theX3, theY3)); + return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theCenterX, theCenterY, + thePassedX, thePassedY)); } -std::shared_ptr SketchAPI_Sketch::addCircle( - const std::shared_ptr& thePoint1, - const std::shared_ptr& thePoint2, - const std::shared_ptr& thePoint3) +std::shared_ptr SketchAPI_Sketch::addCircle( + const std::shared_ptr& theCenterPoint, + const std::shared_ptr& thePassedPoint) +{ + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Circle::ID()); + return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theCenterPoint, thePassedPoint)); +} + +std::shared_ptr SketchAPI_Sketch::addCircle(double theX1, double theY1, + double theX2, double theY2, + double theX3, double theY3) +{ + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Circle::ID()); + return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theX1, theY1, + theX2, theY2, + theX3, theY3)); +} + +std::shared_ptr SketchAPI_Sketch::addCircle( + const std::shared_ptr& thePoint1, + const std::shared_ptr& thePoint2, + const std::shared_ptr& thePoint3) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID()); - return CirclePtr(new SketchAPI_Circle(aFeature, thePoint1, thePoint2, thePoint3)); + return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, thePoint1, thePoint2, thePoint3)); } std::shared_ptr diff --git a/src/SketchAPI/SketchAPI_Sketch.h b/src/SketchAPI/SketchAPI_Sketch.h index 792a8ee79..7e7082c14 100644 --- a/src/SketchAPI/SketchAPI_Sketch.h +++ b/src/SketchAPI/SketchAPI_Sketch.h @@ -28,6 +28,7 @@ class ModelHighAPI_Reference; class ModelHighAPI_Selection; class SketchAPI_Arc; class SketchAPI_Circle; +class SketchAPI_MacroCircle; class SketchAPI_IntersectionPoint; class SketchAPI_Line; class SketchAPI_Mirror; @@ -154,13 +155,23 @@ public: double theRadius); /// Add circle SKETCHAPI_EXPORT - std::shared_ptr addCircle( + std::shared_ptr addCircle( + double theCenterX, double theCenterY, + double thePassedX, double thePassedY); + /// Add circle + SKETCHAPI_EXPORT + std::shared_ptr addCircle( + const std::shared_ptr& theCenterPoint, + const std::shared_ptr& thePassedPoint); + /// Add circle + SKETCHAPI_EXPORT + std::shared_ptr addCircle( double theX1, double theY1, double theX2, double theY2, double theX3, double theY3); /// Add circle SKETCHAPI_EXPORT - std::shared_ptr addCircle( + std::shared_ptr addCircle( const std::shared_ptr& thePoint1, const std::shared_ptr& thePoint2, const std::shared_ptr& thePoint3); diff --git a/src/SketchAPI/SketchAPI_swig.h b/src/SketchAPI/SketchAPI_swig.h index c1695defa..0bc5da676 100644 --- a/src/SketchAPI/SketchAPI_swig.h +++ b/src/SketchAPI/SketchAPI_swig.h @@ -12,6 +12,7 @@ #include "SketchAPI.h" #include "SketchAPI_Arc.h" #include "SketchAPI_Circle.h" + #include "SketchAPI_MacroCircle.h" #include "SketchAPI_Constraint.h" #include "SketchAPI_IntersectionPoint.h" #include "SketchAPI_Line.h" diff --git a/src/SketchPlugin/CMakeLists.txt b/src/SketchPlugin/CMakeLists.txt index f8049d394..5cc31d85b 100644 --- a/src/SketchPlugin/CMakeLists.txt +++ b/src/SketchPlugin/CMakeLists.txt @@ -30,6 +30,7 @@ SET(PROJECT_HEADERS SketchPlugin_Feature.h SketchPlugin_IntersectionPoint.h SketchPlugin_Line.h + SketchPlugin_MacroCircle.h SketchPlugin_MultiRotation.h SketchPlugin_MultiTranslation.h SketchPlugin_Plugin.h @@ -68,6 +69,7 @@ SET(PROJECT_SOURCES SketchPlugin_Feature.cpp SketchPlugin_IntersectionPoint.cpp SketchPlugin_Line.cpp + SketchPlugin_MacroCircle.cpp SketchPlugin_MultiRotation.cpp SketchPlugin_MultiTranslation.cpp SketchPlugin_Plugin.cpp diff --git a/src/SketchPlugin/SketchPlugin_Circle.cpp b/src/SketchPlugin/SketchPlugin_Circle.cpp index 435a071cb..e5cc000b2 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.cpp +++ b/src/SketchPlugin/SketchPlugin_Circle.cpp @@ -29,23 +29,9 @@ const double tolerance = 1e-7; -namespace { - static const std::string& POINT_ID(int theIndex) - { - switch (theIndex) { - case 1: return SketchPlugin_Circle::FIRST_POINT_ID(); - case 2: return SketchPlugin_Circle::SECOND_POINT_ID(); - case 3: return SketchPlugin_Circle::THIRD_POINT_ID(); - } - - static const std::string DUMMY; - return DUMMY; - } -} - SketchPlugin_Circle::SketchPlugin_Circle() - : SketchPlugin_SketchEntity() +: SketchPlugin_SketchEntity() { } @@ -53,137 +39,61 @@ void SketchPlugin_Circle::initDerivedClassAttributes() { data()->addAttribute(CENTER_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId()); ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); - - data()->addAttribute(CIRCLE_TYPE(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(FIRST_POINT_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(SECOND_POINT_ID(), GeomDataAPI_Point2D::typeId()); - data()->addAttribute(THIRD_POINT_ID(), GeomDataAPI_Point2D::typeId()); - std::dynamic_pointer_cast( - data()->attribute(CIRCLE_TYPE()))->setValue(CIRCLE_TYPE_CENTER_AND_RADIUS()); } void SketchPlugin_Circle::execute() { SketchPlugin_Sketch* aSketch = sketch(); - if (aSketch) { - std::list > aShapes; - - // compute a circle point in 3D view - std::shared_ptr aCenterAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(data()->attribute(CENTER_ID())); - AttributeDoublePtr aRadiusAttr = - std::dynamic_pointer_cast(data()->attribute(RADIUS_ID())); - if (aCenterAttr->isInitialized() && aRadiusAttr->isInitialized()) { - std::shared_ptr aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y())); - //std::cout<<"Execute circle "<x()<<" "<y()<<" "<z()< aNDir = std::dynamic_pointer_cast( - aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); - std::shared_ptr aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z())); - // compute the circle radius - double aRadius = aRadiusAttr->value(); - - std::shared_ptr aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle( - aCenter, aNormal, aRadius); - aShapes.push_back(aCircleShape); - std::shared_ptr aConstr2 = document()->createConstruction( - data(), 1); - aConstr2->setShape(aCircleShape); - aConstr2->setIsInHistory(false); - setResult(aConstr2, 1); - } + if(!aSketch) { + return; } -} -AISObjectPtr SketchPlugin_Circle::getAISObject(AISObjectPtr thePrevious) -{ - SketchPlugin_Sketch* aSketch = sketch(); - if (aSketch && !isFeatureValid()) { - // compute a circle point in 3D view - std::shared_ptr aCenterAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(data()->attribute(CENTER_ID())); - AttributeDoublePtr aRadiusAttr = - std::dynamic_pointer_cast(attribute(RADIUS_ID())); - if (aCenterAttr->isInitialized() && aRadiusAttr->isInitialized()) { - std::shared_ptr aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y())); + // Compute a circle in 3D view. + std::shared_ptr aCenterAttr = + std::dynamic_pointer_cast(data()->attribute(CENTER_ID())); + AttributeDoublePtr aRadiusAttr = real(RADIUS_ID()); + if(!aCenterAttr->isInitialized() || !aRadiusAttr->isInitialized()) { + return; + } - // make a visible circle - std::shared_ptr aNDir = std::dynamic_pointer_cast( - aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); - std::shared_ptr aNormal = aNDir->dir(); + double aRadius = aRadiusAttr->value(); + if(aRadius < tolerance) { + return; + } - double aRadius = aRadiusAttr->value(); - std::shared_ptr aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle( - aCenter, aNormal, aRadius); - if (aCircleShape && aRadius != 0) { - std::list > aShapes; - // make a visible point - std::shared_ptr aCenterPointShape = - GeomAlgoAPI_PointBuilder::vertex(aCenter); - aShapes.push_back(aCenterPointShape); - aShapes.push_back(aCircleShape); + // Make a visible point. + SketchPlugin_Sketch::createPoint2DResult(this, sketch(), CENTER_ID(), 0); - std::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes); - AISObjectPtr anAIS = thePrevious; - if (!anAIS) - anAIS = AISObjectPtr(new GeomAPI_AISObject); - anAIS->createShape(aCompound); - anAIS->setWidth(3); - return anAIS; - } - } - } - return AISObjectPtr(); -} + // Make a visible circle. + std::shared_ptr aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y())); + std::shared_ptr aNDir = std::dynamic_pointer_cast( + aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z())); -bool SketchPlugin_Circle::isFeatureValid() -{ - std::shared_ptr aCenter = - std::dynamic_pointer_cast(attribute(CENTER_ID())); - bool aValid = aCenter->isInitialized(); + std::shared_ptr aCircleShape = + GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aRadius); - std::string aType = std::dynamic_pointer_cast( - data()->attribute(CIRCLE_TYPE()))->value(); - if (aType == CIRCLE_TYPE_THREE_POINTS()) { - std::shared_ptr aFirstPnt = - std::dynamic_pointer_cast(attribute(FIRST_POINT_ID())); - std::shared_ptr aSecondPnt = - std::dynamic_pointer_cast(attribute(SECOND_POINT_ID())); - std::shared_ptr aThirdPnt = - std::dynamic_pointer_cast(attribute(THIRD_POINT_ID())); - aValid = aValid && - aFirstPnt->isInitialized() && - aSecondPnt->isInitialized() && - aThirdPnt->isInitialized(); - } - return aValid; + std::shared_ptr aResult = document()->createConstruction(data(), 1); + aResult->setShape(aCircleShape); + aResult->setIsInHistory(false); + setResult(aResult, 1); } void SketchPlugin_Circle::move(double theDeltaX, double theDeltaY) { std::shared_ptr aData = data(); - if (!aData->isValid()) + if(!aData->isValid()) { return; + } std::shared_ptr aPoint = std::dynamic_pointer_cast( aData->attribute(CENTER_ID())); - if (aPoint->isInitialized()) - aPoint->move(theDeltaX, theDeltaY); - - aPoint = std::dynamic_pointer_cast(aData->attribute(FIRST_POINT_ID())); - if (aPoint->isInitialized()) - aPoint->move(theDeltaX, theDeltaY); - aPoint = std::dynamic_pointer_cast(aData->attribute(SECOND_POINT_ID())); - if (aPoint->isInitialized()) - aPoint->move(theDeltaX, theDeltaY); - aPoint = std::dynamic_pointer_cast(aData->attribute(THIRD_POINT_ID())); - if (aPoint->isInitialized()) + if(aPoint->isInitialized()) { aPoint->move(theDeltaX, theDeltaY); + } } bool SketchPlugin_Circle::isFixed() { @@ -210,92 +120,4 @@ void SketchPlugin_Circle::attributeChanged(const std::string& theID) { real(RADIUS_ID())->setValue(aCirc->radius()); } } - else if (theID == CENTER_ID() || theID == RADIUS_ID()) { - std::string aType = std::dynamic_pointer_cast( - data()->attribute(CIRCLE_TYPE()))->value(); - if (aType == CIRCLE_TYPE_THREE_POINTS() && lastResult()) // adjust data from the solver - adjustThreePoints(); - } else if (theID == FIRST_POINT_ID() || theID == SECOND_POINT_ID() || theID == THIRD_POINT_ID()) { - // support the center and radius attributes enev in other mode: solver uses them - std::string aType = std::dynamic_pointer_cast( - data()->attribute(CIRCLE_TYPE()))->value(); - if (aType == CIRCLE_TYPE_CENTER_AND_RADIUS()) - return; - bool aWasBlocked = data()->blockSendAttributeUpdated(true); // to modify two attributes at once - std::shared_ptr aPoints[3]; - int aNbInitialized = 0; - for (int i = 1; i <= 3; ++i) { - std::shared_ptr aCurPnt = - std::dynamic_pointer_cast(attribute(POINT_ID(i))); - if (aCurPnt->isInitialized()) - aPoints[aNbInitialized++] = aCurPnt->pnt(); - } - - std::shared_ptr aCenterAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(data()->attribute(CENTER_ID())); - AttributeDoublePtr aRadiusAttr = - std::dynamic_pointer_cast(data()->attribute(RADIUS_ID())); - - if (aNbInitialized == 1) - aCenterAttr->setValue(aPoints[0]->x(), aPoints[0]->y()); - else if (aNbInitialized == 2) { - std::shared_ptr aCoord = - aPoints[0]->xy()->added(aPoints[1]->xy())->multiplied(0.5); - double aRadius = aPoints[0]->distance(aPoints[1]) * 0.5; - aCenterAttr->setValue(aCoord->x(), aCoord->y()); - aRadiusAttr->setValue(aRadius); - } else { - std::shared_ptr aCircle( - new GeomAPI_Circ2d(aPoints[0], aPoints[1], aPoints[2])); - - std::shared_ptr aCenter = aCircle->center(); - if (aCenter) { - double aRadius = aCircle->radius(); - aCenterAttr->setValue(aCenter->x(), aCenter->y()); - aRadiusAttr->setValue(aRadius); - } - } - data()->blockSendAttributeUpdated(aWasBlocked, false); - - } else if (theID == CIRCLE_TYPE()) { // if switched to 3 points mode, adjust the needed attributes - std::string aType = std::dynamic_pointer_cast( - data()->attribute(CIRCLE_TYPE()))->value(); - if (aType == CIRCLE_TYPE_THREE_POINTS()) { - adjustThreePoints(); - } - } -} - -void SketchPlugin_Circle::adjustThreePoints() -{ - std::shared_ptr aCenterAttr = - std::dynamic_pointer_cast(attribute(CENTER_ID())); - if (!aCenterAttr->isInitialized()) - return; - AttributeDoublePtr aRadiusAttr = - std::dynamic_pointer_cast(attribute(RADIUS_ID())); - if (!aRadiusAttr->isInitialized()) - return; - - bool aWasBlocked = data()->blockSendAttributeUpdated(true); - std::shared_ptr aFirstPnt = - std::dynamic_pointer_cast(attribute(FIRST_POINT_ID())); - std::shared_ptr aSecondPnt = - std::dynamic_pointer_cast(attribute(SECOND_POINT_ID())); - std::shared_ptr aThirdPnt = - std::dynamic_pointer_cast(attribute(THIRD_POINT_ID())); - double aRadius = aRadiusAttr->value(); - - bool isInitialized = aFirstPnt->isInitialized() && - aSecondPnt->isInitialized() && aThirdPnt->isInitialized(); - - if (!isInitialized || - fabs(aFirstPnt->pnt()->distance(aCenterAttr->pnt()) - aRadius) > tolerance || - fabs(aSecondPnt->pnt()->distance(aCenterAttr->pnt()) - aRadius) > tolerance || - fabs(aThirdPnt->pnt()->distance(aCenterAttr->pnt()) - aRadius) > tolerance) { - aFirstPnt->setValue(aCenterAttr->x() + aRadius, aCenterAttr->y()); - aSecondPnt->setValue(aCenterAttr->x(), aCenterAttr->y() + aRadius); - aThirdPnt->setValue(aCenterAttr->x() - aRadius, aCenterAttr->y()); - } - data()->blockSendAttributeUpdated(aWasBlocked, false); } diff --git a/src/SketchPlugin/SketchPlugin_Circle.h b/src/SketchPlugin/SketchPlugin_Circle.h index e183384d8..df577cda8 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.h +++ b/src/SketchPlugin/SketchPlugin_Circle.h @@ -10,75 +10,33 @@ #include "SketchPlugin.h" #include #include -#include /**\class SketchPlugin_Circle * \ingroup Plugins - * \brief Feature for creation of the new circle in PartSet. + * \brief Feature for creation of the new circle in Sketch. */ -class SketchPlugin_Circle : public SketchPlugin_SketchEntity, public GeomAPI_IPresentable +class SketchPlugin_Circle: public SketchPlugin_SketchEntity { public: /// Circle feature kind inline static const std::string& ID() { - static const std::string MY_CIRCLE_ID("SketchCircle"); - return MY_CIRCLE_ID; - } - - inline static const std::string& CIRCLE_TYPE() - { - static const std::string TYPE("CircleType"); - return TYPE; - } - - /// Creation method by center and radius. - inline static const std::string& CIRCLE_TYPE_CENTER_AND_RADIUS() - { - static const std::string TYPE("CenterRadius"); - return TYPE; - } - - /// Creation method by three points. - inline static const std::string& CIRCLE_TYPE_THREE_POINTS() - { - static const std::string TYPE("ThreePoints"); - return TYPE; + static const std::string ID("SketchCircle"); + return ID; } /// 2D point - center of the circle inline static const std::string& CENTER_ID() { - static const std::string MY_CIRCLE_CENTER_ID("CircleCenter"); - return MY_CIRCLE_CENTER_ID; + static const std::string ID("circle_center"); + return ID; } /// Radius of the circle inline static const std::string& RADIUS_ID() { - static const std::string MY_CIRCLE_RADIUS_ID("CircleRadius"); - return MY_CIRCLE_RADIUS_ID; - } - - /// First point id. - inline static const std::string& FIRST_POINT_ID() - { - static const std::string FIRST_PNT("FirstPoint"); - return FIRST_PNT; - } - - /// Second point id. - inline static const std::string& SECOND_POINT_ID() - { - static const std::string SECOND_PNT("SecondPoint"); - return SECOND_PNT; - } - - /// Third point id. - inline static const std::string& THIRD_POINT_ID() - { - static const std::string THIRD_PNT("ThirdPoint"); - return THIRD_PNT; + static const std::string ID("circle_radius"); + return ID; } /// Returns the kind of a feature @@ -91,39 +49,23 @@ class SketchPlugin_Circle : public SketchPlugin_SketchEntity, public GeomAPI_IPr /// Returns true is sketch element is under the rigid constraint SKETCHPLUGIN_EXPORT virtual bool isFixed(); + /// Called on change of any argument-attribute of this object + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Adds sub-feature of the higher level feature (sub-element of the sketch) - /// \param theFeature sub-feature - SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature) - { - } - /// Moves the feature /// \param theDeltaX the delta for X coordinate is moved /// \param theDeltaY the delta for Y coordinate is moved SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); - - /// Returns the AIS preview - virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); - /// Use plugin manager for features creation SketchPlugin_Circle(); protected: /// \brief Initializes attributes of derived class. virtual void initDerivedClassAttributes(); - -private: - /// Returns true if all obligatory attributes are initialized - bool isFeatureValid(); - - /// Update coordinates of representation by three points - void adjustThreePoints(); }; #endif diff --git a/src/SketchPlugin/SketchPlugin_MacroCircle.cpp b/src/SketchPlugin/SketchPlugin_MacroCircle.cpp new file mode 100644 index 000000000..89d137348 --- /dev/null +++ b/src/SketchPlugin/SketchPlugin_MacroCircle.cpp @@ -0,0 +1,209 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: SketchPlugin_MacroCircle.cpp +// Created: 26 May 2014 +// Author: Artem ZHIDKOV + +#include "SketchPlugin_MacroCircle.h" + +#include "SketchPlugin_Circle.h" +#include "SketchPlugin_ConstraintCoincidence.h" +#include "SketchPlugin_Tools.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +const double tolerance = 1e-7; + +namespace { + static const std::string& POINT_ID(int theIndex) + { + switch (theIndex) { + case 1: return SketchPlugin_MacroCircle::FIRST_POINT_ID(); + case 2: return SketchPlugin_MacroCircle::SECOND_POINT_ID(); + case 3: return SketchPlugin_MacroCircle::THIRD_POINT_ID(); + } + + static const std::string DUMMY; + return DUMMY; + } +} + + +SketchPlugin_MacroCircle::SketchPlugin_MacroCircle() +: SketchPlugin_SketchEntity(), +myRadius(0) +{ +} + +void SketchPlugin_MacroCircle::initAttributes() +{ + data()->addAttribute(CIRCLE_TYPE(), ModelAPI_AttributeString::typeId()); + + data()->addAttribute(CENTER_POINT_ID(), GeomDataAPI_Point2D::typeId()); + data()->addAttribute(CENTER_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + data()->addAttribute(PASSED_POINT_ID(), GeomDataAPI_Point2D::typeId()); + data()->addAttribute(PASSED_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId()); + + data()->addAttribute(FIRST_POINT_ID(), GeomDataAPI_Point2D::typeId()); + data()->addAttribute(SECOND_POINT_ID(), GeomDataAPI_Point2D::typeId()); + data()->addAttribute(THIRD_POINT_ID(), GeomDataAPI_Point2D::typeId()); + + data()->addAttribute(CIRCLE_RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(AUXILIARY_ID(), ModelAPI_AttributeBoolean::typeId()); + + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CENTER_POINT_REF_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PASSED_POINT_REF_ID()); +} + +void SketchPlugin_MacroCircle::execute() +{ + // Create circle feature. + FeaturePtr aCircleFeature = sketch()->addFeature(SketchPlugin_Circle::ID()); + std::dynamic_pointer_cast( + aCircleFeature->attribute(SketchPlugin_Circle::CENTER_ID()))->setValue(myCenter->x(), + myCenter->y()); + aCircleFeature->real(SketchPlugin_Circle::RADIUS_ID())->setValue(myRadius); + aCircleFeature->boolean(SketchPlugin_Circle::AUXILIARY_ID()) + ->setValue(boolean(AUXILIARY_ID())->value()); + aCircleFeature->execute(); + + myCenter.reset(); + myRadius = 0; + + // Create constraints. + SketchPlugin_Tools::createConstraint(this, + CENTER_POINT_REF_ID(), + aCircleFeature->attribute(SketchPlugin_Circle::CENTER_ID()), + NULL, + false); + SketchPlugin_Tools::createConstraint(this, + PASSED_POINT_REF_ID(), + NULL, + aCircleFeature->lastResult(), + true); +} + +AISObjectPtr SketchPlugin_MacroCircle::getAISObject(AISObjectPtr thePrevious) +{ + if(!myCenter.get() || myRadius < tolerance) { + return AISObjectPtr(); + } + + SketchPlugin_Sketch* aSketch = sketch(); + if(!aSketch) { + return AISObjectPtr(); + } + + // Compute a circle in 3D view. + std::shared_ptr aCenter(aSketch->to3D(myCenter->x(), myCenter->y())); + std::shared_ptr aNDir = + std::dynamic_pointer_cast( + aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID())); + std::shared_ptr aNormal = aNDir->dir(); + GeomShapePtr aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, myRadius); + GeomShapePtr aCenterPointShape = GeomAlgoAPI_PointBuilder::vertex(aCenter); + if(!aCircleShape.get() || !aCenterPointShape.get()) { + return AISObjectPtr(); + } + + std::list > aShapes; + aShapes.push_back(aCircleShape); + aShapes.push_back(aCenterPointShape); + + std::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes); + AISObjectPtr anAIS = thePrevious; + if(!anAIS.get()) { + anAIS.reset(new GeomAPI_AISObject()); + } + anAIS->createShape(aCompound); + return anAIS; +} + +void SketchPlugin_MacroCircle::attributeChanged(const std::string& theID) { + // If circle type switched reset according attributes. + if(theID == CIRCLE_TYPE()) { + std::string aType = string(CIRCLE_TYPE())->value(); + if(aType == CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS()) { + resetAttribute(CENTER_POINT_ID()); + resetAttribute(PASSED_POINT_ID()); + } else if(aType == CIRCLE_TYPE_BY_THREE_POINTS()) { + resetAttribute(FIRST_POINT_ID()); + resetAttribute(SECOND_POINT_ID()); + resetAttribute(THIRD_POINT_ID()); + } + myCenter.reset(); + myRadius = 0; + } else if(theID == CENTER_POINT_ID() || theID == PASSED_POINT_ID()) { + std::shared_ptr aCenterPointAttr = + std::dynamic_pointer_cast(attribute(CENTER_POINT_ID())); + if(!aCenterPointAttr->isInitialized()) { + return; + } + std::shared_ptr aPassedPointAttr = + std::dynamic_pointer_cast(attribute(PASSED_POINT_ID())); + if(!aPassedPointAttr->isInitialized()) { + return; + } + + myCenter = aCenterPointAttr->pnt(); + myRadius = myCenter->distance(aPassedPointAttr->pnt()); + } else if(theID == FIRST_POINT_ID() || theID == SECOND_POINT_ID() || theID == THIRD_POINT_ID()) { + std::shared_ptr aPoints[3]; + int aNbInitialized = 0; + for(int i = 1; i <= 3; ++i) { + std::shared_ptr aCurPnt = + std::dynamic_pointer_cast(attribute(POINT_ID(i))); + if(aCurPnt->isInitialized()) + aPoints[aNbInitialized++] = aCurPnt->pnt(); + } + + if(aNbInitialized == 1) { + return; + } else if(aNbInitialized == 2) { + std::shared_ptr aCenterXY = + aPoints[0]->xy()->added(aPoints[1]->xy())->multiplied(0.5); + myCenter.reset(new GeomAPI_Pnt2d(aCenterXY->x(), aCenterXY->y())); + myRadius = aPoints[0]->distance(aPoints[1]) * 0.5; + } else { + std::shared_ptr aCircle( + new GeomAPI_Circ2d(aPoints[0], aPoints[1], aPoints[2])); + myCenter = aCircle->center(); + if(myCenter.get()) { + myRadius = aCircle->radius(); + } + } + } + + AttributeDoublePtr aRadiusAttr = real(CIRCLE_RADIUS_ID()); + bool aWasBlocked = data()->blockSendAttributeUpdated(true); + aRadiusAttr->setValue(myRadius); + data()->blockSendAttributeUpdated(aWasBlocked, false); +} + +void SketchPlugin_MacroCircle::resetAttribute(const std::string& theId) +{ + AttributePtr anAttr = attribute(theId); + if(anAttr.get()) { + anAttr->reset(); + } +} diff --git a/src/SketchPlugin/SketchPlugin_MacroCircle.h b/src/SketchPlugin/SketchPlugin_MacroCircle.h new file mode 100644 index 000000000..4ea0ecc50 --- /dev/null +++ b/src/SketchPlugin/SketchPlugin_MacroCircle.h @@ -0,0 +1,151 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: SketchPlugin_MacroCircle.h +// Created: 26 May 2014 +// Author: Artem ZHIDKOV + +#ifndef SketchPlugin_MacroCircle_H_ +#define SketchPlugin_MacroCircle_H_ + +#include "SketchPlugin.h" + +#include "SketchPlugin_Sketch.h" +#include "SketchPlugin_SketchEntity.h" + +#include +#include + +/**\class SketchPlugin_MacroCircle + * \ingroup Plugins + * \brief Feature for creation of the new circle in Sketch. + */ +class SketchPlugin_MacroCircle: public SketchPlugin_SketchEntity, + public GeomAPI_IPresentable +{ + public: + /// Circle feature kind + inline static const std::string& ID() + { + static const std::string ID("SketchMacroCircle"); + return ID; + } + + inline static const std::string& CIRCLE_TYPE() + { + static const std::string ID("circle_type"); + return ID; + } + + /// Creation method by center and passed point. + inline static const std::string& CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS() + { + static const std::string ID("circle_type_by_center_and_passed_points"); + return ID; + } + + /// Creation method by three points. + inline static const std::string& CIRCLE_TYPE_BY_THREE_POINTS() + { + static const std::string ID("circle_type_by_three_points"); + return ID; + } + + /// 2D point - center of the circle. + inline static const std::string& CENTER_POINT_ID() + { + static const std::string ID("center_point"); + return ID; + } + + /// Reference for center point selection. + inline static const std::string& CENTER_POINT_REF_ID() + { + static const std::string ID("center_point_ref"); + return ID; + } + + /// 2D point - passed point of the circle + inline static const std::string& PASSED_POINT_ID() + { + static const std::string ID("passed_point"); + return ID; + } + + /// Reference for passed point selection. + inline static const std::string& PASSED_POINT_REF_ID() + { + static const std::string ID("passed_point_ref"); + return ID; + } + + /// First point id. + inline static const std::string& FIRST_POINT_ID() + { + static const std::string ID("first_point"); + return ID; + } + + /// Second point id. + inline static const std::string& SECOND_POINT_ID() + { + static const std::string ID("second_point"); + return ID; + } + + /// Third point id. + inline static const std::string& THIRD_POINT_ID() + { + static const std::string ID("third_point"); + return ID; + } + + /// Radius of the circle + inline static const std::string& CIRCLE_RADIUS_ID() + { + static const std::string ID("circle_radius"); + return ID; + } + + /// Returns the kind of a feature + SKETCHPLUGIN_EXPORT virtual const std::string& getKind() + { + static std::string MY_KIND = SketchPlugin_MacroCircle::ID(); + return MY_KIND; + } + + /// \brief Request for initialization of data model of the feature: adding all attributes. + SKETCHPLUGIN_EXPORT virtual void initAttributes(); + + /// Called on change of any argument-attribute of this object + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + + /// Returns the AIS preview + virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + + /// Creates a new part document if needed + SKETCHPLUGIN_EXPORT virtual void execute(); + + /// Moves the feature + /// \param theDeltaX the delta for X coordinate is moved + /// \param theDeltaY the delta for Y coordinate is moved + SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) + {}; + + /// Reimplemented from ModelAPI_Feature::isMacro(). + /// \returns true + SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}; + + SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;}; + + /// Use plugin manager for features creation + SketchPlugin_MacroCircle(); + +private: + void resetAttribute(const std::string& theId); + +private: + std::shared_ptr myCenter; + double myRadius; +}; + +#endif diff --git a/src/SketchPlugin/SketchPlugin_Plugin.cpp b/src/SketchPlugin/SketchPlugin_Plugin.cpp index 80df2df05..6a4cde084 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -179,6 +180,8 @@ FeaturePtr SketchPlugin_Plugin::createFeature(std::string theFeatureID) return FeaturePtr(new SketchPlugin_ConstraintAngle); } else if (theFeatureID == SketchPlugin_Trim::ID()) { return FeaturePtr(new SketchPlugin_Trim); + } else if (theFeatureID == SketchPlugin_MacroCircle::ID()) { + return FeaturePtr(new SketchPlugin_MacroCircle); } // feature of such kind is not found return FeaturePtr(); @@ -242,6 +245,7 @@ std::shared_ptr SketchPlugin_Plugin aMsg->setState(SketchPlugin_MultiRotation::ID(), aHasSketchPlane); aMsg->setState(SketchPlugin_MultiTranslation::ID(), aHasSketchPlane); aMsg->setState(SketchPlugin_Trim::ID(), aHasSketchPlane); + aMsg->setState(SketchPlugin_MacroCircle::ID(), aHasSketchPlane); // SketchRectangle is a python feature, so its ID is passed just as a string aMsg->setState("SketchRectangle", aHasSketchPlane); } diff --git a/src/SketchPlugin/SketchPlugin_Tools.cpp b/src/SketchPlugin/SketchPlugin_Tools.cpp index bbe296981..7af4e9af1 100644 --- a/src/SketchPlugin/SketchPlugin_Tools.cpp +++ b/src/SketchPlugin/SketchPlugin_Tools.cpp @@ -6,12 +6,17 @@ #include "SketchPlugin_Tools.h" +#include "SketchPlugin_ConstraintCoincidence.h" +#include "SketchPlugin_ConstraintTangent.h" +#include "SketchPlugin_Point.h" +#include "SketchPlugin_SketchEntity.h" + +#include + +#include + #include #include -#include -#include -#include -#include namespace SketchPlugin_Tools { @@ -101,4 +106,43 @@ void findCoincidences(const FeaturePtr theStartCoin, } } +void createConstraint(SketchPlugin_Feature* theFeature, + const std::string& theId, + const AttributePtr theAttr, + const ObjectPtr theObject, + const bool theIsCanBeTangent) +{ + AttributeRefAttrPtr aRefAttr = theFeature->refattr(theId); + if(aRefAttr.get() && aRefAttr->isInitialized()) { + FeaturePtr aConstraint; + if(!theIsCanBeTangent) { + aConstraint = theFeature->sketch() + ->addFeature(SketchPlugin_ConstraintCoincidence::ID()); + } else { + if(aRefAttr->isObject()) { + ObjectPtr anObject = aRefAttr->object(); + FeaturePtr aFeature = ModelAPI_Feature::feature(anObject); + if(aFeature->getKind() == SketchPlugin_Point::ID()) { + aConstraint = theFeature->sketch() + ->addFeature(SketchPlugin_ConstraintCoincidence::ID()); + } else { + aConstraint = theFeature->sketch() + ->addFeature(SketchPlugin_ConstraintTangent::ID()); + } + } else { + aConstraint = theFeature->sketch() + ->addFeature(SketchPlugin_ConstraintCoincidence::ID()); + } + } + AttributeRefAttrPtr aRefAttrA = aConstraint->refattr(SketchPlugin_Constraint::ENTITY_A()); + aRefAttr->isObject() ? aRefAttrA->setObject(aRefAttr->object()) + : aRefAttrA->setAttr(aRefAttr->attr()); + AttributeRefAttrPtr aRefAttrB = aConstraint->refattr(SketchPlugin_Constraint::ENTITY_B()); + if(theObject.get()) { + aRefAttrB->setObject(theObject); + } else if(theAttr.get()) { + aRefAttrB->setAttr(theAttr); + } + } +} } // namespace SketchPlugin_Tools diff --git a/src/SketchPlugin/SketchPlugin_Tools.h b/src/SketchPlugin/SketchPlugin_Tools.h index 61cf44acf..ef26d67c0 100644 --- a/src/SketchPlugin/SketchPlugin_Tools.h +++ b/src/SketchPlugin/SketchPlugin_Tools.h @@ -12,6 +12,8 @@ #include #include +class SketchPlugin_Feature; + namespace SketchPlugin_Tools { /// Clears text expressions for all attributes of the feature @@ -28,6 +30,18 @@ std::shared_ptr getCoincidencePoint(const FeaturePtr theStartCoin void findCoincidences(const FeaturePtr theStartCoin, const std::string& theAttr, std::set& theList); + +/// Creates coincidence or tangent constraint. +/// \param[in] theFeature to get selected attribute or object +/// \param[in] theId ID of attribute where selection is. +/// \param[in] theObject object for constraint +/// \param[in] theIsCanBeTangent if true constraint can be tangent or coincidence, depending on +/// the selection in the attribute with passed ID. +void createConstraint(SketchPlugin_Feature* theFeature, + const std::string& theId, + const AttributePtr theAttr, + const ObjectPtr theObject, + const bool theIsCanBeTangent); }; // namespace SketchPlugin_Tools #endif // SKETCHPLUGIN_TOOLS_H_ \ No newline at end of file diff --git a/src/SketchPlugin/SketchPlugin_msg_en.ts b/src/SketchPlugin/SketchPlugin_msg_en.ts index f7d332f69..994eba6d5 100755 --- a/src/SketchPlugin/SketchPlugin_msg_en.ts +++ b/src/SketchPlugin/SketchPlugin_msg_en.ts @@ -73,91 +73,91 @@ - SketchCircle:CircleRadius:GeomValidators_Positive + SketchMacroCircle:CircleRadius:GeomValidators_Positive Double is not positive. Radius value is not positive - SketchCircle:Model_FeatureValidator + SketchMacroCircle:Model_FeatureValidator Attribute "CircleCenter" is not initialized. A center point is not selected - SketchCircle:Model_FeatureValidator + SketchMacroCircle:Model_FeatureValidator Attribute "FirstPoint" is not initialized. A first point is not selected - SketchCircle:Model_FeatureValidator + SketchMacroCircle:Model_FeatureValidator Attribute "SecondPoint" is not initialized. A second point is not selected - SketchCircle:Model_FeatureValidator + SketchMacroCircle:Model_FeatureValidator Attribute "ThirdPoint" is not initialized. A third point is not selected - SketchCircle:CircleCenter + SketchMacroCircle:CircleCenter Attribute "CircleCenter" is locked by modification value in the viewer. Select a center point - SketchCircle:FirstPoint + SketchMacroCircle:FirstPoint Attribute "FirstPoint" is locked by modification value in the viewer. Select a center point - SketchCircle:SecondPoint + SketchMacroCircle:SecondPoint Attribute "SecondPoint" is locked by modification value in the viewer. Select a center point - SketchCircle:ThirdPoint + SketchMacroCircle:ThirdPoint Attribute "ThirdPoint" is locked by modification value in the viewer. Select a center point - SketchCircle:CircleRadius + SketchMacroCircle:CircleRadius Attribute "CircleRadius" is locked by modification value in the viewer. Select a radius distance - SketchCircle:CircleRadius:GeomValidators_Positive + SketchMacroCircle:CircleRadius:GeomValidators_Positive Integer is not initialized. Integer radius is not initialized - SketchCircle:CircleRadius:GeomValidators_Positive + SketchMacroCircle:CircleRadius:GeomValidators_Positive Integer is not positive. Integer radius must be set - SketchCircle:Model_FeatureValidator + SketchMacroCircle:Model_FeatureValidator Attribute "CircleRadius" is not initialized. Set the circle radius diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index 44f52eefb..57c00874a 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -5,7 +5,8 @@ - - - - -