- if (!SketchPlugin_Feature::preview())
- {
-
- shared_ptr<GeomAPI_Pnt> anOrigin(new GeomAPI_Pnt(0, 0, 0));
- shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(1, 0, 0));
- shared_ptr<GeomAPI_Shape> aFace =
- GeomAlgoAPI_FaceBuilder::square(anOrigin, aNormal, PLANE_SIZE);
- setPreview(aFace);
- }
- return SketchPlugin_Feature::preview();
+ std::list<boost::shared_ptr<GeomAPI_Shape> > 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<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aFaces);
+ setPreview(aCompound);
+
+ return getPreview();
+}
+
+void SketchPlugin_Sketch::addPlane(double theX, double theY, double theZ,
+ std::list<boost::shared_ptr<GeomAPI_Shape> >& theShapes) const
+{
+ boost::shared_ptr<GeomAPI_Pnt> anOrigin(new GeomAPI_Pnt(0, 0, 0));
+ boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(theX, theY, theZ));
+ boost::shared_ptr<GeomAPI_Shape> aFace =
+ GeomAlgoAPI_FaceBuilder::square(anOrigin, aNormal, PLANE_SIZE);
+ theShapes.push_back(aFace);