#include "SketchSolver_Builder.h"
#include <SketchSolver_ConstraintCoincidence.h>
+#include <SketchSolver_ConstraintDistance.h>
+#include <SketchSolver_ConstraintEqual.h>
+#include <SketchSolver_ConstraintFillet.h>
+#include <SketchSolver_ConstraintLength.h>
+#include <SketchSolver_ConstraintMirror.h>
#include <SketchSolver_ConstraintRigid.h>
+#include <SketchSolver_ConstraintTangent.h>
+#include <SketchSolver_ConstraintMultiRotation.h>
+#include <SketchSolver_ConstraintMultiTranslation.h>
+#include <SketchSolver_Error.h>
#include <GeomAPI_Edge.h>
#include <GeomDataAPI_Dir.h>
#include <GeomDataAPI_Point.h>
#include <GeomDataAPI_Point2D.h>
+#include <Events_Error.h>
#include <ModelAPI_Attribute.h>
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeRefAttr.h>
#include <SketchPlugin_ConstraintRigid.h>
#include <SketchPlugin_ConstraintTangent.h>
#include <SketchPlugin_ConstraintVertical.h>
+#include <SketchPlugin_MultiRotation.h>
+#include <SketchPlugin_MultiTranslation.h>
+#include <math.h>
// Initialization of constraint builder self pointer
SketchSolver_Builder* SketchSolver_Builder::mySelf = 0;
if (!aData || !aData->isValid())
return aResult;
+#ifdef _DEBUG
+ // Verify attributes of constraint and generate errors
+ std::list<AttributePtr> anAttrList = aData->attributes(std::string());
+ std::list<AttributePtr>::iterator anIter = anAttrList.begin();
+ for (; anIter != anAttrList.end(); anIter++) {
+ AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anIter);
+ if (aRefAttr) {
+ if (aRefAttr->isObject() && aRefAttr->object()) {
+ ResultConstructionPtr aRC =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aRefAttr->object());
+ if (!aRC)
+ Events_Error::send(SketchSolver_Error::NEED_OBJECT_NOT_FEATURE(), this);
+ }
+ continue;
+ }
+ AttributeRefListPtr aRefList = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(*anIter);
+ if (aRefList) {
+ std::list<ObjectPtr> aList = aRefList->list();
+ std::list<ObjectPtr>::iterator aListIter = aList.begin();
+ for (; aListIter != aList.end(); aListIter++) {
+ ResultConstructionPtr aRC =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aListIter);
+ if (*aListIter && !aRC)
+ Events_Error::send(SketchSolver_Error::NEED_OBJECT_NOT_FEATURE(), this);
+ }
+ }
+ }
+#endif
+
if (theConstraint->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
return SolverConstraintPtr(new SketchSolver_ConstraintCoincidence(theConstraint));
} else if (theConstraint->getKind() == SketchPlugin_ConstraintDistance::ID()) {
return SolverConstraintPtr(new SketchSolver_ConstraintDistance(theConstraint));
} else if (theConstraint->getKind() == SketchPlugin_ConstraintEqual::ID()) {
-//// return SolverConstraintPtr(new SketchSolver_ConstraintEqual(theConstraint));
+ return SolverConstraintPtr(new SketchSolver_ConstraintEqual(theConstraint));
} else if (theConstraint->getKind() == SketchPlugin_ConstraintFillet::ID()) {
-//// return SolverConstraintPtr(new SketchSolver_ConstraintFillet(theConstraint));
+ return SolverConstraintPtr(new SketchSolver_ConstraintFillet(theConstraint));
} else if (theConstraint->getKind() == SketchPlugin_ConstraintHorizontal::ID()) {
return SolverConstraintPtr(new SketchSolver_ConstraintHorizontal(theConstraint));
} else if (theConstraint->getKind() == SketchPlugin_ConstraintLength::ID()) {
-//// return SolverConstraintPtr(new SketchSolver_ConstraintLength(theConstraint));
+ return SolverConstraintPtr(new SketchSolver_ConstraintLength(theConstraint));
} else if (theConstraint->getKind() == SketchPlugin_ConstraintMirror::ID()) {
-//// return SolverConstraintPtr(new SketchSolver_ConstraintMirror(theConstraint));
+ return SolverConstraintPtr(new SketchSolver_ConstraintMirror(theConstraint));
} else if (theConstraint->getKind() == SketchPlugin_ConstraintParallel::ID()) {
return SolverConstraintPtr(new SketchSolver_ConstraintParallel(theConstraint));
} else if (theConstraint->getKind() == SketchPlugin_ConstraintPerpendicular::ID()) {
return SolverConstraintPtr(new SketchSolver_ConstraintPerpendicular(theConstraint));
} else if (theConstraint->getKind() == SketchPlugin_ConstraintRadius::ID()) {
-//// return SolverConstraintPtr(new SketchSolver_ConstraintRadius(theConstraint));
+ return SolverConstraintPtr(new SketchSolver_ConstraintRadius(theConstraint));
} else if (theConstraint->getKind() == SketchPlugin_ConstraintTangent::ID()) {
-//// return SolverConstraintPtr(new SketchSolver_ConstraintTangent(theConstraint));
+ return SolverConstraintPtr(new SketchSolver_ConstraintTangent(theConstraint));
} else if (theConstraint->getKind() == SketchPlugin_ConstraintVertical::ID()) {
return SolverConstraintPtr(new SketchSolver_ConstraintVertical(theConstraint));
} else if (theConstraint->getKind() == SketchPlugin_ConstraintRigid::ID()) {
return SolverConstraintPtr(new SketchSolver_ConstraintRigid(theConstraint));
+ } else if (theConstraint->getKind() == SketchPlugin_MultiTranslation::ID()) {
+ return SolverConstraintPtr(new SketchSolver_ConstraintMultiTranslation(theConstraint));
+ } else if (theConstraint->getKind() == SketchPlugin_MultiRotation::ID()) {
+ return SolverConstraintPtr(new SketchSolver_ConstraintMultiRotation(theConstraint));
}
return aResult;
}