the flyout value should to be computed here, not in the getAISObject in order to change the model value
inside the object transaction. This is important for creating a constraint by preselection.
The display of the presentation in this case happens after the transaction commit
if(aDistance >= 0) {
anAttrValue->setValue(aDistance);
}
+
+ // the value should to be computed here, not in the getAISObject in order to change the model value
+ // inside the object transaction. This is important for creating a constraint by preselection.
+ // The display of the presentation in this case happens after the transaction commit
+ std::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = std::dynamic_pointer_cast<
+ GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+ if(!aFlyOutAttr->isInitialized())
+ compute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
}
bool SketchPlugin_ConstraintDistance::compute(const std::string& theAttributeId)
std::shared_ptr<GeomAPI_Pnt> aPoint1 = sketch()->to3D(aPnt_A->x(), aPnt_A->y());
std::shared_ptr<GeomAPI_Pnt> aPoint2 = sketch()->to3D(aPnt_B->x(), aPnt_B->y());
if(!aFlyOutAttr->isInitialized())
- compute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
+ return AISObjectPtr();
std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = sketch()->to3D(aFlyOutAttr->x(), aFlyOutAttr->y()/*aFPnt->x(), aFPnt->y()*/);
// value calculation
//if(!aValueAttr->isInitialized()) {
// aValueAttr->setValue(aLenght);
//}
+
+ // the value should to be computed here, not in the getAISObject in order to change the model value
+ // inside the object transaction. This is important for creating a constraint by preselection.
+ // The display of the presentation in this case happens after the transaction commit
+ AttributePtr aFlyOutAttribute = data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
+ if (!aFlyOutAttribute->isInitialized()) {
+ compute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
+ }
}
}
AttributePtr aFlyOutAttribute = data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
if (!aFlyOutAttribute->isInitialized()) {
- if (!compute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()))
- return thePrevious; // not possible to show length because points are not defined
+ return thePrevious; // not possible to show length because points are not defined
}
std::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aFlyOutAttribute);
//if(!aValueAttr->isInitialized()) {
// aValueAttr->setValue(aRadius);
//}
+
+ // the value should to be computed here, not in the getAISObject in order to change the model value
+ // inside the object transaction. This is important for creating a constraint by preselection.
+ // The display of the presentation in this case happens after the transaction commit
+ std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = std::dynamic_pointer_cast<
+ GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+ if (!aFlyoutAttr->isInitialized())
+ compute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
}
}
// Flyout point
std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
- if (!aFlyoutAttr->isInitialized() && !compute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()))
+ if (!aFlyoutAttr->isInitialized())
return thePrevious; // can not create a good presentation
std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = sketch()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y());