X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Sketch.cpp;h=1d97cb2b051be4fd0e51d787f4f9591d8989b2b9;hb=cc317d39fcb6bdf56dedd13c7a8141b17d9caab8;hp=13b61db1fbfaf04c26121633d179d7b75d351804;hpb=0b636ffd42324731b8dba44ad3b9ace84a8c5d4f;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Sketch.cpp b/src/SketchPlugin/SketchPlugin_Sketch.cpp index 13b61db1f..1d97cb2b0 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.cpp +++ b/src/SketchPlugin/SketchPlugin_Sketch.cpp @@ -35,14 +35,18 @@ void SketchPlugin_Sketch::execute() const boost::shared_ptr& SketchPlugin_Sketch::preview() { - std::list > aFaces; - - addPlane(1, 0, 0, aFaces); // YZ plane - addPlane(0, 1, 0, aFaces); // XZ plane - addPlane(0, 0, 1, aFaces); // XY plane - boost::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aFaces); - setPreview(aCompound); + if (isPlaneSet()) { + setPreview(boost::shared_ptr()); + } + else { + std::list > aFaces; + addPlane(1, 0, 0, aFaces); // YZ plane + addPlane(0, 1, 0, aFaces); // XZ plane + addPlane(0, 0, 1, aFaces); // XY plane + boost::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aFaces); + setPreview(aCompound); + } return getPreview(); } @@ -76,3 +80,11 @@ boost::shared_ptr SketchPlugin_Sketch::to3D(const double theX, cons return boost::shared_ptr(new GeomAPI_Pnt(aSum)); } + +bool SketchPlugin_Sketch::isPlaneSet() +{ + boost::shared_ptr aNormal = + boost::dynamic_pointer_cast(data()->attribute(SKETCH_ATTR_NORM)); + + return aNormal && !(aNormal->x() == 0 && aNormal->y() == 0 && aNormal->z() == 0); +}