#include <SketchSolver_Group.h>
#include <SketchPlugin_Point.h>
+#include <GeomDataAPI_Point2D.h>
#include <map>
if (!myErrorMsg.empty() || theAttributes[0] == SLVS_E_UNKNOWN)
return;
- if (theAttributes[1] != SLVS_E_UNKNOWN)
+ if (theAttributes[1] != SLVS_E_UNKNOWN) {
myType = SLVS_C_POINTS_COINCIDENT;
+
+ // set coordinates of slave (second) point equal to the master (first) point
+ Slvs_Entity aFirst = myStorage->getEntity(theAttributes[0]);
+ Slvs_Entity aSecond = myStorage->getEntity(theAttributes[1]);
+ for (int i = 0; i < 4; i++)
+ if (aFirst.param[i] != SLVS_E_UNKNOWN && aSecond.param[i] != SLVS_E_UNKNOWN) {
+ Slvs_Param aPar1 = myStorage->getParameter(aFirst.param[i]);
+ Slvs_Param aPar2 = myStorage->getParameter(aSecond.param[i]);
+ aPar2.val = aPar1.val;
+ myStorage->updateParameter(aPar2);
+ }
+ }
else if (theAttributes[2] != SLVS_E_UNKNOWN) {
// check the type of entity (line or circle)
Slvs_Entity anEnt = myStorage->getEntity(theAttributes[2]);
anEntity = myGroup->getFeatureId(aFeature);
if (anEntity == SLVS_E_UNKNOWN)
anEntity = changeEntity(aFeature, anEntType);
- else
+ else {
myFeatureMap[aFeature] = anEntity;
+ // Obtain relations between attributes of the feature and SolveSpace entities
+ std::list<AttributePtr> anAttrList =
+ aFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
+ std::list<AttributePtr>::iterator anIt = anAttrList.begin();
+ for (; anIt != anAttrList.end(); ++anIt) {
+ Slvs_hEntity anAttrID = myGroup->getAttributeId(*anIt);
+ if (anAttrID != SLVS_E_UNKNOWN)
+ myAttributeMap[*anIt] = anAttrID;
+ }
+ }
}
// If the feature is a point, add it to the list of coincident points
if (aFeature->getKind() == SketchPlugin_Point::ID()) {