Registers a Library Part.
GSErrCode ACAPI_LibPart_Register ( API_LibPart* libPart );
Parameters
- libPart
- [in/out] Parameters of the library part;
the type, the owner signature and the file descriptor of the library part, must be initialized, by setting the typeID, ownerID and the fileDef fields respectively. Other values will be filled and returned by Archicad.
Return Values
NoError
- The function has completed with success.
APIERR_BADPARS
libPart
isnullptr
, or refers to invalid data
For other common API errors see the API Errors.
Remarks
This function is used to register a new Library Part.
You can register any kind of Library Part, however this function basically implemented for handling macros and pictures. These type of Library Parts are simple text and picture files which can be created without any help of the API. If you want to create a new macro, you just have to create a simple text file somewhere in the file system, and register it as a macro.
If the function has completed with success, the reference index is returned by Archicad in the libPart->index
parameter. Use this value to reference to the registered Library Part in any subsequent operation.
Creating real Archicad library parts are much more complicated. Although the file format is public, it is strongly recommended to use the API functions while creating an object, lamp, door etc. kind library part. In this case you do not have to register it, because the ACAPI_LibPart_Save function does it.
This function is a non-undoable data structure modifier function. See more details on this topic at Command Overview.
Example
IO::Location fileLoc ("C:\\temp\\MyLibpart.gsm"); API_LibPart libPart; GSErrCode err; BNZeroMemory (&libPart, sizeof (API_LibPart)); libPart.typeID = APILib_ObjectID; libPart.location = &fileLoc; err = ACAPI_LibPart_Register (&libPart);
Requirements
- Version: API 4.1 or later
- Header: ACAPinc.h
See Also
API_LibPart,
ACAPI_LibPart_Save,
ACAPI_LibPart_RegisterAll,
LibPart Manager, API Functions