How to create a template and a placeable library part

  1. Create a new library part in Archicad, and insert it into the correct place in the subtype hierarchy with the Select Subtype button: (in this example I shall insert the object as the subtype of Model Element). Also check the ‘Use as subtype‘ checkbox.

    LibPart template 1

     

    Then save this object as, let’s say “Zoom GDL Object”. You can check whether this has been inserted into the object hierarchy correctly if you bring up the File / GDL Object / Open Object by Subtype… dialog.

    LibPart template 2

  2. Add this ‘Zoom GDL Object’ to your Add-On in a FILE resource:

    
    'FILE' 132 "Zoom Object.gsm" {
        "Zoom GDL Object.gsm"
    }
    

    The name of the resource (“Zoom Object.gsm”) will appear in the Object Settings dialog, and the content of the resource refers to name of the file (“Zoom GDL Object.gsm”) you would like to include in your add-on.

  3. Call ACAPI_Register_BuiltInLibrary from your RegisterInterface () function.

  4. If you want to create a new object whose parent is this object in the subtype hierarchy, then before calling ACAPI_LibPart_Create fill in the parentUnID field of the API_LibPart structure this way:

    
    ACAPI_Goodies (APIAny_GetBuiltInLibpartUnIdID, (void*)(Int32) 132, libPart.parentUnID);   // 132 is the 'FILE' resource ID
    
  5. Set the placeable, and clear the template field of the API_LibPart structure.

  6. After this you can call ACAPI_LibPart_Create, and the library part will be inserted into the correct place in the subtype hierarchy.