Quintiq file version 2.0
|
#parent: #root
|
StaticMethod FindOrCreate (Lib3DS_Root owner, String id, String physicalid) as Lib3DS_Relation
|
{
|
TextBody:
|
[*
|
relationobject := null( Lib3DS_Relation );
|
entity := Lib3DS_Entity::FindEntityByID( id );
|
|
// If entity is found
|
if( not isnull( entity ) )
|
{
|
// If entity is invalid (incorrect type or physical ID does not match)
|
if ( not entity.istype( Lib3DS_Relation ) or entity.PhysicalID() <> physicalid )
|
{
|
// Delete entity (to be recreated later)
|
entity.DeleteObject();
|
}
|
else
|
{
|
relationobject := entity.astype( Lib3DS_Relation );
|
}
|
}
|
|
|
// If object is not found
|
if( isnull( relationobject ) )
|
{
|
// Create object
|
relationobject := Lib3DS_Relation::Create( owner, id, physicalid );
|
}
|
|
return relationobject;
|
*]
|
InterfaceProperties { Accessibility: 'Module' }
|
}
|