Old functionalities to iterate and manipulate Library Parts. Most of these structures and functions are deprecated since AC 28. It's recommended to use Library Management components instead.
More...
|
enum | API_PrimTypeID {
API_ZombiePrimID = 0
, API_PrimPointID
, API_PrimLineID
, API_PrimArcID
,
API_PrimTextID
, API_PrimPLineID
, API_PrimTriID
, API_PrimPolyID
,
API_PrimPictID
, API_PrimCtrl_BegID
, API_PrimCtrl_HatchBorderBegID
, API_PrimCtrl_HatchBorderEndID
,
API_PrimCtrl_HatchLinesBegID
, API_PrimCtrl_HatchLinesEndID
, API_PrimCtrl_HoledimLinesBegID
, API_PrimCtrl_HoledimLinesEndID
,
API_PrimCtrl_ArrowBegID
, API_PrimCtrl_ArrowEndID
, API_PrimCtrl_ElementRefID
, API_PrimCtrl_EndID
,
API_PrimCtrl_PlacedBorderBegID
, API_PrimCtrl_PlacedBorderEndID
, API_PrimCtrl_TextBegID
, API_PrimCtrl_TextEndID
,
API_PrimCtrl_CWallPanelBegID
, API_PrimCtrl_CWallPanelEndID
, API_PrimCtrl_BackgroundFillBegID
, API_PrimCtrl_BackgroundFillEndID
,
API_PrimCtrl_FrameBegID
, API_PrimCtrl_FrameEndID
} |
| Various primitive element types and control codes.
|
|
enum | API_LockableStatus {
APILockableStatus_NotExist
, APILockableStatus_Free
, APILockableStatus_Editable
, APILockableStatus_Locked
,
APILockableStatus_NotAvailable
} |
| Possible Teamwork lockable status. More...
|
|
enum | API_LibTypeID {
API_ZombieLibID = 0
, APILib_SpecID = 1
, APILib_WindowID = 2
, APILib_DoorID = 3
,
APILib_ObjectID = 4
, APILib_LampID = 5
, APILib_RoomID = 6
, APILib_PropertyID = 7
,
APILib_PlanSignID = 8
, APILib_LabelID = 9
, APILib_MacroID = 10
, APILib_PictID = 11
,
APILib_ListSchemeID = 12
, APILib_SkylightID = 13
, APILib_OpeningSymbolID = 14
} |
| Library Part types. From Archicad 8 these categories are obsolete due to the introduction of library part subtypes. More...
|
|
|
GSErrCode | ACAPI_LibraryPart_GetLibPartRefGuid (const IO::Location *location, API_Guid *guid) |
| This function is used to obtain the reference guid of a library part.
|
|
GSErrCode | ACAPI_LibraryPart_GetLibPartUnIDStr (const IO::Location *location, char *libPartUnId) |
| This function is used to obtain the given library part's own unique ID.
|
|
GSErrCode | ACAPI_LibraryPart_GetLibPartLockStatus (const IO::Location *location, API_LockableStatus *status, IO::Location *userCacheLibPartLocation=nullptr) |
| Returns the current lock status of the given library part.
|
|
GSErrCode | ACAPI_LibraryManagement_DeleteEmbeddedLibItem (const IO::Location *location, bool keepGSMFile=false, bool silentMode=false) |
| Deletes the given embedded library item (folder or library part).
|
|
GSErrCode | ACAPI_LibraryManagement_DeleteEmbeddedLibItems (const GS::Array< IO::Location > *location, bool keepGSMFile=false, bool silentMode=false) |
| Delete embeded lib items.
|
|
GSErrCode | ACAPI_LibraryPart_OpenParameters (API_ParamOwnerType *paramOwner) |
| Opens a Library Part parameter list to edit.
|
|
GSErrCode | ACAPI_LibraryPart_GetParamValues (API_GetParamValuesType *getValues) |
| Returns the possible values defined for a Library Part parameter.
|
|
GSErrCode | ACAPI_LibraryPart_ChangeAParameter (API_ChangeParamType *changeParamType) |
| Changes a value in an opened Library Part parameter list.
|
|
GSErrCode | ACAPI_LibraryPart_GetActParameters (API_GetParamsType *theParams) |
| Returns the actual (edited) values of a Library Part parameter list opened to edit.
|
|
GSErrCode | ACAPI_LibraryPart_CloseParameters () |
| Closes the Library Part parameter list opened for editing.
|
|
GSErrCode | ACAPI_LibraryPart_GetBuiltInLibpartUnId (short templateFileResID, char *lpfUnId) |
| Retrieves the GUID of a built-in library part.
|
|
GSErrCode | ACAPI_LibraryPart_GetUnloadedLibpartName (const API_Guid *guid, GS::UniString *name) |
| Retrieves the name of a Libpart, even if the library is unloaded.
|
|
GSErrCode | ACAPI_LibraryPart_CheckLibPartSubtypeOf (const char *successorUnIDStr, const char *predecessorUnIDStr) |
| Checks whether a library part unique ID refers to a subtype of another.
|
|
GSErrCode | ACAPI_LibraryPart_CheckLibPartSubtypeOfbyMain (const char *successorUnIDStr, const char *predecessorUnIDStr) |
| Checks whether a library part unique ID refers to a subtype of another.
|
|
GSErrCode | ACAPI_LibraryPart_CompareLibPartUnIds (const char *unIDStr1, const char *unIDStr2) |
| Compares two library part unique IDs.
|
|
GSErrCode | ACAPI_LibraryPart_GetElemLibPartUnId (API_Elem_Head *elemHead, char *lpfUnId) |
| Returns the library part unique identifier of the GDL based element (object/lamp/window/door).
|
|
GSErrCode | ACAPI_LibraryPart_GetLibPartToolVariation (API_LibPart *libPart, API_ToolBoxItem *toolboxItem) |
| Returns the library part's creator element type and variation ID.
|
|
GSErrCode | ACAPI_LibraryPart_GetMarkerParent (const API_ElemType &elemType, API_LibPart &libPart) |
| Returns the parent ID of the marker, in the parentUnID member of the libPart structure.
|
|
GSErrCode | ACAPI_LibraryPart_GetLastValidEmbeddedLPName (GS::UniString *name, IO::Location *location) |
| Retrieves the last valid embedded library location.
|
|
GSErrCode | ACAPI_LibraryPart_RegisterESYM (GSType signature, API_LibTypeID typeID, short stringResID) |
| Registers an external symbol type with Archicad.
|
|
GSErrCode | ACAPI_LibraryPart_InstallESYMHandler (GSType signature, APIESYMCommandProc *handlerProc) |
| Installs a callback for handling external symbols.
|
|
GSErrCode | ACAPI_DisposeAddParHdl (API_AddParType ***addPars) |
| Frees the memory occupied by a handle to an array of API_AddParType.
|
|
GSErrCode | ACAPI_LibraryPart_GetNum (Int32 *count) |
| Returns the number of registered library parts.
|
|
GSErrCode | ACAPI_LibraryPart_Search (API_LibPart *ancestor, bool createIfMissing, bool onlyPlaceable=false) |
| Searches for a registered Library Part in the loaded libraries.
|
|
GSErrCode | ACAPI_LibraryPart_PatternSearch (const API_LibPart *ancestor, const GS::UniString &pattern, API_LibPart result[50], Int32 *numFound) |
| Searches for registered Library Parts in the loaded libraries.
|
|
GSErrCode | ACAPI_LibraryPart_Get (API_LibPart *libPart) |
| Returns the data of a registered Library Part.
|
|
GSErrCode | ACAPI_LibraryPart_GetParams (Int32 libInd, double *a, double *b, Int32 *addParNum, API_AddParType ***addPars) |
| Returns the default parameters of a registered Library Part.
|
|
GSErrCode | ACAPI_LibraryPart_GetSection (Int32 libInd, API_LibPartSection *section, GSHandle *sectionHdl, GS::UniString *sectionStr, GS::UniString *password=nullptr) |
| Returns an existing section of a registered Library Part.
|
|
GSErrCode | ACAPI_LibraryPart_UpdateSection (Int32 libInd, const API_LibPartSection *section, GSHandle sectionHdl, GS::UniString *sectionStr, GS::UniString *password=nullptr) |
| Updates a section of a registered Library Part.
|
|
GSErrCode | ACAPI_LibraryPart_SetUpSect_2DDrawHdl (void) |
| Sets up an empty 2D binary (drawing) section to fill up from API elements.
|
|
GSErrCode | ACAPI_LibraryPart_GetSect_2DDrawHdl (GSHandle *sectionHdl) |
| Returns the 2D binary (drawing) section data created from API elements.
|
|
GSErrCode | ACAPI_LibraryPart_GetSect_ParamDef (const API_LibPart *libPart, API_AddParType **addPars, double *a, double *b, GSHandle sect2DDrawHdl, GSHandle *sectionHdl, GS::UniString *password=nullptr) |
| Prepares the parameter section data to save into a Library Part.
|
|
GSErrCode | ACAPI_LibraryPart_Create (const API_LibPart *libPart) |
| Starts to create a new Library Part from scratch.
|
|
GSErrCode | ACAPI_LibraryPart_AddSection (const API_LibPartSection *section, GSHandle sectionHdl, GS::UniString *sectionStr) |
| Adds a new section to the Library Part under creation.
|
|
GSErrCode | ACAPI_LibraryPart_NewSection (const API_LibPartSection *section) |
| Opens a new section to write into the Library Part under creation.
|
|
GSErrCode | ACAPI_LibraryPart_WriteSection (Int32 nByte, GSConstPtr data) |
| Writes data into an opened section of the Library Part under creation.
|
|
GSErrCode | ACAPI_LibraryPart_EndSection (void) |
| Closes the last opened section of the Library Part under creation.
|
|
GSErrCode | ACAPI_LibraryPart_Save (API_LibPart *libPart) |
| Saves the Library Part has been created and registers it.
|
|
GSErrCode | ACAPI_LibraryPart_ShapePrims (Int32 libInd, const API_Guid &instanceElemGuid, short gdlContext, ShapePrimsProc *shapePrimsProc) |
| Virtually draws the shape of a registered Library Part.
|
|
GSErrCode | ACAPI_LibraryPart_GetHotspots (Int32 libInd, const API_Guid &instanceElemGuid, Int32 *nHotspots, API_PrimHotspot ***hotspots) |
| Retrieves the hotspots of a registered Library Part.
|
|
GSErrCode | ACAPI_LibraryPart_Register (API_LibPart *libPart) |
| Registers a Library Part.
|
|
GSErrCode | ACAPI_LibraryPart_RegisterAll (GS::Array< API_LibPart > *libParts) |
| Registers an array of Library Parts.
|
|
GSErrCode | ACAPI_LibraryPart_GetSectionList (Int32 libInd, Int32 *nSection, API_LibPartSection ***sections) |
| Returns the list of sections contained by a registered Library.
|
|
GSErrCode | ACAPI_LibraryPart_GetDetails (Int32 libInd, API_LibPartDetails *details) |
| Returns the detail parameters of a registered Library Part.
|
|
GSErrCode | ACAPI_LibraryPart_SetDetails_ParamDef (const API_LibPart *libPart, GSHandle paramHdl, const API_LibPartDetails *details) |
| Sets the detail parameters of a Library Part parameter section handle.
|
|
Old functionalities to iterate and manipulate Library Parts. Most of these structures and functions are deprecated since AC 28. It's recommended to use Library Management components instead.
Library Part Overview
Library Parts are collected into library folders, like the default Archicad Library. The active library folders themselves can be manipulated. With the ACAPI_LibraryManagement_ResetLibraries function you can reset the installed libraries, also you can add a new folder, or even to give a complete list of folders.
From Archicad 8 libraries can be packed in and loaded from archive files and module resources as well. This capability lets the add-ons store their library parts in their own resources and use them as a read-only library added to the active libraries (ACAPI_AddOnIntegration_RegisterBuiltInLibrary).
References to Library Part
The active library folders are enumerated and the Library Part files are registered in Archicad. The Library Part Manager functions can work only on registered Library Parts.
The drawing elements (objects, doors, windows, lamps, and zone definitions) which require a Library Part to reference, do it with indices. The index is the index of the Library Part in the library part pool, which contains the parts from all the active libraries.
Library Part types
Up to Archicad 8 applicable types of Library Parts were enumerated in the API_LibTypeID structure. From Archicad 8 a new kind of library part hierarchy was introduced: every library part is derived from a subtype parent library part. This tree structure gives much more flexible classification of library parts. For a detailed description see the Library Part Subtypes section.
The definition of a Library Part is described in the API_LibPart structure.
Some kind of Library Parts do not contain any Archicad specific information. For example macros are simple text files, pictures are standard TIFF, GIF etc. files. They become Library Parts, just because they are located in the active library folders. There are no any API functions to give support to work on their content.
Internal Structure
A real Library Part is built from several sections, as you can see and also edit in the Library Part dialog of Archicad. Each section has an identifier and a subcode which allows implementation of more than one section with the very same type, as can be seen in the API_LibPartSection structure.
The sectType field is the identifier of the section, which is implemented as a four byte code. Predefined identifiers are also listed, and Archicad can work on these sections only. Of course you can insert sections with custom identifiers to save your own data into the Library Part. Archicad never modifies or deletes custom sections.
The subIdent field gives a sub-identifier. There are sections which may have more instances in the same Library Part, like the 3D binary section. Sections which can have only one instance always have the value zero. For custom sections, this value is not checked for validity and you can use it for any purpose, like version controlling.
The API functions related to Library Parts give all of the necessary support to build a new Library Part from scratch, and provide the possibility to modify, delete or append any section in existing ones. If you create a new library part, it is automatically registered into the internal database, so it can be referred by any element. Refer to the ACAPI_LibraryPart_Create function for details.
The API functions hide the internal structure of a Library Part, however there is some public documentation available on these topics, which allows you to build them on your own. It is highly recommended to use the API functions for this purpose, because of compatibility issues.
Textual sections like the 2D script, 3D script or property script etc. can be generated without any problem. You just have to allocate some memory which can hold the necessary text. From API 11, these sections contain Unicode text, which you can also manipulate through the API.
Producing or interpreting binary sections like the 3D binary or 2D drawing sections are more complicated to manage. You have two ways to work on them.
- The internal structure of these binary sections are public. If you have the necessary documentation, you can build or interpret them on your own. This method is not recommended.
- There are API functions which translate the binary data into API structures. You should use these methods, as shown later.
The list of sections of a Library Part can be get by the ACAPI_LibraryPart_GetSectionList function.
If you are interested in the data of any section, you can get it by simply calling the ACAPI_LibraryPart_GetSection function. In case of binary sections, you will get binary data which does not correspond to any API structure. For textual sections, the returned sectionHdl contains the required text.
The 2D drawing section
The 2D drawing section describes the shape of the Library Part which can be drawn with the applicable 2D toolbar elements.
At this time, the only way to get this data in API form is to use the ACAPI_LibraryPart_ShapePrims function. This function call explodes the shape of the library part into drawing primitives.
In order to build this binary section, you should redirect the element creation procedure. In this case, the subsequent calls to the ACAPI_Element_Create function place the given elements into a temporary pool, instead of the project database. When you have finished the drawing creation procedure you can convert these elements to the required binary form.
GSHandle bin2DHdl;
GSErrCode err;
...
ACAPI_Element_Create()
section.sectType = API_Sect2DDraw;
BMKillHandle (&bin2DHdl);
GSErrCode ACAPI_Element_Create(API_Element *element, API_ElementMemo *memo)
Places a new element into current database.
GSErrCode ACAPI_LibraryPart_GetSect_2DDrawHdl(GSHandle *sectionHdl)
Returns the 2D binary (drawing) section data created from API elements.
GSErrCode ACAPI_LibraryPart_AddSection(const API_LibPartSection *section, GSHandle sectionHdl, GS::UniString *sectionStr)
Adds a new section to the Library Part under creation.
GSErrCode ACAPI_LibraryPart_SetUpSect_2DDrawHdl(void)
Sets up an empty 2D binary (drawing) section to fill up from API elements.
Information about the current selection.
Definition: APIdefs_Elements.h:23395
The parameters section
The parameters section describes the default parameters of the Library Part.
All real Library Parts contain two predefined parameters; named A and B. The different kind of Library Parts may contain additional required parameters. You can check these by creating a new library part of that kind in Archicad. The parameters appearing in the dialog are the required ones. Beside these, you may define or retrieve additional parameters (maximum 64). The parameter manipulating functions all refer to these additional (required and/or optional) parameters, but not to the A and B parameters, which are separate parameters where needed.
Applicable additional parameter types are enumerated in the API_AddParID structure. The definition of an additional parameter is described in the API_AddParType structure:
If you want to get the parameter list of a Library Part in an API based form you should use the following template:
Int32 addParNum;
double a, b;
GSErrCode ACAPI_LibraryPart_GetParams(Int32 libInd, double *a, double *b, Int32 *addParNum, API_AddParType ***addPars)
Returns the default parameters of a registered Library Part.
Describes a parameter of a Library Part.
Definition: APIdefs_LibraryParts.h:604
In this case, Archicad translates the binary data into an array of API_AddParType structure. This function also returns the a and b parameter in separate variables, because the addParHdl will contain the additional parameters only.
The creation of the parameter section is also very simple. First you have to allocate the required size of array based on the API_AddParType structure and fill with the data of the parameters. In the next step, this API data should be converted to binary data. To do that you also need the 2D binary section data, because the binary parameter handle is a full description which owns the a and b parameters. These parameters are calculated automatically and the built binary section is returned to you through the paramsHdl argument. You also get back the calculated a and b parameter.
GSHandle paramsHdl;
GSErrCode err;
&a, &b, bin2DHdl,
¶msHdl);
section.sectType = API_SectParamDef;
BMKillHandle (¶msHdl);
GSErrCode ACAPI_LibraryPart_GetSect_ParamDef(const API_LibPart *libPart, API_AddParType **addPars, double *a, double *b, GSHandle sect2DDrawHdl, GSHandle *sectionHdl, GS::UniString *password=nullptr)
Prepares the parameter section data to save into a Library Part.
The 3D binary sections
In the present version of the API, there is no support to process the internal data of the 3D binary sections. If you are interested to work with these sections please contact Graphisoft to get the necessary documentation on the binary format.
A Library Part can own more than one 3D binary section up to 16 fragments. In order to get the right fragment, you need to set up the subIdent field of the API_LibPartSection structure correctly.
The Preview picture
A preview picture can be embedded into Library Parts either in PICT or GIF format. They are public formats, so they do not need any explanation.
◆ APIESYMCommandProc
typedef GSErrCode APIESYMCommandProc(const API_ESYMParams *esymParams) |
User supplied callback function for handling external symbols.
- Parameters
-
esymParams | [in] This structure contains the various parameters identifying the external symbol (type, index) and the type of operation (new/edit). |
- Returns
- NoError - The function has completed with success.
◆ API_LibTypeID
Library Part types. From Archicad 8 these categories are obsolete due to the introduction of library part subtypes.
◆ API_LockableStatus
Possible Teamwork lockable status.
◆ ACAPI_DisposeAddParHdl()
Frees the memory occupied by a handle to an array of API_AddParType.
- Parameters
-
- Returns
◆ ACAPI_LibraryManagement_DeleteEmbeddedLibItem()
GSErrCode ACAPI_LibraryManagement_DeleteEmbeddedLibItem |
( |
const IO::Location * |
location, |
|
|
bool |
keepGSMFile = false , |
|
|
bool |
silentMode = false |
|
) |
| |
Deletes the given embedded library item (folder or library part).
- Parameters
-
location | [in] The location of the embedded library item. |
keepGSMFile | [in] If this parameter is true, then the operation deletes libpart only from the embedded library, but keeps the.gsm file in the filesystem. (optional parameter, by default it's false) |
silentMode | [in] If this parameter is true, then the missing libpart window won't open in case of any warning. (optional parameter, by default it's false) |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The given loc parameter is nullptr.
- APIERR_NOTMINE - The operation attempted to delete a library part that belongs to another user. Likely to occur in teamwork mode.
◆ ACAPI_LibraryManagement_DeleteEmbeddedLibItems()
GSErrCode ACAPI_LibraryManagement_DeleteEmbeddedLibItems |
( |
const GS::Array< IO::Location > * |
location, |
|
|
bool |
keepGSMFile = false , |
|
|
bool |
silentMode = false |
|
) |
| |
Delete embeded lib items.
- Parameters
-
location | [in] Array of locations of the library items. |
keepGSMFile | [in] Keep the GSM file. |
silentMode | [in] Missing library parts dialog window should pop up. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_LibraryPart_AddSection()
GSErrCode ACAPI_LibraryPart_AddSection |
( |
const API_LibPartSection * |
section, |
|
|
GSHandle |
sectionHdl, |
|
|
GS::UniString * |
sectionStr |
|
) |
| |
Adds a new section to the Library Part under creation.
- Parameters
-
section | [in] Parameters of the new section. |
sectionHdl | [in] Section data. |
sectionStr | [in] Content of any textual section as a Unicode string. |
- Returns
- NoError - The function has completed with success.
- APIERR_GENERAL - No scratch file has been opened by the ACAPI_LibraryPart_Create function.
- Example
function.
GSErrCode ACAPI_LibraryPart_Create(const API_LibPart *libPart)
Starts to create a new Library Part from scratch.
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::GSMObject setters instead
◆ ACAPI_LibraryPart_ChangeAParameter()
Changes a value in an opened Library Part parameter list.
- Parameters
-
changeParamType | [in] The Library Part parameter (variable) to change the value of it. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - chgParam is nullptr or the variable reference is invalid
- APIERR_NOTINIT - there is no parameter list opened
- Example
See the example given at the APIAny_OpenParametersID
function.
◆ ACAPI_LibraryPart_CheckLibPartSubtypeOf()
GSErrCode ACAPI_LibraryPart_CheckLibPartSubtypeOf |
( |
const char * |
successorUnIDStr, |
|
|
const char * |
predecessorUnIDStr |
|
) |
| |
Checks whether a library part unique ID refers to a subtype of another.
- Parameters
-
successorUnIDStr | [in] the unique ID of the subtype. |
predecessorUnIDStr | [in] the unique ID of the expected ancestor. |
- Returns
- NoError - The function has completed with success and the ancestry holds.
- APIERR_NOTSUBTYPEOF - The function has completed with success but the first one is not a subtype of the second.
- APIERR_BADPARS - any of the parameters are nullptr.
◆ ACAPI_LibraryPart_CheckLibPartSubtypeOfbyMain()
GSErrCode ACAPI_LibraryPart_CheckLibPartSubtypeOfbyMain |
( |
const char * |
successorUnIDStr, |
|
|
const char * |
predecessorUnIDStr |
|
) |
| |
Checks whether a library part unique ID refers to a subtype of another.
- Parameters
-
successorUnIDStr | [in] the unique ID of the subtype. |
predecessorUnIDStr | [in] the unique ID of the expected ancestor. |
- Returns
- NoError - The function has completed with success and the ancestry holds.
- APIERR_NOTSUBTYPEOF - The function has completed with success but the first one is not a subtype of the second.
- APIERR_BADPARS - any of the parameters are nullptr.
◆ ACAPI_LibraryPart_CloseParameters()
GSErrCode ACAPI_LibraryPart_CloseParameters |
( |
| ) |
|
Closes the Library Part parameter list opened for editing.
- Returns
- NoError - The function always returns NoError.
- Example
See the example given at the APIAny_OpenParametersID
function.
◆ ACAPI_LibraryPart_CompareLibPartUnIds()
GSErrCode ACAPI_LibraryPart_CompareLibPartUnIds |
( |
const char * |
unIDStr1, |
|
|
const char * |
unIDStr2 |
|
) |
| |
Compares two library part unique IDs.
- Parameters
-
unIDStr1 | [in] the first library part unique ID. |
unIDStr2 | [out] the second library part unuique ID. |
- Returns
- NoError - The function has completed with success and the two unique IDs are equal.
- APIERR_NOTEQUALREVISION - The function has completed with success and the main GUID parts of the unique IDs are equal but the revision IDs differ.
- APIERR_NOTEQUALMAIN - The function has completed with success but even the main GUID parts of the unique IDs differ.
- APIERR_BADPARS - any of the parameters are nullptr.
◆ ACAPI_LibraryPart_Create()
GSErrCode ACAPI_LibraryPart_Create |
( |
const API_LibPart * |
libPart | ) |
|
Starts to create a new Library Part from scratch.
- Parameters
-
libPart | [in] Parameters of the Library Part to create |
- Returns
- NoError - The function has completed with success.
- APIERR_NESTING - Recursive call, ACAPI_LibraryPart_Save was not called after the previous call
- APIERR_BADPARS - The libPart parameter is nullptr, or holds invalid data
- APIERR_BADID - No match found with the passed parentUnID
- APIERR_NOLIB - No valid location was passed, and there is no active library also
- APIERR_READONLY - The specified location is read-only
- Example
GSHandle paramsHdl, draw2DHdl;
double a, b;
char buffer[256] = {};
GSErrCode err;
BNClear (libPart);
CHCopyC (
"{57B7C584-5C0D-11D6-A0D8-036F034B6792}-{00000000-0000-0000-0000-000000000000}", libPart.
parentUnID);
GS::ucscpy (libPart.
docu_UName, L(
"Test LibPart"));
if (libPart.
index != 0) {
return;
}
paramsHdl = nullptr;
draw2DHdl = nullptr;
a = 2.0;
b = 3.0;
if (err == NoError)
if (err == NoError) {
}
}
if (err == NoError) {
}
if (err == NoError)
if (err == NoError) {
}
if (err == NoError) {
}
if (err == NoError) {
if (err == NoError) {
CHCopyC ("rect2 0,0,a,b\n", buffer);
}
}
BMKillHandle (¶msHdl);
BMKillHandle (&draw2DHdl)
void ACAPI_WriteReport(const GS::UniString &format, bool withDial,...)
Writes a report string into the Report Windowot into a custom alert window.
GSErrCode ACAPI_LibraryPart_NewSection(const API_LibPartSection *section)
Opens a new section to write into the Library Part under creation.
GSErrCode ACAPI_LibraryPart_EndSection(void)
Closes the last opened section of the Library Part under creation.
GSErrCode ACAPI_LibraryPart_WriteSection(Int32 nByte, GSConstPtr data)
Writes data into an opened section of the Library Part under creation.
GSErrCode ACAPI_LibraryPart_SetDetails_ParamDef(const API_LibPart *libPart, GSHandle paramHdl, const API_LibPartDetails *details)
Sets the detail parameters of a Library Part parameter section handle.
GSErrCode ACAPI_LibraryPart_Save(API_LibPart *libPart)
Saves the Library Part has been created and registers it.
GSErrCode ACAPI_LibraryPart_Search(API_LibPart *ancestor, bool createIfMissing, bool onlyPlaceable=false)
Searches for a registered Library Part in the loaded libraries.
Definition of a Library Part.
Definition: APIdefs_LibraryParts.h:80
char parentUnID[128]
the unique ID string of the ancestor library part.
Definition: APIdefs_LibraryParts.h:158
Int32 index
Index of the Library Part, contains the current database index of the given Library Part....
Definition: APIdefs_LibraryParts.h:93
GS::uchar_t docu_UName[API_UniLongNameLen]
Unique document name of the Library Part. If more than one Library Part has the same name,...
Definition: APIdefs_LibraryParts.h:101
IO::Location * location
Location of the library part (GSM) file in the file system.
Definition: APIdefs_LibraryParts.h:145
bool autoHotspot
Place hotspots on the bounding box.
Definition: APIdefs_LibraryParts.h:189
bool fixSize
Store fix values rather than the ratio of current/default A/B sizes.
Definition: APIdefs_LibraryParts.h:183
Definition of a Library Part section.
Definition: APIdefs_LibraryParts.h:510
GSType sectType
Section type.
Definition: APIdefs_LibraryParts.h:516
Detail parameters of a Library Part.
Definition: APIdefs_LibraryParts.h:397
API_LibPartObjectDetails object
Library part's details of an object.
Definition: APIdefs_LibraryParts.h:402
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::GSMObject setters instead
◆ ACAPI_LibraryPart_EndSection()
GSErrCode ACAPI_LibraryPart_EndSection |
( |
void |
| ) |
|
Closes the last opened section of the Library Part under creation.
- Returns
- NoError - The function has completed with success.
- APIERR_GENERAL - No scratch file has been opened by the ACAPI_LibraryPart_Create function.
- Example
-
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::GSMObject setters instead
◆ ACAPI_LibraryPart_Get()
GSErrCode ACAPI_LibraryPart_Get |
( |
API_LibPart * |
libPart | ) |
|
Returns the data of a registered Library Part.
- Parameters
-
libPart | [in/out] Definition of the library part. |
- Returns
- NoError - The function has completed with success.
- APIERR_MISSINGDEF - The originating library part file is missing. The document name is still filled.
- APIERR_BADPARS - libPart is nullptr or the index is invalid.
- APIERR_BADINDEX - libPart.index is not correct for the given typeID.
- Example
function.
GSErrCode ACAPI_LibraryPart_GetNum(Int32 *count)
Returns the number of registered library parts.
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::LibraryManager::FindLibParts instead
◆ ACAPI_LibraryPart_GetActParameters()
Returns the actual (edited) values of a Library Part parameter list opened to edit.
- Parameters
-
theParams | [out] the modified parameter list |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - theParams is nullptr
- APIERR_NOTINIT - there is no parameter list opened
- Example
See the example given at the APIAny_OpenParametersID
function.
◆ ACAPI_LibraryPart_GetBuiltInLibpartUnId()
GSErrCode ACAPI_LibraryPart_GetBuiltInLibpartUnId |
( |
short |
templateFileResID, |
|
|
char * |
lpfUnId |
|
) |
| |
Retrieves the GUID of a built-in library part.
- Parameters
-
templateFileResID | [in] the library part template 'FILE' resource ID |
lpfUnId | [out] the required unique ID in string format |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - lpfUnId is nullptr or templateFileResID contains invalid data.
◆ ACAPI_LibraryPart_GetDetails()
Returns the detail parameters of a registered Library Part.
- Parameters
-
libInd | [in] Index of the Library Part |
details | [out] Detail parameter of the Library Part |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - any of the parameters are nullptr, or the addressed Library Part is a macro, picture file etc.
- Example
GSErrCode err;
libPart.
typeID = APILib_ObjectID;
GS::ucscpy (libPart.
docu_UName, L(
"Test LibPart"));
if (libPart.
index != 0) {
}
GSErrCode ACAPI_LibraryPart_GetDetails(Int32 libInd, API_LibPartDetails *details)
Returns the detail parameters of a registered Library Part.
API_LibTypeID typeID
Type of the Library Part.
Definition: APIdefs_LibraryParts.h:86
◆ ACAPI_LibraryPart_GetElemLibPartUnId()
GSErrCode ACAPI_LibraryPart_GetElemLibPartUnId |
( |
API_Elem_Head * |
elemHead, |
|
|
char * |
lpfUnId |
|
) |
| |
Returns the library part unique identifier of the GDL based element (object/lamp/window/door).
- Parameters
-
elemHead | [in] Head of the element. It is identified by the guid field. |
lpfUnId | [out] The required unique ID in string format. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - One or both of the parameters is nullptr.
- APIERR_DELETED - The element is deleted.
- APIERR_BADID - The element is not GDL based.
◆ ACAPI_LibraryPart_GetHotspots()
GSErrCode ACAPI_LibraryPart_GetHotspots |
( |
Int32 |
libInd, |
|
|
const API_Guid & |
instanceElemGuid, |
|
|
Int32 * |
nHotspots, |
|
|
API_PrimHotspot *** |
hotspots |
|
) |
| |
Retrieves the hotspots of a registered Library Part.
- Parameters
-
libInd | [in] Index of the library part |
instanceElemGuid | [in] Instance element GUID; if APINULLGuid, then the drawing parameters will be the default parameters of the library part (with no transformation, etc.), otherwise they are taken from the instance of the library part defined by this GUID. |
nHotspots | [out] Numbers of hotspots. |
hotspots | [out] Handle that contains the hotspot data on return. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - nHotspots or hotspots parameter is nullptr, or invalid libInd has been passed
- APIERR_BADINDEX - Invalid instanceElemGuid for the element type that libInd implies
- Example
Int32 nHotspots = 0;
Int32 libInd = 1990;
API_Guid instanceElemGuid = element.header.guid;
if (err == NoError && hotspots != nullptr) {
element.
header.typeID = API_HotspotID;
if (err == NoError) {
short ind;
for (ind = 0; ind < nHotspots; ind++) {
}
for (ind = 0; ind < nHotspots; ind++) {
err = ACAPI_Goodies (APIAny_NeigToCoordID, &(*hotspots)[ind].neig, &element.
hotspot.
pos);
if (err == NoError)
}
}
}
BMKillHandle ((GSHandle*) &hotspots);
GSErrCode ACAPI_Element_GetDefaults(API_Element *element, API_ElementMemo *memo)
Retrieves the actual default settings for the element of type.
GSErrCode ACAPI_LibraryPart_GetHotspots(Int32 libInd, const API_Guid &instanceElemGuid, Int32 *nHotspots, API_PrimHotspot ***hotspots)
Retrieves the hotspots of a registered Library Part.
Represents a GS::Guid in the API layer.
Definition: API_Guid.hpp:46
short pen
Pen attribute index.
Definition: APIdefs_Elements.h:10382
API_Coord pos
2D position of the hotspot.
Definition: APIdefs_Elements.h:10395
A primitive hotspot.
Definition: APIdefs_Elements.h:24099
A union collecting all known element types.
Definition: APIdefs_Elements.h:17120
API_HotspotType hotspot
Represents a hotspot.
Definition: APIdefs_Elements.h:17274
API_Elem_Head header
General element header.
Definition: APIdefs_Elements.h:17126
◆ ACAPI_LibraryPart_GetLastValidEmbeddedLPName()
GSErrCode ACAPI_LibraryPart_GetLastValidEmbeddedLPName |
( |
GS::UniString * |
name, |
|
|
IO::Location * |
location |
|
) |
| |
Retrieves the last valid embedded library location.
- Parameters
-
name | [in] Library part name. |
location | [out] The location of the last valid embedded libpart for the given libpart name. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_LibraryPart_GetLibPartLockStatus()
GSErrCode ACAPI_LibraryPart_GetLibPartLockStatus |
( |
const IO::Location * |
location, |
|
|
API_LockableStatus * |
status, |
|
|
IO::Location * |
userCacheLibPartLocation = nullptr |
|
) |
| |
Returns the current lock status of the given library part.
- Parameters
-
location | [in] The location of the library part. |
status | [out] The Teamwork lock status of the library part. |
userCacheLibPartLocation | [out] Location of the server library part file in the user cache (optional parameter). |
- Returns
- NoError - The function has completed with success.
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::Library::LibraryManager::GetTWID instead
◆ ACAPI_LibraryPart_GetLibPartRefGuid()
GSErrCode ACAPI_LibraryPart_GetLibPartRefGuid |
( |
const IO::Location * |
location, |
|
|
API_Guid * |
guid |
|
) |
| |
This function is used to obtain the reference guid of a library part.
- Parameters
-
location | [in] The location of the library part. |
guid | [out] The reference guid of the library part. |
- Returns
- NoError - The function has completed with success.
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::Library::GSMObject::GetUnID instead
◆ ACAPI_LibraryPart_GetLibPartToolVariation()
Returns the library part's creator element type and variation ID.
- Parameters
-
libPart | [in] Identifies the library part. A basic ACAPI_LibraryPart_Search is performed to extract the internal library part identifier. |
toolboxItem | [out] The requested creator element type and variation ID. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - Any of the parameters is nullptr.
◆ ACAPI_LibraryPart_GetLibPartUnIDStr()
GSErrCode ACAPI_LibraryPart_GetLibPartUnIDStr |
( |
const IO::Location * |
location, |
|
|
char * |
libPartUnId |
|
) |
| |
This function is used to obtain the given library part's own unique ID.
- Parameters
-
location | [in] The location of the library part. |
libPartUnId | [out] The unique ID of the library part. |
- Returns
- NoError - The function has completed with success.
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::Library::GSMObject::GetUnID instead
◆ ACAPI_LibraryPart_GetMarkerParent()
Returns the parent ID of the marker, in the parentUnID member of the libPart structure.
- Since
- Archicad 26
- Parameters
-
elemType | [in] The element type. |
libPart | [in] The library part. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - Incorrect elemType or libPart was specified.
◆ ACAPI_LibraryPart_GetNum()
GSErrCode ACAPI_LibraryPart_GetNum |
( |
Int32 * |
count | ) |
|
Returns the number of registered library parts.
- Parameters
-
count | [out] number of Library Parts. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - count is nullptr
- Example
Int32 i, count;
GSErrCode err;
if (!err) {
for (i = 1; i <= count; i++) {
if (!err) {
}
}
}
GSErrCode ACAPI_LibraryPart_Get(API_LibPart *libPart)
Returns the data of a registered Library Part.
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::LibraryManager::FindLibParts instead
◆ ACAPI_LibraryPart_GetParams()
GSErrCode ACAPI_LibraryPart_GetParams |
( |
Int32 |
libInd, |
|
|
double * |
a, |
|
|
double * |
b, |
|
|
Int32 * |
addParNum, |
|
|
API_AddParType *** |
addPars |
|
) |
| |
Returns the default parameters of a registered Library Part.
- Parameters
-
libInd | Index of the library part. |
a | The A parameter of the the Library Part |
b | The B parameter of the the Library Part |
addParNum | The number of additive parameters; others than A and B |
addPars | The additive parameters |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - Invalid libInd, or any of the parameters are nullptr, or the addressed Library Part is a macro, picture file etc.
- APIERR_MEMFULL - not enough memory to complete the operation
- Example
{
double a, b;
Int32 addParNum, i, ind, i1, i2;
double value;
char *valueStr;
GSErrCode err;
if (err) {
GiveMessage_Err ("ACAPI_LibraryPart_GetParams", err);
return;
}
GiveMessage_Val (" a", a, false);
GiveMessage_Val (" b", b, false);
for (i = 0; i < addParNum; i++) {
if ((*addPars)[i].typeMod == API_ParSimple) {
DumpOneParam ((*addPars)[i].typeID, (*addPars)[i].name, (*addPars)[i].flags,
(*addPars)[i].value.real, (*addPars)[i].value.str,
0,0);
} else {
ind = 0;
DumpOneParam ((*addPars)[i].typeID, (*addPars)[i].name, (*addPars)[i].flags,
0.0, nullptr,
-(*addPars)[i].dim1, -(*addPars)[i].dim2);
for (i1 = 1; i1 <= (*addPars)[i].dim1; i1++) {
for (i2 = 1; i2 <= (*addPars)[i].dim2; i2++) {
if ((*addPars)[i].typeID != APIParT_CString) {
value = (Int32) ((double *) *(*addPars)[i].value.array) [ind];
valueStr = nullptr;
ind ++;
} else {
value = 0.0;
valueStr = *(*addPars)[i].value.array + ind;
ind += strlen (valueStr) + 1;
}
DumpOneParam ((*addPars)[i].typeID, nullptr, 0,
value, valueStr,
i1, i2);
}
}
}
}
if (typeID == APILib_ObjectID ||
typeID == APILib_LampID ||
typeID == APILib_LabelID ||
typeID == APILib_RoomID) {
if (!err) {
}
}
if (typeID == APILib_DoorID ||
typeID == APILib_WindowID) {
}
return;
}
GSErrCode ACAPI_DisposeAddParHdl(API_AddParType ***addPars)
Frees the memory occupied by a handle to an array of API_AddParType.
API_LibTypeID
Library Part types. From Archicad 8 these categories are obsolete due to the introduction of library ...
Definition: APIdefs_LibraryParts.h:47
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::GSMObject::GetParameters instead
◆ ACAPI_LibraryPart_GetParamValues()
Returns the possible values defined for a Library Part parameter.
- Parameters
-
getValues | [out] the value list for the given parameter |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - theParams is nullptr
- APIERR_BADNAME - The parameter specified by its name was not found in the open library part
- APIERR_BADINDEX - The parameter specified by its index was not found in the open library part
- APIERR_NOTINIT - No open parameter list
- Example
See the example given at the APIAny_OpenParametersID
function.
◆ ACAPI_LibraryPart_GetSect_2DDrawHdl()
GSErrCode ACAPI_LibraryPart_GetSect_2DDrawHdl |
( |
GSHandle * |
sectionHdl | ) |
|
Returns the 2D binary (drawing) section data created from API elements.
- Parameters
-
sectionHdl | [out] 2D binary section data |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - sectionHdl is nullptr
- APIERR_GENERAL - No 2D drawing section has been opened with the ACAPI_LibraryPart_SetUpSect_2DDrawHdl function.
- Example
-
◆ ACAPI_LibraryPart_GetSect_ParamDef()
GSErrCode ACAPI_LibraryPart_GetSect_ParamDef |
( |
const API_LibPart * |
libPart, |
|
|
API_AddParType ** |
addPars, |
|
|
double * |
a, |
|
|
double * |
b, |
|
|
GSHandle |
sect2DDrawHdl, |
|
|
GSHandle * |
sectionHdl, |
|
|
GS::UniString * |
password = nullptr |
|
) |
| |
Prepares the parameter section data to save into a Library Part.
- Parameters
-
libPart | [in] The library part to work on |
addPars | [in] Additive parameters of the Library Part |
a | [in] the value of the A parameter |
b | [in] the value of the B parameter |
sect2DDrawHdl | [in] 2D binary section data |
sectionHdl | [out] the prepared parameter section data |
password | [in] The (optional) password that encrypted the section. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The libPart or the sectionHdl parameter is nullptr
- APIERR_BADID - The function cannot work with library parts of type specified by libPart->typeID
- Example
-
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::GSMObject setters instead
◆ ACAPI_LibraryPart_GetSection()
GSErrCode ACAPI_LibraryPart_GetSection |
( |
Int32 |
libInd, |
|
|
API_LibPartSection * |
section, |
|
|
GSHandle * |
sectionHdl, |
|
|
GS::UniString * |
sectionStr, |
|
|
GS::UniString * |
password = nullptr |
|
) |
| |
Returns an existing section of a registered Library Part.
- Parameters
-
libInd | [in] Index of the library part |
section | [in/out] Definition of the section. The section is defined by the sectType an the subIdent fields of the API_LibPartSection structure. |
sectionHdl | [out] Section data. |
sectionStr | [out] The content of textual sections as a Unicode string. Pass the address of an existing Unicode string if you need this data. |
password | [in] The (optional) password that encrypted the section. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - Invalid libInd, or any of the parameters are nullptr, or the addressed Library Part is a macro, picture file etc.
- APIERR_NOLIBSECT - no such a section in the Library Part
- Example
function.
GSErrCode ACAPI_LibraryPart_GetSectionList(Int32 libInd, Int32 *nSection, API_LibPartSection ***sections)
Returns the list of sections contained by a registered Library.
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::GSMObject::GetCustomSection instead
◆ ACAPI_LibraryPart_GetSectionList()
GSErrCode ACAPI_LibraryPart_GetSectionList |
( |
Int32 |
libInd, |
|
|
Int32 * |
nSection, |
|
|
API_LibPartSection *** |
sections |
|
) |
| |
Returns the list of sections contained by a registered Library.
- Parameters
-
libInd | [in] Index of the library part |
nSection | [out] Number of the sections found |
sections | [out] section data returned |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - Invalid libInd, or any of the parameters are nullptr, or the addressed Library Part is a macro, picture file etc.
◆ ACAPI_LibraryPart_GetUnloadedLibpartName()
GSErrCode ACAPI_LibraryPart_GetUnloadedLibpartName |
( |
const API_Guid * |
guid, |
|
|
GS::UniString * |
name |
|
) |
| |
Retrieves the name of a Libpart, even if the library is unloaded.
- Parameters
-
guid | [in] the guid of the Object, Lamp, Window or Door element. |
name | [out] the name of the Libpart |
- Returns
- NoError - The function has completed with success.
- APIERR_BADID - guid is nullptr
◆ ACAPI_LibraryPart_InstallESYMHandler()
GSErrCode ACAPI_LibraryPart_InstallESYMHandler |
( |
GSType |
signature, |
|
|
APIESYMCommandProc * |
handlerProc |
|
) |
| |
Installs a callback for handling external symbols.
- Parameters
-
signature | [in] A four-character identifier of the external symbol. |
handlerProc | [in] The callback function to handle the creation and the editing of the external symbol. |
- Returns
- NoError - The function has completed with success.
- Example
{
GSErrCode err = NoError;
return err;
}
GSErrCode Initialize(void)
The main entry point of the add-on.
GSErrCode APIESYMCommandProc(const API_ESYMParams *esymParams)
User supplied callback function for handling external symbols.
Definition: APIdefs_Callback.h:620
GSErrCode ACAPI_LibraryPart_InstallESYMHandler(GSType signature, APIESYMCommandProc *handlerProc)
Installs a callback for handling external symbols.
◆ ACAPI_LibraryPart_NewSection()
Opens a new section to write into the Library Part under creation.
- Parameters
-
section | [in] Parameters of the new section. |
- Returns
- NoError - The function has completed with success.
- APIERR_GENERAL - No scratch file has been opened by the ACAPI_LibraryPart_Create function.
- Example
-
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::GSMObject setters instead
◆ ACAPI_LibraryPart_OpenParameters()
Opens a Library Part parameter list to edit.
- Parameters
-
paramOwner | [in] Reference to the owner of the parameter handle which should be edited |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - paramOwner is nullptr or invalid parameters are passed
- APIERR_GENERAL - the library part do not has parameters
- Example
GSErrCode err;
paramOwner.
type = API_ObjectID;
err = ACAPI_Goodies (APIAny_OpenParametersID, ¶mOwner, nullptr);
if (err == NoError) {
err = ACAPI_Goodies (APIAny_GetActParametersID, &getParams, nullptr);
if (err == NoError) {
CHCopyC (
"zzyzx", chgParam.
name);
err = ACAPI_Goodies (APIAny_ChangeAParameterID, &chgParam, nullptr);
if (err == NoError)
err = ACAPI_Goodies (APIAny_GetActParametersID, &getParams, nullptr);
}
ACAPI_Goodies (APIAny_CloseParametersID, nullptr, nullptr);
}
if (err == NoError) {
ACAPI_ELEMENT_MASK_CLEAR (mask);
}
constexpr API_Guid APINULLGuid
Represents an empty API guid.
Definition: API_Guid.hpp:241
GSErrCode ACAPI_Element_ChangeDefaults(API_Element *element, API_ElementMemo *memo, const API_Element *mask)
Changes the default parameters of an element.
Parameters to change a value in a Library Part parameter list.
Definition: APIdefs_Goodies.h:502
char name[API_NameLen]
name of the parameter to change as ASCII string (library part parameter names are always ASCII).
Definition: APIdefs_Goodies.h:507
double realValue
numeric parameter value
Definition: APIdefs_Goodies.h:543
short index
parameter index. Required if the name field is empty.
Definition: APIdefs_Goodies.h:513
API_ElemType type
The type of the element.
Definition: APIdefs_Elements.h:407
Describes the variable length additional data of elements.
Definition: APIdefs_Elements.h:17660
API_AddParType ** params
Additional parameters for library part-based elements.
Definition: APIdefs_Elements.h:17702
The changed parameter values of a Library Part.
Definition: APIdefs_Goodies.h:561
double b
value of the 'B' parameter
Definition: APIdefs_Goodies.h:573
API_AddParType ** params
Additional parameters from the library part.
Definition: APIdefs_Goodies.h:579
double a
value of the 'A' parameter
Definition: APIdefs_Goodies.h:567
Represents an object or a lamp, or a symbol label.
Definition: APIdefs_Elements.h:5150
double xRatio
The ratio of the size of the placed object/lamp in the X direction and the A value defined in the lib...
Definition: APIdefs_Elements.h:5269
double yRatio
The ratio of the size of the placed object/lamp in the Y direction and the B value defined in the lib...
Definition: APIdefs_Elements.h:5275
Parameters to specify the target parameter list to change.
Definition: APIdefs_Goodies.h:332
API_Guid guid
element unique ID
Definition: APIdefs_Goodies.h:338
API_ElemType type
element type
Definition: APIdefs_Goodies.h:350
Int32 libInd
library part index
Definition: APIdefs_Goodies.h:344
API_ObjectType object
Represents an object.
Definition: APIdefs_Elements.h:17163
◆ ACAPI_LibraryPart_PatternSearch()
GSErrCode ACAPI_LibraryPart_PatternSearch |
( |
const API_LibPart * |
ancestor, |
|
|
const GS::UniString & |
pattern, |
|
|
API_LibPart |
result[50], |
|
|
Int32 * |
numFound |
|
) |
| |
Searches for registered Library Parts in the loaded libraries.
- Parameters
-
ancestor | [in] The library part type to search for |
pattern | [in] Pattern to search for in the loaded librairies. |
result | [out] Array to store the first 50 found library parts. |
numFound | [out] Number of found library parts. |
- Returns
- NoError - The function has completed with success, the Library Part has been found (or reference created successfully if createIfMissing is true)
- APIERR_BADPARS - ancestor is nullptr, numFound is nullptr or pattern is empty
- APIERR_BADID - no library part is found according to the given typeID or ownUnID as ancestor
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::LibraryManager::FindLibParts instead
◆ ACAPI_LibraryPart_Register()
GSErrCode ACAPI_LibraryPart_Register |
( |
API_LibPart * |
libPart | ) |
|
Registers a Library Part.
- Parameters
-
libPart | [in/out] Parameters of the library part; |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - libPart is nullptr, or refers to invalid data
- Example
IO::Location fileLoc ("C:\\temp\\MyLibpart.gsm");
GSErrCode err;
libPart.
typeID = APILib_ObjectID;
GSErrCode ACAPI_LibraryPart_Register(API_LibPart *libPart)
Registers a Library Part.
◆ ACAPI_LibraryPart_RegisterAll()
GSErrCode ACAPI_LibraryPart_RegisterAll |
( |
GS::Array< API_LibPart > * |
libParts | ) |
|
Registers an array of Library Parts.
- Parameters
-
libParts | [in/out] Parameters of the library parts; the type, the owner signature and the location of the library parts must be initialized, by setting the typeID, ownerID and the location fields respectively. Other values will be filled and returned by Archicad. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - libParts is nullptr, or any of its members refer to invalid data.
- Example
GS::Array<API_LibPart> libParts;
for (int i = 0; i < 10; ++i) {
libParts.Push (libPart);
}
GSErrCode ACAPI_LibraryPart_RegisterAll(GS::Array< API_LibPart > *libParts)
Registers an array of Library Parts.
◆ ACAPI_LibraryPart_RegisterESYM()
GSErrCode ACAPI_LibraryPart_RegisterESYM |
( |
GSType |
signature, |
|
|
API_LibTypeID |
typeID, |
|
|
short |
stringResID |
|
) |
| |
Registers an external symbol type with Archicad.
- Parameters
-
signature | [in] Unique identifier of the new symbol type (a four-character ID). |
typeID | [in] Type of the new symbol (can be API_ObjectID , API_LampID , API_WindowID , or API_DoorID ). |
stringResID | [in] Resource containing the description of the new symbol type. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - Invalid symbol type.
- Example
{
GSErrCode err;
return err;
}
GSErrCode RegisterInterface(void)
In this function the add-on can register its services, and menu commands.
GSErrCode ACAPI_LibraryPart_RegisterESYM(GSType signature, API_LibTypeID typeID, short stringResID)
Registers an external symbol type with Archicad.
◆ ACAPI_LibraryPart_Save()
GSErrCode ACAPI_LibraryPart_Save |
( |
API_LibPart * |
libPart | ) |
|
Saves the Library Part has been created and registers it.
- Parameters
-
libPart | [in/out] Parameters of the library part to create |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The libPart parameter is nullptr
- APIERR_GENERAL - No scratch file has been opened with the ACAPI_LibraryPart_Create function.
- Example
-
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::GSMObject setters instead
◆ ACAPI_LibraryPart_Search()
GSErrCode ACAPI_LibraryPart_Search |
( |
API_LibPart * |
ancestor, |
|
|
bool |
createIfMissing, |
|
|
bool |
onlyPlaceable = false |
|
) |
| |
Searches for a registered Library Part in the loaded libraries.
- Parameters
-
ancestor | [in/out] The library part to search for |
createIfMissing | [in] Set to true to create a reference if it is missing. |
onlyPlaceable | [in] The search is limited to placeable library parts only. Optional parameter, can be omitted. |
- Returns
- NoError - The function has completed with success, the Library Part has been found (or reference created successfully if createIfMissing is true)
- APIERR_MISSINGDEF - The originating library part file is missing. The document name is still filled.
- APIERR_BADPARS - ancestor is nullptr
- APIERR_BADID - no library part is found according to the given ownUnID, parentUnID or typeID parameters
- APIERR_BADNAME - no library part is found with the given document or file name
- APIERR_MEMFULL - the reference cannot be created; only when createIfMissing is true
- Example
-
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::LibraryManager::FindLibParts instead
◆ ACAPI_LibraryPart_SetDetails_ParamDef()
Sets the detail parameters of a Library Part parameter section handle.
- Parameters
-
libPart | [in] The library part to work on. |
paramHdl | [in/out] Parameter section data |
details | [in] Detail parameters |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - any of the parameters are nullptr
- Example
-
◆ ACAPI_LibraryPart_SetUpSect_2DDrawHdl()
GSErrCode ACAPI_LibraryPart_SetUpSect_2DDrawHdl |
( |
void |
| ) |
|
Sets up an empty 2D binary (drawing) section to fill up from API elements.
- Returns
- NoError - The function has completed with success.
- APIERR_NESTING - recursive call, ACAPI_LibraryPart_GetSect_2DDrawHdl was not called after the previous call
- APIERR_MEMFULL - not enough memory
- Example
-
◆ ACAPI_LibraryPart_ShapePrims()
GSErrCode ACAPI_LibraryPart_ShapePrims |
( |
Int32 |
libInd, |
|
|
const API_Guid & |
instanceElemGuid, |
|
|
short |
gdlContext, |
|
|
ShapePrimsProc * |
shapePrimsProc |
|
) |
| |
Virtually draws the shape of a registered Library Part.
- Parameters
-
libInd | [in] Index of the library part |
instanceElemGuid | [in] Instance element GUID; if APINULLGuid, then the drawing parameters will be the default parameters of the library part (with no transformation, etc.), otherwise they are taken from the instance of the library part defined by this GUID. |
gdlContext | [in] The environment of the GDL object (sets GLOB_CONTEXT GDL Global parameter).
Context | Value |
Default (depends on the current database) | APIGdl_Default |
Library Part Editing Dialog (all windows within it) | APIGdl_FromEdit |
Floor Plan Window | APIGdl_FromFloor |
3D Window | APIGdl_From3DWin |
Section/Elevation Windows | APIGdl_FromSide |
Library Part Settings Dialog | APIGdl_FromDial |
List generated about Library Part | APIGdl_FromList |
Detail Windows | APIGdl_FromDetail |
Layout Windows | APIGdl_FromLayout |
|
shapePrimsProc | [in] Callback function for catching the drawing primitives of the Libpart Part shape. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - shapePrimsProc is nullptr, or invalid libInd parameter has been passed.
- APIERR_BADINDEX - Invalid instanceElemGuid for the element type that libInd implies.
- APIERR_NESTING - The function was called from a ShapePrimsProc; recursion is not allowed.
◆ ACAPI_LibraryPart_UpdateSection()
GSErrCode ACAPI_LibraryPart_UpdateSection |
( |
Int32 |
libInd, |
|
|
const API_LibPartSection * |
section, |
|
|
GSHandle |
sectionHdl, |
|
|
GS::UniString * |
sectionStr, |
|
|
GS::UniString * |
password = nullptr |
|
) |
| |
Updates a section of a registered Library Part.
- Parameters
-
libInd | [in] Index of the Library Part |
section | [in] Identifier of the section. |
sectionHdl | [in] Section data. |
sectionStr | [in] Optional Unicode content of any textual section. |
password | [in] The (optional) password that encrypted the section. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - Invalid libInd, or any of the parameters are nullptr, or the addressed Library Part is a macro, picture file etc.
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::GSMObject::SetCustomSection instead
◆ ACAPI_LibraryPart_WriteSection()
GSErrCode ACAPI_LibraryPart_WriteSection |
( |
Int32 |
nByte, |
|
|
GSConstPtr |
data |
|
) |
| |
Writes data into an opened section of the Library Part under creation.
- Parameters
-
nByte | [in] Number of bytes. |
data | [in] Data to be written. |
- Returns
- NoError - The function has completed with success.
- APIERR_GENERAL - No section has been opened with the ACAPI_LibraryPart_NewSection function.
- Example
-
- Warning
- Legacy function - to be deleted in future versions, use ACAPI::LM::GSMObject setters instead