#include <math.h>
#include <vector>
-using namespace std;
-
SketchPlugin_Sketch::SketchPlugin_Sketch()
{
}
data()->addAttribute(SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir::typeId());
data()->addAttribute(SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList::typeId());
// the selected face, base for the sketcher plane, not obligatory
- data()->addAttribute(SketchPlugin_SketchEntity::EXTERNAL_ID(),
+ data()->addAttribute(SketchPlugin_SketchEntity::EXTERNAL_ID(),
ModelAPI_AttributeSelection::typeId());
ModelAPI_Session::get()->validators()->registerNotObligatory(
getKind(), SketchPlugin_SketchEntity::EXTERNAL_ID());
if (!data()->isValid()) // sketch is already removed (case on undo of sketch), sync is not needed
return;
AttributeRefListPtr aList = reflist(SketchPlugin_Sketch::FEATURES_ID());
- // if the object is last, remove it from the list
+ // if the object is last, remove it from the list
// (needed to skip empty transaction on edit of sketch feature)
if (aList->object(aList->size(true) - 1, true) == theFeature) {
aList->remove(theFeature);
int aResultIndex = 1; // number of the counted (created) features, started from 1
int aFeatureIndex = -1; // number of the not-empty features in the list
for (; anIt != aFeatures.end(); anIt++) {
- if (anIt->get())
+ if (anIt->get())
aFeatureIndex++;
if (aFeatureIndex == theIndex)
break;
void SketchPlugin_Sketch::attributeChanged(const std::string& theID) {
if (theID == SketchPlugin_SketchEntity::EXTERNAL_ID()) {
- std::shared_ptr<GeomAPI_Shape> aSelection =
+ std::shared_ptr<GeomAPI_Shape> aSelection =
data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())->value();
if (aSelection) { // update arguments due to the selection value
// update the sketch plane
std::shared_ptr<GeomAPI_Pnt> anOrigPnt(new GeomAPI_Pnt(aCoords));
// X axis is preferable to be dirX on the sketch
// here can not be very small value to avoid very close to X normal axis (issue 595)
- static const double tol = 0.1;
+ static const double tol = 0.1;
bool isX = fabs(anA) - 1.0 < tol && fabs(aB) < tol && fabs(aC) < tol;
std::shared_ptr<GeomAPI_Dir> aTempDir(
isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0));