myBelongToGeomPtr->SetGeom( theShape );
}
-void BelongToGeom_i::SetElementType(ElementType theType){
+void BelongToGeom_i::SetElementType(ElementType theType)
+{
myBelongToGeomPtr->SetType(SMDSAbs_ElementType(theType));
TPythonDump()<<this<<".SetElementType("<<theType<<")";
}
void BelongToGeom_i::SetShape( const char* theID, const char* theName )
{
delete myShapeName;
- myShapeName = strdup( theName );
delete myShapeID;
- if ( theID )
- myShapeID = strdup( theID );
- else
- myShapeID = 0;
+ myShapeName = strdup( theName );
+ myShapeID = strdup( theID );
+ bool hasName = ( theName && theName[0] );
+ bool hasID = ( theID && theID[0] );
- if ( myShapeID && myShapeName == getShapeNameByID(myShapeID))
- myBelongToGeomPtr->SetGeom( getShapeByID(myShapeID) );
+ TopoDS_Shape S;
+ if ( hasName && hasID )
+ {
+ S = getShapeByID( myShapeID );
+ if ( S.IsNull() )
+ S = getShapeByName( myShapeName );
+ }
else
- myBelongToGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+ {
+ S = hasID ? getShapeByID( myShapeID ) : getShapeByName( myShapeName );
+ }
+ myBelongToGeomPtr->SetGeom( S );
}
char* BelongToGeom_i::GetShapeName()
void BelongToSurface_i::SetShape( const char* theID, const char* theName, ElementType theType )
{
delete myShapeName;
- myShapeName = strdup( theName );
delete myShapeID;
- 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 );
+ }
else
- myElementsOnSurfacePtr->SetSurface( getShapeByName( myShapeName ), (SMDSAbs_ElementType)theType );
+ {
+ S = hasID ? getShapeByID( myShapeID ) : getShapeByName( myShapeName );
+ }
+ myElementsOnSurfacePtr->SetSurface( S, (SMDSAbs_ElementType)theType );
}
char* BelongToSurface_i::GetShapeName()
void LyingOnGeom_i::SetShape( const char* theID, const char* theName )
{
delete myShapeName;
- myShapeName = strdup( theName );
delete myShapeID;
- if ( theID )
- myShapeID = strdup( theID );
- else
- myShapeID = 0;
-
- if ( myShapeID && myShapeName == getShapeNameByID(myShapeID))
- myLyingOnGeomPtr->SetGeom( getShapeByID(myShapeID) );
+ 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 );
+ }
else
- myLyingOnGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+ {
+ S = hasID ? getShapeByID( myShapeID ) : getShapeByName( myShapeName );
+ }
+ myLyingOnGeomPtr->SetGeom( S );
}
char* LyingOnGeom_i::GetShapeName()