void SketchPlugin_Arc::updateDependentAttributes()
{
- data()->blockSendAttributeUpdated(true);
-
std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(CENTER_ID()));
std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
AttributeDoublePtr anAngleAttr = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
data()->attribute(ANGLE_ID()));
+ if (!aPassedPoint)
+ return;
+
+ data()->blockSendAttributeUpdated(true);
+
calculatePassedPoint(aCenterAttr->pnt(), aStartAttr->pnt(), anEndAttr->pnt(),
isReversed(), aPassedPoint);
- std::shared_ptr<GeomAPI_Circ2d> aCircle(
- new GeomAPI_Circ2d(aStartAttr->pnt(), anEndAttr->pnt(), aPassedPoint->pnt()));
- calculateArcAngleRadius(aCircle, aStartAttr->pnt(), anEndAttr->pnt(), aPassedPoint->pnt(),
- anAngleAttr, aRadiusAttr);
+ if (aRadiusAttr && anAngleAttr) {
+ std::shared_ptr<GeomAPI_Circ2d> aCircle(
+ new GeomAPI_Circ2d(aStartAttr->pnt(), anEndAttr->pnt(), aPassedPoint->pnt()));
+ calculateArcAngleRadius(aCircle, aStartAttr->pnt(), anEndAttr->pnt(), aPassedPoint->pnt(),
+ anAngleAttr, aRadiusAttr);
+ }
data()->blockSendAttributeUpdated(false);
}
aResult = mySketchSolver->solve();
if (aResult == STATUS_OK || aResult == STATUS_EMPTYSET || isLastChance)
break;
- // try to update parameters and resolve once again
- ConstraintConstraintMap::iterator aConstrIt = myConstraints.begin();
- for (; aConstrIt != myConstraints.end(); ++aConstrIt)
- aConstrIt->second->update();
+//// // try to update parameters and resolve once again
+//// ConstraintConstraintMap::iterator aConstrIt = myConstraints.begin();
+//// for (; aConstrIt != myConstraints.end(); ++aConstrIt)
+//// aConstrIt->second->update();
isLastChance = true;
removeTemporaryConstraints();
if (anEntity->baseAttribute()) {
BuilderPtr aBuilder = SolveSpaceSolver_Builder::getInstance();
EntityWrapperPtr anUpdAttr = aBuilder->createAttribute(anEntity->baseAttribute(), GID_UNKNOWN);
- if (anUpdAttr) {
+ if (anUpdAttr && !isFixed(theEntity)) {
std::list<ParameterWrapperPtr> anUpdParams = anUpdAttr->parameters();
std::list<ParameterWrapperPtr>::iterator anUpdIt = anUpdParams.begin();
for (aPIt = aParams.begin(); aPIt != aParams.end() && anUpdIt != anUpdParams.end();
for (; anAttrIt != myAttributeMap.end(); ++anAttrIt) {
if (!anAttrIt->second)
continue;
+ if (anAttrIt->second->group() == GID_OUTOFGROUP) {
+ Slvs_Entity anEnt = getEntity((Slvs_hEntity)anAttrIt->second->id());
+ if (anEnt.group != (Slvs_hEntity)GID_OUTOFGROUP)
+ anEnt.group = (Slvs_hEntity)GID_OUTOFGROUP;
+ updateEntity(anEnt);
+ }
+
const std::list<ParameterWrapperPtr>& aParameters = anAttrIt->second->parameters();
std::list<ParameterWrapperPtr>::const_iterator aParIt = aParameters.begin();
for (; aParIt != aParameters.end(); ++aParIt)
- if ((*aParIt)->group() == GID_OUTOFGROUP) {
+ if (anAttrIt->second->group() == GID_OUTOFGROUP || (*aParIt)->group() == GID_OUTOFGROUP) {
Slvs_Param aParam = getParameter((Slvs_hParam)(*aParIt)->id());
if (aParam.group != (Slvs_hParam)GID_OUTOFGROUP) {
aParam.group = (Slvs_hParam)GID_OUTOFGROUP;