Functions related to accessing and manipulating Attribute and the Attribute-related data of elements.
More...
|
enum | API_LtypItemID {
APILine_IllegalItemType
, APILine_SeparatorItemType
, APILine_CenterDotItemType
, APILine_CenterLineItemType
,
APILine_DotItemType
, APILine_RightAngleItemType
, APILine_ParallelItemType
, APILine_LineItemType
,
APILine_CircItemType
, APILine_ArcItemType
} |
| Describes the various item types of a symbol line. More...
|
|
enum | API_OccupancyTypeID { APIOccupancyType_Residential = 1
, APIOccupancyType_NonResidential = 2
} |
| Occupancy type of the Operation Profile.
|
|
enum | API_FillOrientationID { APIFillOrientation_ProjectOrigin = 0
, APIFillOrientation_ElementOrigin = 1
, APIFillOrientation_FitToSkin = 2
} |
| Determines the orientation of the fill pattern.
|
|
|
GSErrCode | ACAPI_Attribute_GetCurrPenSet (API_AttributeIndex *penSetIndex) |
| Get current pen set index.
|
|
GSErrCode | ACAPI_AddOnIntegration_InstallAttrManagerImportMethod (const GS::UniString &fileExtension, ImportAttrProc *importProc) |
| Installs the import method for the Attribute Manager.
|
|
GSErrCode | ACAPI_DisposeAttrDefsHdls (API_AttributeDef *defs) |
| Frees the memory occupied by all of the attribute definition handles.
|
|
GSErrCode | ACAPI_DisposeAttrDefsHdlsExt (API_AttributeDefExt *defs) |
| Frees the memory occupied by all of the attribute definition handles.
|
|
GSErrCode | ACAPI_Attribute_ModifyPen (const API_Pen &pen) |
| Modify a pen by index in the active pentable.
|
|
GSErrCode | ACAPI_Attribute_GetPen (API_Pen &pen) |
| Returns a pen by index from the active pentable.
|
|
GSErrCode | ACAPI_Attribute_GetPenNum (UInt32 &count) |
| Get the number of pens in the active pentable.
|
|
GSErrCode | ACAPI_Attribute_GetNum (API_AttrTypeID typeID, UInt32 &count) |
| Returns the number of instances of a given type of attribute.
|
|
GSErrCode | ACAPI_Attribute_Get (API_Attribute *attribute) |
| Retrieves an attribute from the database.
|
|
GSErrCode | ACAPI_Attribute_GetAttributesByType (API_AttrTypeID typeID, GS::Array< API_Attribute > &attributes) |
| Returns the instances of a given attribute type in the database.
|
|
GSErrCode | ACAPI_Attribute_EnumerateAttributesByType (API_AttrTypeID typeID, const std::function< void(API_Attribute &)> &processor) |
| Iterates the instances of a given attribute type in the database.
|
|
GSErrCode | ACAPI_Attribute_GetDef (API_AttrTypeID typeID, API_AttributeIndex index, API_AttributeDef *defs) |
| Retrieves extended information for an attribute.
|
|
GSErrCode | ACAPI_Attribute_GetDefExt (API_AttrTypeID typeID, API_AttributeIndex index, API_AttributeDefExt *defs) |
| Retrieves extended information for an attribute.
|
|
GSErrCode | ACAPI_Attribute_Create (API_Attribute *attribute, API_AttributeDef *defs) |
| Creates an attribute.
|
|
GSErrCode | ACAPI_Attribute_CreateExt (API_Attribute *attribute, API_AttributeDefExt *defs) |
| Creates an attribute.
|
|
GSErrCode | ACAPI_Attribute_Modify (API_Attribute *attribute, API_AttributeDef *defs) |
| Modifies an attribute.
|
|
GSErrCode | ACAPI_Attribute_ModifyExt (API_Attribute *attribute, API_AttributeDefExt *defs) |
| Modifies an attribute.
|
|
GSErrCode | ACAPI_Attribute_Search (API_Attr_Head *attrHead) |
| Searches for an attribute by name.
|
|
GSErrCode | ACAPI_Attribute_Delete (const API_Attr_Head &attrHead) |
| Deletes an attribute.
|
|
GSErrCode | ACAPI_Attribute_DeleteMore (API_AttrTypeID attrTypeID, const GS::Array< API_AttributeIndex > &attrIndexList) |
| Deletes more attributes of the same type.
|
|
GSErrCode | ACAPI_UserData_GetUserData (API_Attr_Head *attrHead, API_AttributeUserData *userData) |
| Obtains the user data attached to an attribute.
|
|
GSErrCode | ACAPI_UserData_SetUserData (API_Attr_Head *attrHead, const API_AttributeUserData *userData) |
| Attaches user data to an attribute, or deletes the attached data.
|
|
GSErrCode | ACAPI_Attribute_GetAttributesFromProject (const IO::Location &location, API_AttrTypeID typeID, GS::Array< GS::Pair< API_Attribute, API_AttributeDefExt > > *resultArray) |
| Loads the given attributes from a project file.
|
|
Modeler::IAttributeReader * | ACAPI_Attribute_GetCurrentAttributeSetReader () |
| Returns an attribute reader for the currently used attribute set.
|
|
GSErrCode | ACAPI_Attribute_GetFolder (API_AttributeFolder &folder) |
| Retrieves an existing attribute folder by it's path or guid.
|
|
GSErrCode | ACAPI_Attribute_CreateFolder (API_AttributeFolder &folder) |
| Creates attribute folders. To create a folder, its full path has to be provided. The command will create all folders along the path, if they do not exist.
|
|
GSErrCode | ACAPI_Attribute_Move (const GS::Array< API_AttributeFolder > &foldersToMove, const GS::Array< GS::Guid > &attributesToMove, const API_AttributeFolder &targetFolder) |
| Moves attributes and attribute folders.
|
|
GSErrCode | ACAPI_Attribute_GetFolderContent (const API_AttributeFolder &folder, API_AttributeFolderContent &result) |
| Returns all folders and attributes of an attribute type.
|
|
GSErrCode | ACAPI_Attribute_DeleteFolder (const API_AttributeFolder &folder) |
| Deletes an attribute folder and all the folders and attributes it contains.
|
|
GSErrCode | ACAPI_Attribute_RenameFolder (const API_AttributeFolder &folder, const GS::UniString &newName) |
| Deletes an attribute folder and all the folders and attributes it contains.
|
|
GSErrCode | ACAPI_Attribute_CreateAttributeFolderPicker (const API_AttributeFolderPickerParams &attributeFolderPickerParams, GS::Owner< API_AttributeFolderPicker > &attributeFolderPicker) |
| Enables the attribute folder picker functionality for a push check, if the user clicks the push check, the picker will open. Attributes folder pickers can be used to choose an attribute folder.
|
|
API_AttributeIndex | ACAPI_Attribute_GetFirstValidAttribute (API_AttrTypeID typeID) |
| Returns the first valid attribute index.
|
|
GSErrCode | ACAPI_Attribute_GetClassificationItems (const API_Attr_Head &attrHead, GS::Array< GS::Pair< API_Guid, API_Guid > > &systemItemPairs) |
| Retrieves all of the classifications of an attribute.
|
|
GSErrCode | ACAPI_Attribute_GetClassificationInSystem (const API_Attr_Head &attrHead, const API_Guid &systemGuid, API_ClassificationItem &item) |
| Retrieves a classification of an attribute in a given classification system.
|
|
GSErrCode | ACAPI_Attribute_AddClassificationItem (const API_Attr_Head &attrHead, const API_Guid &itemGuid) |
| Classifies an attribute.
|
|
GSErrCode | ACAPI_Attribute_RemoveClassificationItem (const API_Attr_Head &attrHead, const API_Guid &itemGuid) |
| Removes a classification from an attribute.
|
|
bool | ACAPI_Attribute_IsClassificationItemVisible (const API_Attr_Head &attrHead, const API_Guid &classificationGuid) |
| Tells whether a classification item is visible for an attribute.
|
|
GSErrCode | ACAPI_Attribute_GetPropertyDefinitions (const API_Attr_Head &attrHead, API_PropertyDefinitionFilter filter, GS::Array< API_PropertyDefinition > &definitions) |
| Retrieves all of the built-in property definitions that are available for an attribute.
|
|
GSErrCode | ACAPI_Attribute_GetPropertyValue (const API_Attr_Head &attrHead, const API_Guid &propertyDefinitionGuid, API_Property &property) |
| Retrieves the property value of the property definition.
|
|
GSErrCode | ACAPI_Attribute_GetPropertyValues (const API_Attr_Head &attrHead, const GS::Array< API_PropertyDefinition > &propertyDefinitions, GS::Array< API_Property > &properties) |
| Retrieves the property values of the property definitions.
|
|
GSErrCode | ACAPI_Attribute_GetPropertyValuesByGuid (const API_Attr_Head &attrHead, const GS::Array< API_Guid > &propertyDefinitions, GS::Array< API_Property > &properties) |
| Retrieves the property values of the property definitions.
|
|
GSErrCode | ACAPI_Attribute_SetProperty (const API_Attr_Head &attrHead, const API_Property &property) |
| Sets the property value of the property definition.
|
|
GSErrCode | ACAPI_Attribute_SetProperties (const API_Attr_Head &attrHead, const GS::Array< API_Property > &properties) |
| Sets the specified built-in properties for the given values on an attribute.
|
|
bool | ACAPI_Attribute_IsPropertyDefinitionValueEditable (const API_Attr_Head &attrHead, const API_Guid &propertyGuid) |
| Tells whether a property definition is editable for an attribute.
|
|
bool | ACAPI_Attribute_IsPropertyDefinitionAvailable (const API_Attr_Head &attrHead, const API_Guid &propertyGuid) |
| Tells whether a property definition is available for an attribute.
|
|
bool | ACAPI_Attribute_IsPropertyDefinitionVisible (const API_Attr_Head &attrHead, const API_Guid &propertyGuid) |
| Tells whether a property definition is visible for an attribute.
|
|
GSErrCode | ACAPI_Attribute_ModifyPropertyValue (const API_Property &property, const GS::Array< API_Attr_Head > &attrHeaders) |
| Sets the value of a property for multiple attributes. If the property is not available for at least one of the given attribute then returns with an error without changing any property value.
|
|
GSErrCode | ACAPI_Notification_CatchAttributeReplacement (APIAttributeReplacementHandlerProc *handlerProc) |
| Register or unregister your add-on to be notified if some attributes are deleted and replaced by other attributes.
|
|
ADB::AttributeIndex | API2AC_AttrIndex (const API_AttributeIndex &apiIndex) |
| Converts an API_AttributeIndex to ADB::AttributeIndex.
|
|
API_AttributeIndex | AC2API_AttrIndex (const ADB::AttributeIndex &acIndex) |
| Converts an ADB::AttributeIndex to API_AttributeIndex.
|
|
API_AttributeIndex | ACAPI_CreateAttributeIndex (Int32 index) |
| A wrapper function to create an API_AttributeIndex from its GS equivalent.
|
|
Functions related to accessing and manipulating Attribute and the Attribute-related data of elements.
Attribute Overview
Available types of attributes are enumerated in the API_AttrTypeID structure. The definition of an attribute is described in the API_Attribute structure, which is in fact a union of all types of attributes. All of the attribute structures begin with a common header structure, named [APIAPI_Attr_Head
- The
typeID
field identifies the type of the attribute.
- The
index
field gives the current database index of the given attribute. References to any attribute are done through these indices.
- The
guid
field gives the global unique ID of the given attribute. You can also refer to any attribute through its guid.
- The
flags
field describes some attribute type dependent information. Possible values are listed at the same place where the given attribute structure is.
- The
name
field gives the name of the attribute which appears in the appropriate dialogs.
- The
modiTime
field tells you when the attribute was last modified.
Many attribute related functions use the API_Attribute structure on the parameter list. As a general rule, you have to fill the required fields in the union, then Archicad parses the request based on the values and passes the return parameters in the same parameter. This is why most of the functions do not have the const
directive in the prototypes.
Retrieving an attribute
Let's see a simple example. Assume you are interested in the definition of the second line type of the data structure. In this case you should use a variable with the type API_Attribute structure.
GSErrCode err;
GSErrCode ACAPI_Attribute_Get(API_Attribute *attribute)
Retrieves an attribute from the database.
API_AttrTypeID typeID
Type of the attribute; this identifies the attribute along with the index field. Refer to the API_Att...
Definition: APIdefs_Attributes.h:86
API_AttributeIndex index
The attribute index is the current database index of the given attribute. References to any attribute...
Definition: APIdefs_Attributes.h:94
Describes the different attributes.
Definition: APIdefs_Attributes.h:1855
API_Attr_Head header
A common header for all the attribute types. It contains information which applies to all the attribu...
Definition: APIdefs_Attributes.h:1861
The description of the attribute is returned in the attrib.linetype
part of the union. With this function call, you get the basic data of the given attribute, such as the name, the flags, the defined scale, etc., but you do not get the definition of the actual shape of the line type. Since producing this data may be a relatively a long conversion process, this information can be obtained with an additional function call.
GSErrCode ACAPI_Attribute_GetDef(API_AttrTypeID typeID, API_AttributeIndex index, API_AttributeDef *defs)
Retrieves extended information for an attribute.
Describes the extended information for different attributes.
Definition: APIdefs_Attributes.h:2005
In this case, you have all of the additional data related to the particular attribute. The API_AttributeDef structure is a collection of several handles (dynamic memory). If any of them are allocated it contains data. If you do not need the data any more, you have to free the allocated memory blocks to avoid memory leaks. The suggested way is the following:
GSErrCode ACAPI_DisposeAttrDefsHdls(API_AttributeDef *defs)
Frees the memory occupied by all of the attribute definition handles.
If you use this function, it is ensured that all of the dynamic data will be freed, and also that there will be no compatibility problems if your add-on is installed to a newer version of Archicad.
It is very important to examine the error codes returned by the API functions, and parse the returned value.
A typical situation is when you want to go through the instances of a particular attribute type in the database. The following example gives a good template to do that.
short nLin, i;
GSErrCode err;
for (i = 1; i <= nLin && err == NoError; i++) {
if (err == NoError) {
}
if (err == APIERR_DELETED)
err = NoError;
}
GSErrCode ACAPI_Attribute_GetNum(API_AttrTypeID typeID, UInt32 &count)
Returns the number of instances of a given type of attribute.
First you need to get the number of line types in the database. You can do that with the ACAPI_Attribute_GetNum function, but be careful. This function returns the largest index used in the database, not the number of installed attributes, because instances may be deleted. Deleted attributes are not purged from the database immediately, which means that the valid index range is not (always) continuous. This is why the APIERR_DELETED return code has to be handled.
Creating an attribute
The attribute creation process is also fairly simple. All you have to do is to fill the appropriate part of the API_Attribute, and optionally the API_AttributeDefExt structure. The ACAPI_Attribute_CreateExt function does the following:
- It checks the data for possible inconsistency. If some problem is encountered it may be corrected automatically or an error code is generated.
- It ignores for example, the
index
field in the header structure, you cannot influence which index the attribute should be referenced by. This value is automatically generated and returned to you.
- If an attribute exists with the same name in the database, the existing index will be returned. The matching procedure ignores the differences of the attribute definition. Multiple attributes with the same name are not allowed.
- The generated attribute is placed in the data structure and it can be referenced in any subsequent API call.
It is very important that Archicad does not free any dynamic data structure you have allocated and passed to Archicad. They must be freed by your code.
Another important note is the following. Every data structure filled by you must be initialized to zero, for forward compatibility. Fillers may become real data fields in the later versions of the API, so if they are not initialized to zero, the result may be unpredictable.
The template to create an attribute is the following:
API_AttributeDefsExt defs = {};
short ltypeIndex;
GSErrCode err;
GSErrCode ACAPI_DisposeAttrDefsHdlsExt(API_AttributeDefExt *defs)
Frees the memory occupied by all of the attribute definition handles.
GSErrCode ACAPI_Attribute_CreateExt(API_Attribute *attribute, API_AttributeDefExt *defs)
Creates an attribute.
Handler Functions
All of the attribute handler functions begins with the ACAPI_Attribute_ prefix. This function family gives support to query the attribute database, to modify the existing items, and also to create new instances. Refer to the functions below to have details on these topics.
Controlling the user data assigned to an attribute:
Controlling the classifications and properties assigned to an attribute:
Handling attribute folders:
Controlling attribute user interface controls:
General Error Codes
APIERR_BADID
invalid reference;
the attribute type is invalid or the operation cannot apply that type
APIERR_BADINDEX
invalid reference;
the supplied attribute index is out of range
APIERR_DELETED
invalid reference;
the attribute does not exist in the database (deleted)
APIERR_NOTMINE
permission denied;
the attribute is out of the users workspace
Notes
There are certain rules which effect the attribute operations; i.e. they may be refused for some reason. The most important rules are:
- certain attribute types have a fixed number of instances (e.g. pens),
- certain attribute types must have at least one instance (e.g. line types),
- any type of modification is allowed only in the case when the target attribute instance is in the user's workspace
◆ API_AttributeReplaceIndexTable
Contains the deleted and replaced attribute indices grouped by attribute type.
- Since
- Archicad 25
◆ APIAttributeReplacementHandlerProc
User supplied callback procedure for handling attribute replacements.
- Since
- Archicad 25
- Parameters
-
table | [in] List of attributes replaced. The hash key in the hash table is the type of attribute (material, profile etc.), the paired value is another hash table, which holds the old (deleted) attribute indices as keys, and the replacement attribute indices as values. |
- Returns
- NoError - The function has completed with success.
◆ API_LtypItemID
Describes the various item types of a symbol line.
◆ AC2API_AttrIndex()
Converts an ADB::AttributeIndex to API_AttributeIndex.
- Since
- Archicad 27
- Parameters
-
- Returns
-
◆ ACAPI_AddOnIntegration_InstallAttrManagerImportMethod()
GSErrCode ACAPI_AddOnIntegration_InstallAttrManagerImportMethod |
( |
const GS::UniString & |
fileExtension, |
|
|
ImportAttrProc * |
importProc |
|
) |
| |
Installs the import method for the Attribute Manager.
- Since
- Archicad 26
- Parameters
-
fileExtension | The unique file extension which identifies the new import format. |
importProc | Callback function, called when import a file with the registered extension. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_Attribute_AddClassificationItem()
GSErrCode ACAPI_Attribute_AddClassificationItem |
( |
const API_Attr_Head & |
attrHead, |
|
|
const API_Guid & |
itemGuid |
|
) |
| |
Classifies an attribute.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
itemGuid | [in] The guid of the classification item, that should be added to the element. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADINDEX - The attrHead did not refer to a valid attribute.
- APIERR_READONLY - The attribute can not be modified (i.e. from a hotlink) or you do not have the right to classify attributes in the current teamwork plan.
- APIERR_BADID - Inexistent classification item.
- APIERR_BADCLASSIFICATION - The classification item is not available for the given attribute.
◆ ACAPI_Attribute_Create()
Creates an attribute.
- Since
- Archicad 26
- Parameters
-
attribute | [in/out] Parameters of the attribute. The type of the attribute must be passed in the typeID field in the attribute header. The index field of the attribute header is used as an output parameter to return the reference index to the newly created attribute. |
defs | [in] Additional parameters of the attribute. It is required or optional to pass depending on the type of the attribute. |
- Returns
- NoError - The function has completed with success.
- APIERR_ATTREXIST - An attribute with the same name already exists.
- APIERR_BADID - Invalid attribute type was passed, or a pen or font attribute type was given.
- APIERR_BADPARS - A nullptr attribute pointer was passed.
- APIERR_NOTMINE - You are in view-only mode for a teamwork project.
API_AttributeTypeID | defs |
API_LayerID | - |
API_LinetypeID | ltype_dashItems (for dashed line type)
ltype_lineItems(for symbol line type) |
API_FilltypeID | fill_lineItems (for vector fill type)
fill_lineLength (for vector fill type)
sfill_Items (for symbol fill type) |
API_CompWallID | cwall_compItems |
API_MaterialID | - |
API_LayerCombID | layer_statItems |
API_ZoneCatID | zone_addParItems |
API_MEPSystemID | - |
It is important that Archicad does not free any dynamic data structure you have allocated and passed to Archicad. It is your responsibility to dispose of the handles passed in the defs parameter, when they are no longer needed. It is advised to use the ACAPI_DisposeAttrDefsHdlsExt function for compatibility reasons. This function is a non-undoable data structure modifier function. See more details on this topic at Command Overview.
- Example
API_AttributeDefs defs;
short ltypeIndex;
GSErrCode err;
BNZeroMemory (&defs, sizeof (API_AttributeDefs));
GSErrCode ACAPI_Attribute_Create(API_Attribute *attribute, API_AttributeDef *defs)
Creates an attribute.
◆ ACAPI_Attribute_CreateAttributeFolderPicker()
Enables the attribute folder picker functionality for a push check, if the user clicks the push check, the picker will open. Attributes folder pickers can be used to choose an attribute folder.
- Since
- Archicad 26
- Parameters
-
attributeFolderPickerParams | [in] Parameters of attribute folder picker (type of the attribute, the parameters of push check). |
attributeFolderPicker | [out] The constructed picker. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - Incorrect attributeFolderPickerParams was specified.
◆ ACAPI_Attribute_CreateExt()
Creates an attribute.
- Since
- Archicad 26
- Parameters
-
attribute | [in/out] Parameters of the attribute. The type of the attribute must be passed in the typeID field in the attribute header. The index field of the attribute header is used as an output parameter to return the reference index to the newly created attribute. |
defs | [in] Additional parameters of the attribute. It is required or optional to pass depending on the type of the attribute. |
- Returns
- NoError - The function has completed with success.
- APIERR_ATTREXIST - An attribute with the same name already exists.
- APIERR_BADID - Invalid attribute type was passed, or a pen or font attribute type was given.
- APIERR_BADPARS - A nullptr attribute pointer was passed.
- APIERR_NOTMINE - You are in view-only mode for a teamwork project.
API_AttributeTypeID | defs |
API_LayerID | - |
API_LinetypeID | ltype_dashItems (for dashed line type)
ltype_lineItems(for symbol line type) |
API_FilltypeID | fill_lineItems (for vector fill type)
fill_lineLength (for vector fill type)
sfill_Items (for symbol fill type) |
API_CompWallID | cwall_compItems
cwall_compLItems |
API_MaterialID | - |
API_LayerCombID | layer_statItems |
API_ZoneCatID | zone_addParItems |
API_MEPSystemID | - |
It is important that Archicad does not free any dynamic data structure you have allocated and passed to Archicad. It is your responsibility to dispose the handles passed in the defs parameter, when they are no longer needed. It is advised to use the ACAPI_DisposeAttrDefsHdlsExt function for compatibility reasons. This function is a non-undoable data structure modifier function. See more details on this topic at Command Overview.
- Example
API_AttributeDefsExt defs;
short ltypeIndex;
GSErrCode err;
BNZeroMemory (&defs, sizeof (API_AttributeDefsExt));
◆ ACAPI_Attribute_CreateFolder()
Creates attribute folders. To create a folder, its full path has to be provided. The command will create all folders along the path, if they do not exist.
- Since
- Archicad 26
- Parameters
-
folder | [in out] Type and path of the attribute folder to create. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADID - Incorrect folder.typeID was specified, or folder.path is illegal, see remarks.
- APIERR_NOPLAN - There is no open project.
- APIERR_NOACCESSRIGHT - User has no permission to create folders under typeID.
- APIERR_BADPARS - Folder creation is not available for folder.typeID.
- Example
folder.
typeID = API_CompWallID;
folder.path = { "A", "B", "C1" };
GSErrCode ACAPI_Attribute_CreateFolder(API_AttributeFolder &folder)
Creates attribute folders. To create a folder, its full path has to be provided. The command will cre...
An attribute folder.
Definition: APIdefs_Attributes.h:2176
API_AttrTypeID typeID
Type of the attribute folder; this identifies the folder along with the path or guid field.
Definition: APIdefs_Attributes.h:2182
◆ ACAPI_Attribute_Delete()
GSErrCode ACAPI_Attribute_Delete |
( |
const API_Attr_Head & |
attrHead | ) |
|
Deletes an attribute.
- Since
- Archicad 26
- Parameters
-
attrHead | [in] The typeID and index fields in the header identifies the attribute to delete. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter (attrHead) is invalid.
- APIERR_REFUSEDPAR - You tried to delete pens, fonts, a solid or an empty fill, or an attribute with index 1.
- APIERR_NOTMINE - The attribute is out of the users workspace.
- Example
GSErrCode ACAPI_Attribute_Delete(const API_Attr_Head &attrHead)
Deletes an attribute.
◆ ACAPI_Attribute_DeleteFolder()
Deletes an attribute folder and all the folders and attributes it contains.
- Since
- Archicad 26
- Parameters
-
folder | [in] The folder to delete. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - Incorrect folder was specified.
- APIERR_NOPLAN - There is no open project.
- APIERR_NOACCESSRIGHT - User has no permission to delete folders under folder.typeID.
- APIERR_NOTMINE - Attribute type folder.typeID is not reserved.
- Example
lineFolder.
typeID = API_LinetypeID;
lineFolder.path = { "A", "B", "C" };
cwFolder.
typeID = API_CompWallID;
cwFolder.guid = GS::Guid ("27075EFF-611F-4B11-9BBB-553AC8BDA922");
GSErrCode ACAPI_Attribute_DeleteFolder(const API_AttributeFolder &folder)
Deletes an attribute folder and all the folders and attributes it contains.
◆ ACAPI_Attribute_DeleteMore()
Deletes more attributes of the same type.
- Since
- Archicad 26
- Parameters
-
attrTypeID | [in] Identifies the type of the attributes to delete. |
attrIndexList | [in] List of attribute indices to be deleted. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter attrTypeID is invalid or the given attrIndexList is empty.
- APIERR_REFUSEDPAR - You tried to delete pens, fonts, a solid or an empty fill, or an attribute with index 1.
- APIERR_NOTMINE - The attribute is out of the users workspace.
- Example
if (err != NoError) {
}
GSErrCode ACAPI_Attribute_DeleteMore(API_AttrTypeID attrTypeID, const GS::Array< API_AttributeIndex > &attrIndexList)
Deletes more attributes of the same type.
◆ ACAPI_Attribute_EnumerateAttributesByType()
Iterates the instances of a given attribute type in the database.
- Since
- October 18, 2022
- Parameters
-
typeID | [in] Type of the attribute. |
processor | [in] The enumerator process on the API_Attribute as a lambda function. |
- Returns
◆ ACAPI_Attribute_Get()
Retrieves an attribute from the database.
- Since
- Archicad 27
- Parameters
-
attribute | [in/out] Parameters of the attribute. The type and the index or the name of the attribute must be passed in the typeID and index, or in the typeID and name fields in the attribute header. The data of the attribute is returned in the appropriate fields of the API_Attribute structure. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter (attribute) is nullptr
- APIERR_BADID - The attribute type is invalid
- APIERR_BADINDEX - The attribute index is invalid; if referenced by index
- APIERR_BADNAME - The attribute with the given name doesn't exist; if referenced by name
- Example
GSErrCode err;
short nLin, i;
GSErrCode err;
for (i = 1; i <= nLin && err == NoError; i++) {
if (err == NoError) {
}
if (err == APIERR_BADINDEX)
err = NoError;
}
char name[API_AttrNameLen]
The name of the attribute as UTF-8 encoded C string, which appears in the appropriate dialogs.
Definition: APIdefs_Attributes.h:115
◆ ACAPI_Attribute_GetAttributesByType()
Returns the instances of a given attribute type in the database.
- Since
- Archicad 27
- Parameters
-
typeID | [in] Type of the attribute. |
attributes | [out] The attributes in the database for the given attribute type. |
- Returns
◆ ACAPI_Attribute_GetAttributesFromProject()
Loads the given attributes from a project file.
- Parameters
-
location | [in] The location of the project to load the attributes from. |
typeID | [in] The attribute type to load from the project. |
resultArray | [out] The list of attributes that has been loaded successfully. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_Attribute_GetClassificationInSystem()
Retrieves a classification of an attribute in a given classification system.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
systemGuid | [in] The guid of the classification system in which the classification item should be retrieved. |
item | [out] The retrieved classification item (empty with null guid if the elem doesn't have a classification in the given system). |
- Returns
- NoError - The function has completed with success.
- APIERR_BADINDEX - The attrHead did not refer to a valid attribute.
- APIERR_BADID - Inexistent classification system.
◆ ACAPI_Attribute_GetClassificationItems()
GSErrCode ACAPI_Attribute_GetClassificationItems |
( |
const API_Attr_Head & |
attrHead, |
|
|
GS::Array< GS::Pair< API_Guid, API_Guid > > & |
systemItemPairs |
|
) |
| |
Retrieves all of the classifications of an attribute.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
systemItemPairs | [out] A list of classification system and classification item guid pairs, that represent the attribute's classifications. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADINDEX - The attrHead did not refer to a valid attribute.
- APIERR_GENERAL - Internal error.
◆ ACAPI_Attribute_GetCurrentAttributeSetReader()
Modeler::IAttributeReader * ACAPI_Attribute_GetCurrentAttributeSetReader |
( |
| ) |
|
Returns an attribute reader for the currently used attribute set.
- Since
- Archicad 25
- Returns
◆ ACAPI_Attribute_GetCurrPenSet()
Get current pen set index.
- Parameters
-
penSetIndex | [out] Current pen set index. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - Incorrect penSetIndex was specified.
◆ ACAPI_Attribute_GetDef()
Retrieves extended information for an attribute.
- Since
- Archicad 27
- Parameters
-
typeID | [in] Type of the attribute. |
index | [in] Index of the attribute. |
defs | [out] The extended information for an attribute. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter (defs) is nullptr
- APIERR_BADID - The attribute type is invalid; see Remarks
- APIERR_BADINDEX - The attribute index is invalid
- Example
API_AttributeDefs defs;
GSErrCode err;
BNZeroMemory (&defs, sizeof (API_AttributeDefs));
if (err == NoError)
◆ ACAPI_Attribute_GetDefExt()
Retrieves extended information for an attribute.
- Since
- Archicad 27
- Parameters
-
typeID | [in] Type of the attribute. |
index | [in] Index of the attribute. |
defs | [out] The extended information for an attribute. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter (defs) is nullptr
- APIERR_BADID - The attribute type is invalid; see Remarks
- APIERR_BADINDEX - The attribute index is invalid
- Example
API_AttributeDefsExt defs;
GSErrCode err;
BNZeroMemory (&defs, sizeof (API_AttributeDefsExt));
if (err == NoError)
GSErrCode ACAPI_Attribute_GetDefExt(API_AttrTypeID typeID, API_AttributeIndex index, API_AttributeDefExt *defs)
Retrieves extended information for an attribute.
◆ ACAPI_Attribute_GetFirstValidAttribute()
Returns the first valid attribute index.
- Parameters
-
- Since
- Archicad 27
- Returns
- API_AttributeIndex - the index of the first valid attribute of type or APIInvalidAttributeIndex
◆ ACAPI_Attribute_GetFolder()
Retrieves an existing attribute folder by it's path or guid.
- Since
- Archicad 26
- Parameters
-
folder | [in out] Set the typeID and the path or guid of the attribute folder to retrieve. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADID - Incorrect folder.typeID was specified, or folder.path is illegal, see remarks.
- APIERR_NOPLAN - There is no open project.
- Example
folder.
typeID = API_LinetypeID;
folder.guid = GS::Guid ("27075EFF-611F-4B11-9BBB-553AC8BDA922");
for (const auto& name : folder.path) {
}
GSErrCode ACAPI_Attribute_GetFolder(API_AttributeFolder &folder)
Retrieves an existing attribute folder by it's path or guid.
◆ ACAPI_Attribute_GetFolderContent()
Returns all folders and attributes of an attribute type.
- Since
- Archicad 26
- Parameters
-
folder | [in] Identifier of the folder to query. |
result | [out] Content of te queried folder. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADID - Incorrect folder was specified.
- APIERR_NOPLAN - There is no open project.
◆ ACAPI_Attribute_GetNum()
GSErrCode ACAPI_Attribute_GetNum |
( |
API_AttrTypeID |
typeID, |
|
|
UInt32 & |
count |
|
) |
| |
Returns the number of instances of a given type of attribute.
- Parameters
-
typeID | [in] Type of the attribute. |
count | [out] The number of attributes in the database for the given attribute type. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter is nullptr; count
- APIERR_BADID - The attribute type is invalid
- Example
GSErrCode err;
Index reference to an attribute.
Definition: APIdefs_AttributeIndex.hpp:24
◆ ACAPI_Attribute_GetPen()
GSErrCode ACAPI_Attribute_GetPen |
( |
API_Pen & |
pen | ) |
|
Returns a pen by index from the active pentable.
- Since
- Archicad 27
- Parameters
-
- Returns
- NoError - The function has completed with success.
- APIERR_BADINDEX - bad pen index
- APIERR_NOCURRATTRSET - no current attributeset
◆ ACAPI_Attribute_GetPenNum()
GSErrCode ACAPI_Attribute_GetPenNum |
( |
UInt32 & |
count | ) |
|
Get the number of pens in the active pentable.
- Since
- Archicad 27
- Parameters
-
count | [out] Reference of a UInt32. |
- Returns
- NoError - The function has completed with success.
- APIERR_NOCURRATTRSET - no current attributeSet exists
◆ ACAPI_Attribute_GetPropertyDefinitions()
Retrieves all of the built-in property definitions that are available for an attribute.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
filter | [in] Get the definition for user defined, fundamental or user-level built-in attributes. |
definitions | [out] Array of property definitions that are available for a classification of the given attribute. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADINDEX - The attrHead did not refer to a valid attribute.
- Example
GSErrCode GetPropertyDefinitionNames (
API_AttrTypeID attributeTypeID,
short attributeIndex, GS::Array<GS::UniString>& names)
{
GS::Array<API_PropertyDefinition> definitions;
attributeHeader.
typeID = attributeTypeID;
attributeHeader.
index = attributeIndex;
if (error == NoError) {
for (UInt32 i = 0; i < definitions.GetSize (); i++) {
names.Push(definitions[i].name);
}
}
return error;
}
GSErrCode ACAPI_Attribute_GetPropertyDefinitions(const API_Attr_Head &attrHead, API_PropertyDefinitionFilter filter, GS::Array< API_PropertyDefinition > &definitions)
Retrieves all of the built-in property definitions that are available for an attribute.
API_AttrTypeID
The type of an attribute.
Definition: APIdefs_Attributes.h:50
Contains common information related to all attribute types.
Definition: APIdefs_Attributes.h:80
◆ ACAPI_Attribute_GetPropertyValue()
Retrieves the property value of the property definition.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
propertyDefinitionGuid | [in] Property definition. |
property | [out] Property value. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADINDEX - The attrHead did not refer to a valid attribute.
- APIERR_GENERAL - Every other case.
- Example
GSErrCode GetPropertyDefinitionNames (
API_AttrTypeID attributeTypeID,
short attributeIndex, GS::Array<GS::UniString>& names)
{
GS::Array<API_PropertyDefinition> definitions;
attributeHeader.
typeID = attributeTypeID;
attributeHeader.
index = attributeIndex;
if (error == NoError) {
for (UInt32 i = 0; i < definitions.GetSize (); i++) {
}
}
return error;
}
GSErrCode ACAPI_Attribute_GetPropertyValue(const API_Attr_Head &attrHead, const API_Guid &propertyDefinitionGuid, API_Property &property)
Retrieves the property value of the property definition.
A container that can store different types of data.
Definition: APIdefs_Properties.h:890
◆ ACAPI_Attribute_GetPropertyValues()
Retrieves the property values of the property definitions.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
propertyDefinitions | [in] List of property definitions. |
properties | [out] List of property values. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADINDEX - The attrHead did not refer to a valid attribute.
- APIERR_GENERAL - Every other case.
- Example
GSErrCode GetPropertyDefinitionNames (
API_AttrTypeID attributeTypeID,
short attributeIndex, GS::Array<GS::UniString>& names)
{
GS::Array<API_PropertyDefinition> definitions;
attributeHeader.
typeID = attributeTypeID;
attributeHeader.
index = attributeIndex;
if (error == NoError) {
GS::Array<API_Property> properties;
}
}
return error;
}
GSErrCode ACAPI_Attribute_GetPropertyValues(const API_Attr_Head &attrHead, const GS::Array< API_PropertyDefinition > &propertyDefinitions, GS::Array< API_Property > &properties)
Retrieves the property values of the property definitions.
◆ ACAPI_Attribute_GetPropertyValuesByGuid()
GSErrCode ACAPI_Attribute_GetPropertyValuesByGuid |
( |
const API_Attr_Head & |
attrHead, |
|
|
const GS::Array< API_Guid > & |
propertyDefinitions, |
|
|
GS::Array< API_Property > & |
properties |
|
) |
| |
Retrieves the property values of the property definitions.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
propertyDefinitions | [in] List of property definitions identified by guid. |
properties | [out] List of property values. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADINDEX - The attrHead did not refer to a valid attribute.
- APIERR_GENERAL - Every other case.
◆ ACAPI_Attribute_IsClassificationItemVisible()
bool ACAPI_Attribute_IsClassificationItemVisible |
( |
const API_Attr_Head & |
attrHead, |
|
|
const API_Guid & |
classificationGuid |
|
) |
| |
Tells whether a classification item is visible for an attribute.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
classificationGuid | [in] The classification item GUID to search for. |
- Returns
- true - The given classification item is visible for the attribute. It can return true even if the parent of the classification item is hidden.
- false - The given classification item is not visible for the attribute or invalid parameters.
- Example
GSErrCode GetVisibleClassificationItems (
API_AttrTypeID attributeTypeID,
short attributeIndex, GS::Array<API_ClassificationItem>& visibleClassifications)
{
GS::Array<API_ClassificationItem> definitions;
attributeHeader.
typeID = attributeTypeID;
attributeHeader.
index = attributeIndex;
GSErrCode error = ACAPI_Classification_GetClassificationItems (
APINULLGuid, definitions);
if (error == NoError) {
for (UInt32 i = 0; i < definitions.GetSize (); ++i) {
visibleClassifications.Push (definitions[i]);
}
}
}
return error;
}
constexpr API_Guid APINULLGuid
Represents an empty API guid.
Definition: API_Guid.hpp:241
bool ACAPI_Attribute_IsClassificationItemVisible(const API_Attr_Head &attrHead, const API_Guid &classificationGuid)
Tells whether a classification item is visible for an attribute.
◆ ACAPI_Attribute_IsPropertyDefinitionAvailable()
bool ACAPI_Attribute_IsPropertyDefinitionAvailable |
( |
const API_Attr_Head & |
attrHead, |
|
|
const API_Guid & |
propertyGuid |
|
) |
| |
Tells whether a property definition is available for an attribute.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
propertyGuid | [in] The property definition GUID to search for. |
- Returns
- true - The given property definition is available for the attribute.
- false - The given property definition is not available for the attribute or invalid parameters.
- Example
GSErrCode GetAvailablePropertyDefinitions (
API_AttrTypeID attributeTypeID,
short attributeIndex, GS::Array<API_PropertyDefinition>& availableProperties)
{
GS::Array<API_PropertyDefinition> definitions;
attributeHeader.
typeID = attributeTypeID;
attributeHeader.
index = attributeIndex;
if (error == NoError) {
for (UInt32 i = 0; i < definitions.GetSize (); ++i) {
availableProperties.Push (definitions[i]);
}
}
}
return error;
}
bool ACAPI_Attribute_IsPropertyDefinitionAvailable(const API_Attr_Head &attrHead, const API_Guid &propertyGuid)
Tells whether a property definition is available for an attribute.
GSErrCode ACAPI_Property_GetPropertyDefinitions(const API_Guid &groupGuid, GS::Array< API_PropertyDefinition > &definitions)
Retrieves all the property definitions from a given group.
◆ ACAPI_Attribute_IsPropertyDefinitionValueEditable()
bool ACAPI_Attribute_IsPropertyDefinitionValueEditable |
( |
const API_Attr_Head & |
attrHead, |
|
|
const API_Guid & |
propertyGuid |
|
) |
| |
Tells whether a property definition is editable for an attribute.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
propertyGuid | [in] The property definition GUID to search for. |
- Returns
- true - The given property definition is editable for the attribute.
- false - The given property definition is not editable for the attribute or invalid parameters.
- Example
GSErrCode GetAvailablePropertyDefinitions (
API_AttrTypeID attributeTypeID,
short attributeIndex, GS::Array<API_PropertyDefinition>& availableProperties)
{
GS::Array<API_PropertyDefinition> definitions;
attributeHeader.
typeID = attributeTypeID;
attributeHeader.
index = attributeIndex;
if (error == NoError) {
for (UInt32 i = 0; i < definitions.GetSize (); ++i) {
availableProperties.Push (definitions[i]);
}
}
}
return error;
}
◆ ACAPI_Attribute_IsPropertyDefinitionVisible()
bool ACAPI_Attribute_IsPropertyDefinitionVisible |
( |
const API_Attr_Head & |
attrHead, |
|
|
const API_Guid & |
propertyGuid |
|
) |
| |
Tells whether a property definition is visible for an attribute.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
propertyGuid | [in] The property definition GUID to search for. |
- Returns
- true - The given property definition is visible for the attribute.
- false - The given property definition is not visible for the attribute or invalid parameters.
- Example
GSErrCode GetVisiblePropertyDefinitions (
API_AttrTypeID attributeTypeID,
short attributeIndex, GS::Array<API_PropertyDefinition>& visibleProperties)
{
GS::Array<API_PropertyDefinition> definitions;
attributeHeader.
typeID = attributeTypeID;
attributeHeader.
index = attributeIndex;
if (error == NoError) {
for (UInt32 i = 0; i < definitions.GetSize (); ++i) {
visibleProperties.Push (definitions[i]);
}
}
}
return error;
}
bool ACAPI_Attribute_IsPropertyDefinitionVisible(const API_Attr_Head &attrHead, const API_Guid &propertyGuid)
Tells whether a property definition is visible for an attribute.
◆ ACAPI_Attribute_Modify()
Modifies an attribute.
- Since
- Archicad 27
- Parameters
-
attribute | [in] The attribute to be modified is defined by the typeID and index fields of the header. |
defs | [in] The extended information for the attribute where needed. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter is nullptr; attribute, [defs]
- APIERR_BADID - The attribute type is invalid
- APIERR_BADINDEX - The attribute index is invalid
- APIERR_REFUSEDPAR - For layers, fills and line types you cannot modify the attribute with index 1. Solid and empty fills are also unalterable.
- Example
API_AttributeDefs defs;
short ltypeIndex;
GSErrCode err;
BNClear (attrib);
BNClear (defs);
if (err == NoError) {
}
if (err == NoError) {
attrib.lineType.defineScale = 100.0;
}
GSErrCode ACAPI_Attribute_Modify(API_Attribute *attribute, API_AttributeDef *defs)
Modifies an attribute.
short flags
The attribute flags. Attribute type specific values are described in the individual attribute section...
Definition: APIdefs_Attributes.h:103
◆ ACAPI_Attribute_ModifyExt()
Modifies an attribute.
- Since
- Archicad 27
- Parameters
-
attribute | [in] The attribute to be modified is defined by the typeID and index fields of the header. |
defs | [in] The extended information for the attribute where needed. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter is nullptr; attribute, [defs]
- APIERR_BADID - The attribute type is invalid
- APIERR_BADINDEX - The attribute index is invalid
- APIERR_REFUSEDPAR - For layers, fills and line types you cannot modify the attribute with index 1. Solid and empty fills are also unalterable.
- Example
API_AttributeDefsExt defs;
short ltypeIndex;
GSErrCode err;
BNClear (attrib);
BNClear (defs);
if (err == NoError) {
}
if (err == NoError) {
(*defs.cwall_compLItems)[i].ltypeInd = 3;
(*defs.cwall_compLItems)[i].linePen = 3;
}
}
GSErrCode ACAPI_Attribute_ModifyExt(API_Attribute *attribute, API_AttributeDefExt *defs)
Modifies an attribute.
short nComps
Contains the number of components (simple fills) for the composite. The number of separator lines is ...
Definition: APIdefs_Attributes.h:810
API_CompWallType compWall
A composite wall attribute.
Definition: APIdefs_Attributes.h:1885
◆ ACAPI_Attribute_ModifyPen()
GSErrCode ACAPI_Attribute_ModifyPen |
( |
const API_Pen & |
pen | ) |
|
Modify a pen by index in the active pentable.
- Since
- Archicad 27
- Parameters
-
pen | [in] Reference of the API_Pen on which the modification is based. |
- Returns
- NoError - The function has completed with success.
- APIERR_NOACCESSRIGHT - no access right in teamwork
- APIERR_NOTMINE - pen tables not reserved in teamwork
- APIERR_General - general error
- APIERR_BADINDEX - bad pen index
- APIERR_NOCURRATTRSET - no current attributeset
◆ ACAPI_Attribute_ModifyPropertyValue()
GSErrCode ACAPI_Attribute_ModifyPropertyValue |
( |
const API_Property & |
property, |
|
|
const GS::Array< API_Attr_Head > & |
attrHeaders |
|
) |
| |
Sets the value of a property for multiple attributes. If the property is not available for at least one of the given attribute then returns with an error without changing any property value.
- Parameters
-
property | [in] The new value of the property. |
attrHeaders | [in] The array of attributes, that the property should be available for. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADID - Inexistent property item.
- APIERR_NOACCESSRIGHT - The current user does not have the right to modify the properties of a specified attribute on a teamwork server.
- APIERR_READONLY - Tried to modify a read-only property (for example a property coming from a hotlink).
- APIERR_BADPROPERTY - The property definition is not available for one of the given attributes.
◆ ACAPI_Attribute_Move()
Moves attributes and attribute folders.
- Since
- Archicad 26
- Parameters
-
foldersToMove | [in] List of folders to move. |
attributesToMove | [in] List of attributes to move. |
targetFolder | [in] Target folder, i.e. the new parent of the folders and attributes to move. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADID - Incorrect typeID was specified.
◆ ACAPI_Attribute_RemoveClassificationItem()
GSErrCode ACAPI_Attribute_RemoveClassificationItem |
( |
const API_Attr_Head & |
attrHead, |
|
|
const API_Guid & |
itemGuid |
|
) |
| |
Removes a classification from an attribute.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
itemGuid | [in] The guid of the classification item, that should be removed from the attribute. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADINDEX - The attrHead did not refer to a valid attribute.
- APIERR_READONLY - The attribute can not be modified (i.e. from a hotlink) or you do not have the right to remove classifications from attributes in the current teamwork plan.
- APIERR_BADID - Inexistent classification item.
- APIERR_BADPARS - The attribute did not have the specified classification.
◆ ACAPI_Attribute_RenameFolder()
GSErrCode ACAPI_Attribute_RenameFolder |
( |
const API_AttributeFolder & |
folder, |
|
|
const GS::UniString & |
newName |
|
) |
| |
Deletes an attribute folder and all the folders and attributes it contains.
- Since
- Archicad 26
- Parameters
-
folder | [in] The folder to rename. |
newName | [in] The new name for the folder. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - Incorrect folder was specified.
- APIERR_NOPLAN - There is no open project.
- APIERR_NOACCESSRIGHT - User has no permission to rename folders under folder.typeID.
- APIERR_NOTMINE - Attribute type folder.typeID is not reserved.
◆ ACAPI_Attribute_Search()
Searches for an attribute by name.
- Parameters
-
attrHead | [in/out] The attribute to search for, identified by the typeID and name or the guid fields of the header. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter is nullptr; attrHead
- APIERR_BADID - The attribute type is invalid
- APIERR_BADGUID - The attribute with the given guid doesn't exist
- APIERR_BADNAME - The attribute with the given name doesn't exist
- Example
if (err == NoError) {
char msgStr[512];
}
GSErrCode ACAPI_Attribute_Search(API_Attr_Head *attrHead)
Searches for an attribute by name.
API_Guid & GSGuid2APIGuid(GS::Guid &guid)
Converting from GS::Guid to API_Guid.
Definition: API_Guid.hpp:95
void ACAPI_WriteReport(const GS::UniString &format, bool withDial,...)
Writes a report string into the Report Windowot into a custom alert window.
API_Guid guid
The globally unique identifier (GUID) of the attribute; can be used for identifying attributes with A...
Definition: APIdefs_Attributes.h:121
◆ ACAPI_Attribute_SetProperties()
Sets the specified built-in properties for the given values on an attribute.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
properties | [in] Specifies the properties to be set. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADID - Incorrect attributeTypeID or attributeIndex was specified or one of the property definitions' guid did not refer to a valid object.
- APIERR_NOACCESSRIGHT - The current user does not have the right to modify the properties of the specified attribute on a teamwork server.
- APIERR_READONLY - Tried to modify a read-only property (for example a property coming from a hotlink).
- APIERR_BADPROPERTY - The property definition is not available for the given attribute.
- Example
GSErrCode SetAllPropertyValuesToDefault (
API_AttrTypeID attributeTypeID,
short attributeIndex)
{
GS::Array<API_PropertyDefinition> definitions;
attributeHeader.
typeID = attributeTypeID;
attributeHeader.
index = attributeIndex;
if (error == NoError) {
GS::Array<API_Property> properties;
for (UInt32 i = 0; i < definitions.GetSize (); i++) {
properties.Push (property);
}
error = ACAPI_Attribute_GetProperties (attributeHeader, properties);
if (error == NoError) {
for (UInt32 i = 0; i < properties.GetSize (); i++) {
properties[i].isDefault = true;
}
}
}
return error;
}
GSErrCode ACAPI_Attribute_SetProperties(const API_Attr_Head &attrHead, const GS::Array< API_Property > &properties)
Sets the specified built-in properties for the given values on an attribute.
API_PropertyDefinition definition
The definition of the property.
Definition: APIdefs_Properties.h:896
◆ ACAPI_Attribute_SetProperty()
Sets the property value of the property definition.
- Parameters
-
attrHead | [in] Header of the attribute. The attribute is identified by typeID and index |
property | [in] Property. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADINDEX - The attrHead did not refer to a valid attribute.
- APIERR_NOACCESSRIGHT - The property can not be modified because you do not have the right to classify attributes in the current teamwork plan.
- APIERR_READONLY - The proeprty can not be modified because it is readonly.
- APIERR_BADID - Inexistent propert item.
- APIERR_GENERAL - Every other case.
◆ ACAPI_CreateAttributeIndex()
A wrapper function to create an API_AttributeIndex from its GS equivalent.
- Since
- Archicad 27
- Parameters
-
index | [in] The attribute index to convert. |
- Returns
- The API equivalent.
◆ ACAPI_DisposeAttrDefsHdls()
Frees the memory occupied by all of the attribute definition handles.
- Parameters
-
defs | [in] Points to an API_AttributeDef structure which contains handles used for previous operations and not needed any more. |
- Returns
◆ ACAPI_DisposeAttrDefsHdlsExt()
Frees the memory occupied by all of the attribute definition handles.
- Parameters
-
defs | [in] Points to an API_AttributeDefExt structure which contains handles used for previous operations and not needed any more. |
- Returns
◆ ACAPI_Notification_CatchAttributeReplacement()
Register or unregister your add-on to be notified if some attributes are deleted and replaced by other attributes.
- Since
- Archicad 25
- Parameters
-
handlerProc | [in] The callback procedure to call when notifications are sent out on replacement of attributes. Specifying nullptr here means you don't need the notifications any more. |
- Returns
- NoError - The required operation finished successfully.
- Example
{
char msgStr[256];
if (table.ContainsKey (API_AttrTypeID::API_BuildingMaterialID)) {
for (
const auto& entry : table[
API_AttrTypeID::API_BuildingMaterialID]) {
sprintf (msgStr, "Changed Material: old index = %d, new index = %d", *entry.key, *entry.value);
}
}
return NoError;
}
{
return err;
}
GSErrCode Initialize(void)
The main entry point of the add-on.
GS::HashTable< API_AttrTypeID, GS::HashTable< API_AttributeIndex, API_AttributeIndex > > API_AttributeReplaceIndexTable
Contains the deleted and replaced attribute indices grouped by attribute type.
Definition: APIdefs_Attributes.h:2229
GSErrCode ACAPI_Notification_CatchAttributeReplacement(APIAttributeReplacementHandlerProc *handlerProc)
Register or unregister your add-on to be notified if some attributes are deleted and replaced by othe...
◆ ACAPI_UserData_GetUserData()
Obtains the user data attached to an attribute.
- Since
- Archicad 27
- Parameters
-
attrHead | [in] Header of the attribute (only fields typeID and index are used). |
userData | [in/out] Pointer to the user data. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - Any of the passed parameters is nullptr
- APIERR_BADPLATFORMSIGN - The user data contained platform sign is invalid (out of range)
- APIERR_MEMFULL - Out of memory
- APIERR_NOUSERDATA - No user data attached by the caller module
◆ ACAPI_UserData_SetUserData()
Attaches user data to an attribute, or deletes the attached data.
- Parameters
-
attrHead | [in] The attribute to attach the user data to is defined by the typeID and index fields of the header. |
userData | [in] The user data to store. If dataHdl is nullptr, then the function deletes the user data. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - A nullptr attrHead or userData pointer was passed.
- APIERR_BADPLATFORMSIGN - The platform sign in the user data is invalid (out of range).
◆ API2AC_AttrIndex()
Converts an API_AttributeIndex to ADB::AttributeIndex.
- Since
- Archicad 27
- Parameters
-
- Returns
-