]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Minor changes and optimization
authormpv <mpv@opencascade.com>
Mon, 6 Jun 2016 13:54:56 +0000 (16:54 +0300)
committermpv <mpv@opencascade.com>
Mon, 6 Jun 2016 13:54:56 +0000 (16:54 +0300)
src/ModelAPI/Test/Test1512.py
src/PartSet/PartSet_Validators.cpp
src/SketchPlugin/SketchPlugin_Arc.cpp

index 7ed32b0a6fb2ac679577e36eefb05ebce33bd5d1..25f843acf37e3313c333acdaead8a175c4502b5f 100755 (executable)
@@ -143,6 +143,9 @@ check_owner("Boolean_2_1/Modified_2", "face", aTower)
 check_owner("Boolean_2_1/Modified_3&Extrusion_1_1/Generated_Face_2", "edge", aBox)
 check_owner("Boolean_2_1/Modified_2&Extrusion_3_1/To_Face_1_1", "edge", aTower)
 
+# check the connected topology method: solid is not a compound of connected topology
+assert(aFuse.firstResult().shape().isConnectedTopology() == False)
+
 #=========================================================================
 # End of test
 #=========================================================================
index 805d6a6210f13c7468f37a131fe5c348077eb70b..9766c0a9ee319424ef0817137272855b5e09d99a 100755 (executable)
@@ -367,15 +367,14 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute
     AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
     bool isObject = anAttr->isObject();
     ObjectPtr anObject = anAttr->object();
-    AttributePtr anAttributeAttr = anAttr->attr();
 
     anAttrs = aFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId());
     if (anAttrs.size() > 0) {
-      std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = anAttrs.begin();
-      for(; anAttr != anAttrs.end(); anAttr++) {
-      if ((*anAttr).get() && (*anAttr)->id() != theAttribute->id()) {
+      std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttrIter = anAttrs.begin();
+      for(; anAttrIter != anAttrs.end(); anAttrIter++) {
+      if ((*anAttrIter).get() && (*anAttrIter)->id() != theAttribute->id()) {
           std::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
-                                      std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttr);
+                                      std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttrIter);
           if (aRef->isObject() != isObject)
             continue;
           if (isObject) {
@@ -386,6 +385,7 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute
             }
           }
           else { // the attribute reference
+            AttributePtr anAttributeAttr = anAttr->attr();
             if (aRef->attr() == anAttributeAttr) {
               theError = errorMessage(EqualAttributes,
                                       anAttributeAttr.get() ? anAttributeAttr->id() : "",
index 29031a04b253e4abfd27ecf604f623e5fa52bbe8..aa6e7fb4fe682ea27dff47960d17dd91914175ae 100644 (file)
@@ -106,11 +106,8 @@ void SketchPlugin_Arc::initDerivedClassAttributes()
   data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID());
 
-  data()->addAttribute(INVERSED_ID(), ModelAPI_AttributeBoolean::typeId());
-  AttributeBooleanPtr isInversed =
-      std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(attribute(INVERSED_ID()));
-  if (!isInversed->isInitialized())
-    isInversed->setValue(false);
+  AttributeBooleanPtr isInversed = std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
+    data()->addAttribute(INVERSED_ID(), ModelAPI_AttributeBoolean::typeId()));
 
   // get the initial values
   if (anEndAttr->isInitialized()) {
@@ -118,14 +115,18 @@ void SketchPlugin_Arc::initDerivedClassAttributes()
     myYEndBefore = anEndAttr->y();
   }
 
-  data()->addAttribute(ARC_TYPE(), ModelAPI_AttributeString::typeId());
-  std::dynamic_pointer_cast<ModelAPI_AttributeString>(
-      data()->attribute(ARC_TYPE()))->setValue(ARC_TYPE_CENTER_START_END());
+  AttributeStringPtr anArcType = std::dynamic_pointer_cast<ModelAPI_AttributeString>(
+    data()->addAttribute(ARC_TYPE(), ModelAPI_AttributeString::typeId()));
 
   data()->addAttribute(PASSED_POINT_ID(), GeomDataAPI_Point2D::typeId());
   data()->addAttribute(TANGENT_POINT_ID(), ModelAPI_AttributeRefAttr::typeId());
   data()->addAttribute(RADIUS_ID(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
+
+  // set after all to avoid in attributeChanged reference to not existing attributes
+  if (!isInversed->isInitialized())
+    isInversed->setValue(false);
+  anArcType->setValue(ARC_TYPE_CENTER_START_END());
 }
 
 void SketchPlugin_Arc::execute()