- if ( theID )
- myShapeID = strdup( theID );
- else
- myShapeID = 0;
-
- if ( myShapeID && myShapeName == getShapeNameByID(myShapeID))
- myElementsOnSurfacePtr->SetSurface( getShapeByID(myShapeID), (SMDSAbs_ElementType)theType );
+ myShapeName = strdup( theName );
+ myShapeID = strdup( theID );
+ bool hasName = ( theName && theName[0] );
+ bool hasID = ( theID && theID[0] );
+
+ TopoDS_Shape S;
+ if ( hasName && hasID )
+ {
+ S = getShapeByID( myShapeID );
+ if ( S.IsNull() )
+ S = getShapeByName( myShapeName );
+ }