]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update processing coincidence between origin and a line's attribute (issue #1181)
authorazv <azv@opencascade.com>
Tue, 29 Dec 2015 13:57:39 +0000 (16:57 +0300)
committermpv <mpv@opencascade.com>
Wed, 30 Dec 2015 16:49:54 +0000 (19:49 +0300)
src/SketchSolver/SketchSolver_Builder.cpp
src/SketchSolver/SketchSolver_Storage.cpp
src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp
src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp

index c01e8817a418d2951a545b288dc6c7a3e3d5881d..ff34136493468ad554df9d61b17ed0fba4badf95 100644 (file)
@@ -119,6 +119,8 @@ std::shared_ptr<GeomAPI_Pnt2d> SketchSolver_Builder::point(EntityWrapperPtr theE
 {
   if (theEntity->type() != ENTITY_POINT)
     return std::shared_ptr<GeomAPI_Pnt2d>();
+  if (theEntity->subEntities().size() == 1) // SketchPlugin_Point wrapper
+    return point(theEntity->subEntities().front());
 
   double aXY[2];
   std::list<ParameterWrapperPtr> aParams = theEntity->parameters();
index e54aec7e42ca3233a6de81668ae6a370872d2de7..e606f44c132d84324274139e8eaac3bcc90e9c0d 100644 (file)
@@ -153,6 +153,11 @@ bool SketchSolver_Storage::update(FeaturePtr theFeature, const GroupID& theGroup
     // Secondly, convert feature
     BuilderPtr aBuilder = SketchSolver_Manager::instance()->builder();
     GroupID aGroup = theGroup != GID_UNKNOWN ? theGroup : myGroupID;
+    // Check external feature
+    std::shared_ptr<SketchPlugin_Feature> aSketchFeature = 
+        std::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
+    if (aSketchFeature && aSketchFeature->isExternal())
+      aGroup = GID_OUTOFGROUP;
     aRelated = aBuilder->createFeature(theFeature, aSubs, aGroup);
     if (!aRelated)
       return false;
@@ -194,6 +199,11 @@ bool SketchSolver_Storage::update(AttributePtr theAttribute, const GroupID& theG
     }
     BuilderPtr aBuilder = SketchSolver_Manager::instance()->builder();
     GroupID aGroup = theGroup != GID_UNKNOWN ? theGroup : myGroupID;
+    // Check attribute of external features
+    std::shared_ptr<SketchPlugin_Feature> aSketchFeature = 
+        std::dynamic_pointer_cast<SketchPlugin_Feature>(theAttribute->owner());
+    if (aSketchFeature && aSketchFeature->isExternal())
+      aGroup = GID_OUTOFGROUP;
     aRelated = aBuilder->createAttribute(anAttribute, aGroup);
     if (!aRelated)
       return false;
index 68ce5aaf3b7cc2b4628166aff6bf1915937e5d12..704b4b0d53e2c10dee70736c302b2ee9ffa304c5 100644 (file)
@@ -308,13 +308,16 @@ EntityWrapperPtr SolveSpaceSolver_Builder::createFeature(
     AttributePtr aPoint = theFeature->attribute(SketchPlugin_Point::COORD_ID());
     if (!aPoint->isInitialized())
       return aDummy;
-    EntityWrapperPtr aSub = createAttribute(aPoint, theGroupID, theSketchID);
+    EntityWrapperPtr aSub = theAttributes.empty() ? createAttribute(aPoint, theGroupID, theSketchID) :
+                            theAttributes.front();
     if (!aSub)
       return aDummy;
 
     const Slvs_Entity& aSubEnt =
         std::dynamic_pointer_cast<SolveSpaceSolver_EntityWrapper>(aSub)->entity();
-    return EntityWrapperPtr(new SolveSpaceSolver_EntityWrapper(theFeature, aPoint, aSubEnt));
+    EntityWrapperPtr aResult(new SolveSpaceSolver_EntityWrapper(theFeature, aPoint, aSubEnt));
+    aResult->setSubEntities(theAttributes);
+    return aResult;
   }
 
   // wrong entity
index 7a185c8aff9dff14a95b3847438371cb9805842f..e065fd245a7233bb4c5670124d34dd77396fea83 100644 (file)
@@ -274,6 +274,13 @@ void SolveSpaceSolver_Storage::addCoincidentPoints(
 {
   if (theMaster->type() != ENTITY_POINT || theSlave->type() != ENTITY_POINT)
     return;
+  if (!theMaster->subEntities().empty() || !theSlave->subEntities().empty()) {
+    EntityWrapperPtr aSubMaster = theMaster->subEntities().empty() ?
+        theMaster : theMaster->subEntities().front();
+    EntityWrapperPtr aSubSlave = theSlave->subEntities().empty() ?
+        theSlave : theSlave->subEntities().front();
+    return addCoincidentPoints(aSubMaster, aSubSlave);
+  }
 
   // Search available coincidence
   CoincidentPointsMap::iterator aMasterFound = myCoincidentPoints.find(theMaster);