EDF 1337 : Sketcher 3D define a point by angle

Small modification of dimension presentations
This commit is contained in:
rnc 2012-10-11 08:45:36 +00:00
parent 7f29a32f50
commit 548c1dbe01

View File

@ -81,10 +81,11 @@
// + Dump pour les coordonnées cylindriques et // + Dump pour les coordonnées cylindriques et
// report des modifs sur les autres types de coordonnées Done // report des modifs sur les autres types de coordonnées Done
// + Correction BUG coordonées cylindriques relatives --> la hauteur est absolue Done // + Correction BUG coordonées cylindriques relatives --> la hauteur est absolue Done
// + Améliorer rendu des cotes pour coordonées cylindriques (tailles relatives // + Améliorer rendu des cotes pour coordonées cylindriques (tailles relatives Done
// de la cote rayon et de la cote hauteur) // de la cote rayon et de la cote hauteur)
// + Prendre en compte les remarques de Raphaël // + Prendre en compte les remarques de Raphaël Done
// + Traductions Done // + Traductions Done
// + Doc
enum enum
{ {
@ -1305,24 +1306,36 @@ void EntityGUI_3DSketcherDlg::displayDimensions (bool store)
{ {
myPrsType = prsType(); myPrsType = prsType();
XYZ Last = getLastPoint(); XYZ Last = getLastPoint();
if (myMode == 0) // Absolute coordinates
Last.x=Last.y=Last.z=0.0;
XYZ Current = getCurrentPoint(); XYZ Current = getCurrentPoint();
gp_Pnt Last_Pnt(Last.x,Last.y,Last.z); gp_Pnt P0(Last.x,Last.y,Last.z);
if (myMode == 0) // Absolute coordinates
P0=gp::Origin();
gp_Pnt Current_Pnt(Current.x,Current.y,Current.z); gp_Pnt Current_Pnt(Current.x,Current.y,Current.z);
gp_Pnt P1, P2; gp_Pnt P1, P2;
gp_Dir aNormal = getPresentationPlane(); gp_Dir aNormal = getPresentationPlane();
if (myCoordType == 0) if (myCoordType == 0)
{ {
// displayLength(Last_Pnt, Current_Pnt, aNormal, store); if((( Abs(Last.x-Current.x) <= Precision::Confusion() &&
displayLength(gp_Pnt(Last.x,Current.y,Last.z), gp_Pnt(Current.x,Current.y,Last.z), gp::DZ().Reversed(), store); Abs(Last.y-Current.y) <= Precision::Confusion() ) ||
displayLength(gp_Pnt(Current.x,Last.y,Last.z), gp_Pnt(Current.x,Current.y,Last.z), gp::DZ(), store); ( Abs(Last.x-Current.x) <= Precision::Confusion() &&
displayLength(gp_Pnt(Current.x,Current.y,Last.z), Current_Pnt, gp::DY(), store); Abs(Last.z-Current.z) <= Precision::Confusion() ) ||
( Abs(Last.y-Current.y) <= Precision::Confusion() &&
Abs(Last.z-Current.z) <= Precision::Confusion() ))&&
myMode == 1)
{
// For better colocation of dimensions if only one coordinate changes (aNormal is a better choice)
displayLength(P0, Current_Pnt, aNormal, store);
} }
if (myCoordType == 1) // ANGLES else
{
displayLength(gp_Pnt(P0.X(),Current.y,P0.Z()), gp_Pnt(Current.x,Current.y,P0.Z()), gp::DZ().Reversed(), store);
displayLength(gp_Pnt(Current.x,P0.Y(),P0.Z()), gp_Pnt(Current.x,Current.y,P0.Z()), gp::DZ(), store);
displayLength(gp_Pnt(Current.x,Current.y,P0.Z()), Current_Pnt, gp::DX(), store);
}
}
else if (myCoordType == 1) // ANGLES
{ {
bool spherical = GroupAngles->checkBox->isChecked(); bool spherical = GroupAngles->checkBox->isChecked();
bool cylindrical = GroupAngles->checkBox_2->isChecked(); bool cylindrical = GroupAngles->checkBox_2->isChecked();
@ -1334,47 +1347,47 @@ void EntityGUI_3DSketcherDlg::displayDimensions (bool store)
{ {
case OXY: case OXY:
{ {
P1 = gp_Pnt(Last.x + aLength,Last.y,Last.z); // X direction P1 = gp_Pnt(P0.X() + aLength,P0.Y(),P0.Z()); // X direction
P2 = gp_Pnt(Last.x + aLength * cos(anAngle1 * M_PI / 180.), P2 = gp_Pnt(P0.X() + aLength * cos(anAngle1 * M_PI / 180.),
Last.y + aLength * sin(anAngle1 * M_PI / 180.), P0.Y() + aLength * sin(anAngle1 * M_PI / 180.),
Last.z); P0.Z());
break; break;
} }
case OYZ: case OYZ:
{ {
P1 = gp_Pnt(Last.x, Last.y + aLength,Last.z); // Y direction P1 = gp_Pnt(P0.X(), P0.Y() + aLength,P0.Z()); // Y direction
P2 = gp_Pnt(Last.x, P2 = gp_Pnt(P0.X(),
Last.y + aLength * cos(anAngle1 * M_PI / 180.), P0.Y() + aLength * cos(anAngle1 * M_PI / 180.),
Last.z + aLength * sin(anAngle1 * M_PI / 180.)); P0.Z() + aLength * sin(anAngle1 * M_PI / 180.));
break; break;
} }
case OXZ: case OXZ:
{ {
P1 = gp_Pnt(Last.x + aLength,Last.y,Last.z); // X direction P1 = gp_Pnt(P0.X() + aLength,P0.Y(),P0.Z()); // X direction
P2 = gp_Pnt(Last.x + aLength * cos(anAngle1 * M_PI / 180.) , P2 = gp_Pnt(P0.X() + aLength * cos(anAngle1 * M_PI / 180.) ,
Last.y, P0.Y(),
Last.z + aLength * sin(anAngle1 * M_PI / 180.)); P0.Z() + aLength * sin(anAngle1 * M_PI / 180.));
break; break;
} }
} }
if(!cylindrical) if(!cylindrical)
displayLength(Last_Pnt, Current_Pnt, aNormal, store); displayLength(P0, Current_Pnt, aNormal, store);
if(myMode !=0 || !store) if(myMode !=0 || !store)
displayAngle(anAngle1, Last_Pnt, P1, P2, store); displayAngle(anAngle1, P0, P1, P2, store);
if(spherical) if(spherical)
{ {
double anAngle2 = GroupAngles->SpinBox_DA2->value(); double anAngle2 = GroupAngles->SpinBox_DA2->value();
displayAngle(anAngle2, Last_Pnt, P2, Current_Pnt, store); displayAngle(anAngle2, P0, P2, Current_Pnt, store);
} }
if(cylindrical) if(cylindrical)
{ {
gp_Vec aVec(P2, Current_Pnt); gp_Vec aVec(P2, Current_Pnt);
if (myMode == 0) if (myMode == 0)
displayLength(Last_Pnt.Translated(aVec), P2.Translated(aVec), aNormal, store); // Radius displayLength(P0.Translated(aVec), P2.Translated(aVec), aNormal, store); // Radius
else else
displayLength(Last_Pnt, P2, aNormal, store); displayLength(P0, P2, aNormal, store);
displayLength(P2, Current_Pnt, aNormal.Reversed(), store); // Height displayLength(P2, Current_Pnt, aNormal.Reversed(), store); // Height
} }
} }