]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Adopt the python scripts and C++ code for making extrusion on dedicated sketch faces
authormpv <mpv@opencascade.com>
Thu, 16 Apr 2015 08:36:02 +0000 (11:36 +0300)
committermpv <mpv@opencascade.com>
Thu, 16 Apr 2015 08:36:02 +0000 (11:36 +0300)
src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp
src/Model/Model_AttributeSelection.cpp
src/PythonAPI/MakeBrick1.py

index 7e64d882cef1cdd93fd151e80639618ac2e2c976..8359b32448f7c4364eba15947190893696733dbb 100644 (file)
@@ -380,13 +380,24 @@ void GeomAlgoAPI_SketchBuilder::createFaces(const std::shared_ptr<GeomAPI_Pnt>&
                                             const std::shared_ptr<GeomAPI_Shape>& theWire,
                                             std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces)
 {
-  std::shared_ptr<GeomAPI_PlanarEdges> aWire = std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(theWire);
-  if(!aWire)
-    return;
-  // Filter wires, return only faces.
   std::list<std::shared_ptr<GeomAPI_Shape> > aFilteredWires;
-  createFaces(theOrigin, theDirX, theNorm,
-              aWire->getEdges(), theResultFaces, aFilteredWires);
+  std::shared_ptr<GeomAPI_PlanarEdges> aWire = 
+    std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(theWire);
+  if(aWire) {
+    // Filter wires, return only faces.
+    createFaces(theOrigin, theDirX, theNorm,
+                aWire->getEdges(), theResultFaces, aFilteredWires);
+
+    return;
+  } else { // it may be only one circle
+    std::shared_ptr<GeomAPI_Edge> anEdge = std::dynamic_pointer_cast<GeomAPI_Edge>(theWire);
+    if (anEdge) {
+      std::list<std::shared_ptr<GeomAPI_Shape> > aList;
+      aList.push_back(anEdge);
+      createFaces(theOrigin, theDirX, theNorm,
+                  aList, theResultFaces, aFilteredWires);
+    }
+  }
 }
 
 
index b522b90a14129a9ab8c084943d5a69adce963db2..fb7c6925daa15c508242fc971bcea89eb97950dc 100644 (file)
@@ -121,6 +121,8 @@ void Model_AttributeSelection::setValue(const ResultPtr& theContext,
   //the attribute initialized state should be changed by sendAttributeUpdated only
   //myIsInitialized = true;
 
+  owner()->data()->sendAttributeUpdated(this);
+
   std::string aSelName = namingName();
   if(!aSelName.empty())
     TDataStd_Name::Set(selectionLabel(), aSelName.c_str()); //set name
@@ -131,7 +133,6 @@ void Model_AttributeSelection::setValue(const ResultPtr& theContext,
   //selectSubShape("EDGE", "Extrusion_1/TopFace|Extrusion_1/LateralFace_1");
   //selectSubShape("EDGE", "Sketch_1/Edge_6");
 #endif
-  owner()->data()->sendAttributeUpdated(this);
 }
 
 std::shared_ptr<GeomAPI_Shape> Model_AttributeSelection::value()
index 349c47e529095301f675932af812b87faf9de9a9..8320de0264fe9ebe45263f89eb1e869968304150 100644 (file)
@@ -70,5 +70,5 @@ modeler.end()
 
 modeler.begin()
 mybase.setValue( mylength, 100 )
-mybox.setSize( 20 )
+mybox.setSize( 80 )
 modeler.end()