admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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' }
}