From 487933bf504a24e791c5ed64131a40689bd1c36f Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 16 Apr 2015 11:36:02 +0300 Subject: [PATCH] Adopt the python scripts and C++ code for making extrusion on dedicated sketch faces --- src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp | 23 ++++++++++++++----- src/Model/Model_AttributeSelection.cpp | 3 ++- src/PythonAPI/MakeBrick1.py | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp index 7e64d882c..8359b3244 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp @@ -380,13 +380,24 @@ void GeomAlgoAPI_SketchBuilder::createFaces(const std::shared_ptr& const std::shared_ptr& theWire, std::list >& theResultFaces) { - std::shared_ptr aWire = std::dynamic_pointer_cast(theWire); - if(!aWire) - return; - // Filter wires, return only faces. std::list > aFilteredWires; - createFaces(theOrigin, theDirX, theNorm, - aWire->getEdges(), theResultFaces, aFilteredWires); + std::shared_ptr aWire = + std::dynamic_pointer_cast(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 anEdge = std::dynamic_pointer_cast(theWire); + if (anEdge) { + std::list > aList; + aList.push_back(anEdge); + createFaces(theOrigin, theDirX, theNorm, + aList, theResultFaces, aFilteredWires); + } + } } diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index b522b90a1..fb7c6925d 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -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 Model_AttributeSelection::value() diff --git a/src/PythonAPI/MakeBrick1.py b/src/PythonAPI/MakeBrick1.py index 349c47e52..8320de026 100644 --- a/src/PythonAPI/MakeBrick1.py +++ b/src/PythonAPI/MakeBrick1.py @@ -70,5 +70,5 @@ modeler.end() modeler.begin() mybase.setValue( mylength, 100 ) -mybox.setSize( 20 ) +mybox.setSize( 80 ) modeler.end() -- 2.39.2