- if ( myGeomBase->GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) )
- {
- const int aType = aShape.ShapeType();
- if ( aType <= TopAbs_EDGE ) // edge, wire, face, shell, solid, compound
- {
- GEOM::short_array anIndexes;
-
- TColStd_IndexedMapOfInteger aMap;
- ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap );
-
- if ( !aMap.IsEmpty() ) // subshape selection
- {
- myIndex = aMap( 1 );
- myObject = aSelectedObj;
- myEditCurrentArgument->setText( tr( "GEOM_EDGE" ) + "_1" );
- }
- else if ( aType == TopAbs_EDGE ) // single shape selection
- {
- myIndex = -1;
- myObject = aSelectedObj;
- myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
- }
- else // face, shell, solid or compound was selected, and NOT its subshape.
- {
- myIndex = -1;
- myObject = GEOM::GEOM_Object::_nil();
- }
- }
+ if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) ) {
+ const int aType = aShape.ShapeType();
+ if ( aType <= TopAbs_EDGE ) {
+ // edge, wire, face, shell, solid, compound
+ GEOM::short_array anIndexes;
+
+ TColStd_IndexedMapOfInteger aMap;
+ SalomeApp_Application* anApp =
+ (SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
+ anApp->selectionMgr()->GetIndexes( anIO, aMap );
+
+ if ( aMap.Extent() == 1 ) { // local selection
+ int anIndex = aMap( 1 );
+ myEditCurrentArgument->setText( aName += QString( ":edge_%1" ).arg( anIndex ) );
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
+ myObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
+ }
+ else {
+ myObject = aFindedObject; // get Object from study
+ }
+ }
+ else if ( aType == TopAbs_EDGE ) {
+ // single shape selection
+ myObject = aSelectedObject;
+ myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
+ }
+ else {
+ // face, shell, solid or compound was selected, and NOT its subshape.
+ myObject = GEOM::GEOM_Object::_nil();
+ }
+ }