]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0022759: [EDF] Creation of a surface from several edges: added test and example mpa/22759
authormpa <mpa@opencascade.com>
Tue, 9 Dec 2014 08:06:01 +0000 (11:06 +0300)
committermpa <mpa@opencascade.com>
Tue, 9 Dec 2014 08:06:01 +0000 (11:06 +0300)
doc/salome/examples/topological_geom_objs_ex03.py
src/BuildGUI/BuildGUI_FaceDlg.cxx
src/GEOMBase/GEOMBase_Helper.cxx
src/GEOMBase/GEOMBase_Helper.h
src/GEOM_SWIG/GEOM_TestAll.py

index 972d81a6fba091537adbaaeac57577a5cf884ca8..a88e685789915978231f4a4f2202e71311ec2cfa 100644 (file)
@@ -30,6 +30,10 @@ sketcher2 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
 sketcher3 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
 isPlanarFace = 1
 
+sphere = geompy.MakeSphereR(100)
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+cut = geompy.MakeCutList(sphere, [box], True)
+
 # create a face from the wire
 face1 = geompy.MakeFace(wire, isPlanarFace)
 
@@ -38,11 +42,17 @@ face2 = geompy.MakeFaceWires([wire, sketcher1],isPlanarFace)
 face3 = geompy.MakeFaces([sketcher2, sketcher3],isPlanarFace)
 face4 = geompy.MakeFaceFromSurface(face1, sketcher1)
 
+# create face on wire with constraints
+face5 = geompy.MakeFaceWithConstraints([geompy.GetSubShape(cut, [5]), geompy.GetSubShape(cut, [3]), 
+                                        geompy.GetSubShape(cut, [11]), geompy.GetSubShape(cut, [3]), 
+                                        geompy.GetSubShape(cut, [13]), geompy.GetSubShape(cut, [3])])
+
 # add objects in the study
 id_face1 = geompy.addToStudy(face1,"Face1")
 id_face2 = geompy.addToStudy(face2,"Face2")
 id_face3 = geompy.addToStudy(face3,"Face3")
 id_face4 = geompy.addToStudy(face4,"Face4")
+id_face5 = geompy.addToStudy(face5,"Face5")
 
 # display the faces
 gg.createAndDisplayGO(id_face1)
@@ -57,3 +67,6 @@ gg.setTransparency(id_face3,0.2)
 gg.createAndDisplayGO(id_face4)
 gg.setDisplayMode(id_face4,1)
 gg.setTransparency(id_face4,0.2)
+gg.createAndDisplayGO(id_face5)
+gg.setDisplayMode(id_face5,1)
+gg.setTransparency(id_face5,0.2)
index f1b0a46014913738366d469fa0e2617f1c6b2dc9..f5c569ad29d6ed390633b2afa3920236f83ba555 100644 (file)
@@ -346,6 +346,7 @@ bool BuildGUI_FaceDlg::ClickOnApply()
 //=================================================================================
 void BuildGUI_FaceDlg::SelectionIntoArgument()
 {
+  erasePreview();
   if( myEditCurrentArgument == myGroupWire->LineEdit1 ) {
     myEditCurrentArgument->setText("");
 
@@ -394,8 +395,10 @@ void BuildGUI_FaceDlg::SelectionIntoArgument()
         myCurrentItem->setFace( aSelectedObject );
         findEmptyTreeItem();
       }
-      else
+      else {
         myCurrentItem->setFace(NULL);
+        displayPreview( myCurrentItem->getEdge().get(), true, false, true, 5, -1, Quantity_NOC_RED);
+      }
     }
     else {
       myWire.nullify();
@@ -414,7 +417,7 @@ void BuildGUI_FaceDlg::SelectionIntoArgument()
          }
     }
   }
-  //displayPreview(true);
+  displayPreview(true, false, true, true, -1, -1, -1, true);
 }
 
 
@@ -490,7 +493,7 @@ void BuildGUI_FaceDlg::onItemClicked( QTreeWidgetItem* theItem, int theColumn )
     return;
 
   myCurrentItem = dynamic_cast<BuildGUI_TreeWidgetItem*>( theItem );
-  erasePreview();
+  displayPreview( true );
   displayPreview( myCurrentItem->getEdge().get(), true, false, true, 5, -1, Quantity_NOC_RED);
 }
 
