Warning message was updated to show actual information.
Additional checking of type of shape was added to prevent exceptions for Add Dimension functionality.
// Now it's ok, local context is opened and edge selection mode is activated
// Check if some vertex is selected
myAISContext->LocalContext()->InitSelected();
- if (!myAISContext->LocalContext()->MoreSelected())
+ if (!myAISContext->LocalContext()->MoreSelected() ||
+ myAISContext->SelectedShape().ShapeType() != TopAbs_VERTEX)
{
AfxMessageBox (_T ("Choose the vertex and press the button again"),
MB_ICONINFORMATION | MB_OK);
void CAngleParamsVerticesPage::OnBnClickedVertex2Btn()
{
myAISContext->LocalContext()->InitSelected();
- if (!myAISContext->LocalContext()->MoreSelected())
+ if (!myAISContext->LocalContext()->MoreSelected() ||
+ myAISContext->SelectedShape().ShapeType() != TopAbs_VERTEX)
{
AfxMessageBox ( _T("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK);
return;
{
myAISContext->LocalContext()->InitSelected();
- if (!myAISContext->LocalContext()->MoreSelected())
+ if (!myAISContext->LocalContext()->MoreSelected() ||
+ myAISContext->SelectedShape().ShapeType() != TopAbs_EDGE)
{
- AfxMessageBox ( _T("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK);
+ AfxMessageBox ( _T("Choose the edge and press the button again"), MB_ICONINFORMATION | MB_OK);
return;
}
// Now it's ok, local context is opened and edge selection mode is activated
// Check if some edge is selected
myAISContext->LocalContext()->InitSelected();
- if (!myAISContext->LocalContext()->MoreSelected())
+ if (!myAISContext->LocalContext()->MoreSelected() ||
+ myAISContext->SelectedShape().ShapeType() != TopAbs_EDGE)
{
AfxMessageBox(_T("Choose the edge and press the button again"),
MB_ICONINFORMATION | MB_OK);
void CLengthParamsEdgesPage::OnBnClickedEdge2Btn()
{
myAISContext->LocalContext()->InitSelected();
- if (!myAISContext->LocalContext()->MoreSelected())
+ if (!myAISContext->LocalContext()->MoreSelected() ||
+ myAISContext->SelectedShape().ShapeType() != TopAbs_EDGE)
{
AfxMessageBox (_T("Choose the edge and press the button again"),
MB_ICONINFORMATION | MB_OK);
// Now it's ok, local context is opened and edge selection mode is activated
// Check if some edge is selected
myAISContext->LocalContext()->InitSelected();
- if (!myAISContext->LocalContext()->MoreSelected())
+ if (!myAISContext->LocalContext()->MoreSelected() ||
+ myAISContext->SelectedShape().ShapeType() != TopAbs_VERTEX)
{
AfxMessageBox (_T ("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK);
return;
void CLengthParamsVerticesPage::OnBnClickedVertex2Btn()
{
myAISContext->LocalContext()->InitSelected();
- if (!myAISContext->LocalContext()->MoreSelected())
+ if (!myAISContext->LocalContext()->MoreSelected() ||
+ myAISContext->SelectedShape().ShapeType() != TopAbs_VERTEX)
{
AfxMessageBox (_T ("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK);
return;
{
// Check if face is selected
myAISContext->LocalContext()->InitSelected();
- if (!myAISContext->LocalContext()->MoreSelected())
+ if (!myAISContext->LocalContext()->MoreSelected() ||
+ myAISContext->SelectedShape().ShapeType() != TopAbs_FACE)
{
AfxMessageBox(_T("Choose the face and press the button again"),
MB_ICONINFORMATION | MB_OK);
{
// Check if face is selected
myAISContext->LocalContext()->InitSelected();
- if (!myAISContext->LocalContext()->MoreSelected())
+ if (!myAISContext->LocalContext()->MoreSelected() ||
+ myAISContext->SelectedShape().ShapeType() != TopAbs_FACE)
{
AfxMessageBox(_T("Choose the face and press the button again"),
MB_ICONINFORMATION | MB_OK);
{
//Build dimension here
myAISContext->LocalContext()->InitSelected();
- if (!myAISContext->LocalContext()->MoreSelected())
+ if (!myAISContext->LocalContext()->MoreSelected() ||
+ myAISContext->SelectedShape().ShapeType() != TopAbs_EDGE)
{
AfxMessageBox (_T ("Choose the edge and press the button again"), MB_ICONINFORMATION | MB_OK);
return;