mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-25 08:50:36 +05:00
21854: Add persistent dimensions
- Bugs with selection of dimension arguments from Object Browser. Remarks for construction of sphere, cone, cylinder diameters.
This commit is contained in:
parent
41744f1d7b
commit
e2aeb4c11e
@ -297,11 +297,29 @@ void MeasureGUI_CreateDimensionDlg::SelectionIntoArgument()
|
||||
return;
|
||||
}
|
||||
|
||||
GEOM::GeomObjPtr aSelected = getSelected( mySelectionModes );
|
||||
if ( aSelected.isNull() )
|
||||
{
|
||||
ActiveArgs()->SelectionIntoArguments( GEOM::GeomObjPtr() );
|
||||
return;
|
||||
}
|
||||
|
||||
GEOM::GeomObjPtr aSelectedMain =
|
||||
!aSelected->IsMainShape()
|
||||
? aSelected->GetMainShape()
|
||||
: GEOM::GeomObjPtr();
|
||||
|
||||
if ( myParentObj != aSelected && myParentObj != aSelectedMain )
|
||||
{
|
||||
ActiveArgs()->SelectionIntoArguments( GEOM::GeomObjPtr() );
|
||||
return;
|
||||
}
|
||||
|
||||
StopLocalEditing();
|
||||
|
||||
erasePreview();
|
||||
|
||||
ActiveArgs()->SelectionIntoArguments( getSelected( mySelectionModes ) );
|
||||
ActiveArgs()->SelectionIntoArguments( aSelected );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
|
@ -477,31 +477,46 @@ Handle(AIS_DiameterDimension) MeasureGUI_DimensionCreateTool::Diameter( const GE
|
||||
|
||||
BRepAdaptor_Surface aSurf( aMeasuredFace );
|
||||
|
||||
Standard_Real aUmin = aSurf.FirstUParameter();
|
||||
Standard_Real aUmax = aSurf.LastUParameter();
|
||||
Standard_Real aVmin = aSurf.FirstVParameter();
|
||||
Standard_Real aVmax = aSurf.LastVParameter();
|
||||
|
||||
// get arguments of closed sphere
|
||||
// get arguments of sphere (the sphere should not be cutted at v-center)
|
||||
if ( aSurf.GetType() == GeomAbs_Sphere )
|
||||
{
|
||||
if ( !aSurf.IsUClosed() || !aSurf.IsVClosed() )
|
||||
if ( aVmax <= Precision::PConfusion() || aVmin >= Precision::PConfusion() )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// take circle in XOY plane from sphere
|
||||
gp_Sphere aSphere = aSurf.Sphere();
|
||||
gp_Ax2 anAx2 = gp_Ax2( aSphere.Location(), gp::DZ() );
|
||||
aCircle = new Geom_Circle( anAx2, aSphere.Radius() );
|
||||
Handle(Geom_Surface) aBasisSurface = Handle(Geom_Surface)::DownCast(
|
||||
aSurf.Surface().Surface()->Transformed( aSurf.Trsf() ) );
|
||||
|
||||
Handle(Geom_Curve) aCurve = aBasisSurface->VIso( 0.0 );
|
||||
|
||||
if ( aCurve->IsKind( STANDARD_TYPE( Geom_Circle ) ) )
|
||||
{
|
||||
aPmin = aUmin;
|
||||
aPmax = aUmax;
|
||||
aCircle = Handle(Geom_Circle)::DownCast( aCurve );
|
||||
}
|
||||
else if ( aCurve->IsKind( STANDARD_TYPE( Geom_TrimmedCurve ) ) )
|
||||
{
|
||||
Handle(Geom_TrimmedCurve) aTrimmedCurve = Handle(Geom_TrimmedCurve)::DownCast( aCurve );
|
||||
aPmin = aTrimmedCurve->FirstParameter();
|
||||
aPmax = aTrimmedCurve->LastParameter();
|
||||
|
||||
aCircle = Handle(Geom_Circle)::DownCast( aTrimmedCurve );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// get arguments of closed cone
|
||||
// get arguments of cone
|
||||
if ( aSurf.GetType() == GeomAbs_Cone )
|
||||
{
|
||||
if ( !aSurf.IsUClosed() || !aSurf.IsVClosed() )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
aPmin = aUmin;
|
||||
aPmax = aUmax;
|
||||
|
||||
gp_Cone aCone = aSurf.Cone();
|
||||
gp_Ax2 anAx2 = aCone.Position().Ax2();
|
||||
@ -516,11 +531,6 @@ Handle(AIS_DiameterDimension) MeasureGUI_DimensionCreateTool::Diameter( const GE
|
||||
// get arguments of closed torus or cylinder
|
||||
if ( aSurf.GetType() == GeomAbs_Torus || aSurf.GetType() == GeomAbs_Cylinder )
|
||||
{
|
||||
if ( !aSurf.IsUClosed() || !aSurf.IsVClosed() )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Handle(Geom_Surface) aBasisSurface = Handle(Geom_Surface)::DownCast(
|
||||
aSurf.Surface().Surface()->Transformed( aSurf.Trsf() ) );
|
||||
|
||||
@ -528,8 +538,8 @@ Handle(AIS_DiameterDimension) MeasureGUI_DimensionCreateTool::Diameter( const GE
|
||||
|
||||
if ( aCurve->IsKind( STANDARD_TYPE( Geom_Circle ) ) )
|
||||
{
|
||||
aPmin = aSurf.FirstUParameter();
|
||||
aPmax = aSurf.LastUParameter();
|
||||
aPmin = aUmin;
|
||||
aPmax = aUmax;
|
||||
aCircle = Handle(Geom_Circle)::DownCast( aCurve );
|
||||
}
|
||||
else if ( aCurve->IsKind( STANDARD_TYPE( Geom_TrimmedCurve ) ) )
|
||||
|
Loading…
Reference in New Issue
Block a user