@@ -575,9 +578,9 @@ bool BuildGUI_FaceDlg::execute( ObjectList& objects )
     int j = 0;
     for( int i = 0; i < numberOfItems; i++ ) {
       BuildGUI_TreeWidgetItem* item = dynamic_cast<BuildGUI_TreeWidgetItem*>( myTreeConstraints->topLevelItem(i) );
-      constraints[j++] = item->getEdge().get();
+      constraints[j++] = GEOM::GEOM_Object::_duplicate(item->getEdge().get());
       if ( item->getFace() )
-        constraints[j++] = item->getFace().get();
+        constraints[j++] = GEOM::GEOM_Object::_duplicate(item->getFace().get());
     }
     constraints->length(j);
     anObj = anOper->MakeFaceWithConstraints( constraints.in() );
index 037fd087aa54751f8432874437bbe047aa51e16d..439bfe7ee600945b137f04eb86f00b68b9128146 100755 (executable)
@@ -259,7 +259,8 @@ void GEOMBase_Helper::displayPreview( const bool   display,
                                       const bool   toRemoveFromEngine,
                                       const double lineWidth,
                                       const int    displayMode,
-                                      const int    color )
+                                      const int    color,
+                                      const bool   append )
 {
   if(!display) {
     erasePreview( update );
@@ -275,7 +276,8 @@ void GEOMBase_Helper::displayPreview( const bool   display,
     return;
   }
 
-  erasePreview( false );
+  if( !append )
+    erasePreview( false );
 
   try {
     SUIT_OverrideCursor wc;
index 731b63d06a8db714d1ca95f7ff91d26cd11d82fb..1878610e2d3d4c4bbf33d56788a6de8c5f2da6c3 100755 (executable)
@@ -79,7 +79,8 @@ protected:
                                 const bool   toRemoveFromEngine = true,
                                 const double lineWidth = -1,
                                 const int    displayMode = -1,
-                                const int    color  = -1 );
+                                const int    color  = -1,
+                                const bool   append = false );
   // This is the easiest way to show preview. It is based on execute() method.
   // It removes temporary GEOM::GEOM_Objects automatically.
 
index 6dafa5265f71f5458a4832b446206161a94a1e45..493aff99297fd5c220674d4badf7650a38ab322a 100644 (file)
@@ -179,6 +179,12 @@ def TestAll (geompy, math):
   Face3    = geompy.MakeFaceHW (100., 200., 1)       #(2 Doubles, 1 Int)->GEOM_Object
   Face4    = geompy.MakeFaceObjHW (vz, 200., 100.)   #(1 GEOM_Object, 2 Doubles)->GEOM_Object
   Face5    = geompy.MakeFaceFromSurface(Face, Sketcher) #(2 GEOM_Objects)->GEOM_Object
+  
+  Cut2 = geompy.MakeCutList(Sphere1, [Box1], True)
+  #(List of GEOM_Object)->GEOM_Object
+  Face6 = geompy.MakeFaceWithConstraints([geompy.GetSubShape(Cut2, [5]), geompy.GetSubShape(Cut2, [3]), 
+                                          geompy.GetSubShape(Cut2, [11]), geompy.GetSubShape(Cut2, [3]),
+                                          geompy.GetSubShape(Cut2, [13]), geompy.GetSubShape(Cut2, [3])])
   Disk     = geompy.MakeDiskPntVecR (p0, vz, radius) #(2 GEOM_Object, 1 Double)->GEOM_Object
   Disk2    = geompy.MakeDiskThreePnt(p0, p200, pz)   #(3 GEOM_Object)->GEOM_Object
   Disk3    = geompy.MakeDiskR(100., 1)               #(1 Doubles, 1 Int)->GEOM_Object
@@ -396,6 +402,7 @@ def TestAll (geompy, math):
 
   id_Common  = geompy.addToStudy(Common,  "Common")
   id_Cut     = geompy.addToStudy(Cut,     "Cut")
+  id_Cut2    = geompy.addToStudy(Cut2,     "Cut2")
   id_Fuse    = geompy.addToStudy(Fuse,    "Fuse")
   id_Section = geompy.addToStudy(Section, "Section")
 
@@ -408,6 +415,7 @@ def TestAll (geompy, math):
   id_Face3    = geompy.addToStudy(Face3,    "Face Height Width")
   id_Face4    = geompy.addToStudy(Face4,    "Face Plane_HW")
   id_Face5    = geompy.addToStudy(Face5,    "Face from surface and wire")
+  id_Face6    = geompy.addToStudy(Face6,    "Face on wire with constraints")
   id_Disk     = geompy.addToStudy(Disk,     "Disk PntVecR")
   id_Disk2    = geompy.addToStudy(Disk2,    "Disk Three Points")
   id_Disk3    = geompy.addToStudy(Disk3,    "Disk OXY Radius")