#include <SketchPlugin_ConstraintRigid.h>
#include <SketchPlugin_ConstraintTangent.h>
#include <SketchPlugin_Feature.h>
-#include <SketchPlugin_MultiTranslation.h>
#include <SketchPlugin_Arc.h>
#include <SketchPlugin_Circle.h>
setTemporary(aConstraint);
}
}
- //// Fix base features for mirror
- //if (theConstraint->getKind() == SketchPlugin_ConstraintMirror::ID()) {
- // AttributeRefListPtr aRefList = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
- // theConstraint->attribute(SketchPlugin_ConstraintMirror::ENTITY_B()));
- // fixFeaturesList(aRefList);
- //}
+ // Fix mirror line
+ if (theConstraint->getKind() == SketchPlugin_ConstraintMirror::ID()) {
+ AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
+ theConstraint->attribute(SketchPlugin_ConstraintMirror::ENTITY_A()));
+ if (aRefAttr && aRefAttr->isObject()) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object());
+ if (aFeature) {
+ SolverConstraintPtr aConstraint =
+ SketchSolver_Builder::getInstance()->createRigidConstraint(aFeature);
+ if (aConstraint) {
+ aConstraint->setGroup(this);
+ aConstraint->setStorage(myStorage);
+ setTemporary(aConstraint);
+ }
+ }
+ }
+ }
if (!myFeatureStorage)
myFeatureStorage = FeatureStoragePtr(new SketchSolver_FeatureStorage);
{
// Firstly, create temporary rigid constraint
SolverConstraintPtr aConstraint =
- SketchSolver_Builder::getInstance()->createRigidConstraint(theFeature);
+ SketchSolver_Builder::getInstance()->createMovementConstraint(theFeature);
if (!aConstraint)
return;
aConstraint->setGroup(this);
else {
// To avoid overconstraint situation, we will remove temporary constraints one-by-one
// and try to find the case without overconstraint
- int aNbTemp = (int)myTempConstraints.size();
+ int aNbTemp = myStorage->numberTemporary();
while (true) {
aResult = myConstrSolver.solve();
if (aResult == SLVS_RESULT_OKAY || aNbTemp <= 0)
void SketchSolver_Group::removeTemporaryConstraints()
{
myTempConstraints.clear();
- myStorage->removeTemporaryConstraints();
+ while (myStorage->numberTemporary())
+ myStorage->deleteTemporaryConstraint();
// Clean lists of removed entities in the storage
std::set<Slvs_hParam> aRemPar;
std::set<Slvs_hEntity> aRemEnt;