#include <SketchPlugin_ConstraintCoincidence.h>
#include <SketchPlugin_ConstraintFillet.h>
#include <SketchPlugin_ConstraintMirror.h>
+#include <SketchPlugin_MultiRotation.h>
+#include <SketchPlugin_MultiTranslation.h>
#include <SketcherPrs_Tools.h>
aOperation->abort();
return;
}
+ // Init flyout point for radius rotation
+ FeaturePtr aFeature = myCurrentSelection.begin().key();
if (isSketcher) {
myIsDragging = true;
get2dPoint(theWnd, theEvent, myCurrentPoint);
myDragDone = false;
launchEditing();
- // Init flyout point for radius rotation
- FeaturePtr aFeature = myCurrentSelection.begin().key();
- std::shared_ptr<SketchPlugin_Feature> aSPFeature =
- std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
- if (aSPFeature->getKind() == SketchPlugin_ConstraintRadius::ID()) {
- DataPtr aData = aSPFeature->data();
- AttributePtr aAttr = aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
- std::shared_ptr<GeomDataAPI_Point2D> aFPAttr =
- std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aAttr);
- aFPAttr->setValue(myCurrentPoint.myCurX, myCurrentPoint.myCurY);
+ if (aFeature.get() != NULL) {
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+ if (aSPFeature.get() && aSPFeature->getKind() == SketchPlugin_ConstraintRadius::ID()) {
+ DataPtr aData = aSPFeature->data();
+ AttributePtr aAttr = aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
+ std::shared_ptr<GeomDataAPI_Point2D> aFPAttr =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aAttr);
+ aFPAttr->setValue(myCurrentPoint.myCurX, myCurrentPoint.myCurY);
+ }
}
-
} else if (isSketchOpe && isEditing) {
// If selected another object commit current result
aOperation->commit();
aIds << SketchPlugin_Point::ID().c_str();
aIds << SketchPlugin_Arc::ID().c_str();
aIds << SketchPlugin_Circle::ID().c_str();
- aIds << SketchPlugin_ConstraintLength::ID().c_str();
- aIds << SketchPlugin_ConstraintDistance::ID().c_str();
- aIds << SketchPlugin_ConstraintRigid::ID().c_str();
- aIds << SketchPlugin_ConstraintRadius::ID().c_str();
- aIds << SketchPlugin_ConstraintPerpendicular::ID().c_str();
- aIds << SketchPlugin_ConstraintParallel::ID().c_str();
- aIds << SketchPlugin_ConstraintHorizontal::ID().c_str();
- aIds << SketchPlugin_ConstraintVertical::ID().c_str();
- aIds << SketchPlugin_ConstraintEqual::ID().c_str();
- aIds << SketchPlugin_ConstraintTangent::ID().c_str();
- aIds << SketchPlugin_ConstraintCoincidence::ID().c_str();
aIds << SketchPlugin_ConstraintFillet::ID().c_str();
- aIds << SketchPlugin_ConstraintMirror::ID().c_str();
+ aIds.append(constraintsIdList());
}
return aIds;
}
aIds << SketchPlugin_ConstraintTangent::ID().c_str();
aIds << SketchPlugin_ConstraintCoincidence::ID().c_str();
aIds << SketchPlugin_ConstraintMirror::ID().c_str();
+ aIds << SketchPlugin_MultiRotation::ID().c_str();
+ aIds << SketchPlugin_MultiTranslation::ID().c_str();
}
return aIds;
}
+void PartSet_SketcherMgr::sketchSelectionModes(QIntList& theModes)
+{
+ theModes.clear();
+
+ theModes.append(SketcherPrs_Tools::Sel_Dimension_Text);
+ theModes.append(SketcherPrs_Tools::Sel_Dimension_Line);
+ theModes.append(SketcherPrs_Tools::Sel_Constraint);
+ theModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_VERTEX));
+ theModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_EDGE));
+}
bool PartSet_SketcherMgr::isSketchOperation(ModuleBase_Operation* theOperation)
{
myPlaneFilter->setPlane(aPln->impl<gp_Pln>());
}
aDisplayer->updateViewer();
+ // all sketch objects should be activated in the sketch selection modes by edit operation start
+ if (theOperation->isEditOperation())
+ activateObjectsInSketchMode(true);
}
void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation)
XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
QIntList aModes;
- if (isActive) {
- aModes.append(SketcherPrs_Tools::Sel_Dimension_Text);
- aModes.append(SketcherPrs_Tools::Sel_Dimension_Line);
- aModes.append(SketcherPrs_Tools::Sel_Constraint);
- aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_VERTEX));
- aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_EDGE));
- }
+ if (isActive)
+ sketchSelectionModes(aModes);
aDisplayer->activateObjects(aModes);
}