Creates an attribute.
GSErrCode ACAPI_Attribute_Create ( API_Attribute* attribute, API_AttributeDef* defs );
- [in/out] Parameters of the attribute. The type of the attribute must be passed in the
typeIDfield 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.
- [in] Additional parameters of the attribute. It is required or optional to pass depending on the type of the attribute.
- The function has completed with success.
- An attribute with the same name already exists.
- Invalid attribute type was passed, or a pen or font attribute type was given.
nullptrattribute pointer was passed.
- You are in view-only mode for a teamwork project.
For other common API errors see the API Errors document.
This function is used to create an attribute, defined by the
typeID field of the attribute header. The reference index of the newly created attribute is returned in the
index field of the attribute header.
You cannot create pen and font attributes.
The function also checks the data for possible inconsistency. If a problem is encountered it may be corrected automatically, or an error code is generated.
If an attribute with the same name exists 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.
When creating the attribute, the applicable fields should be filled.
required where applicable
ltype_dashItems(for dashed line type)
ltype_lineItems(for symbol line type)
fill_lineItems(for vector fill type)
fill_lineLength(for vector fill type)
sfill_Items(for symbol fill type)
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_DisposeAttrDefsHdls function for compatibility reasons.
This function is a non-undoable data structure modifier function. See more details on this topic at Command Overview.
API_Attribute attrib; API_AttributeDefs defs; short ltypeIndex; GSErrCode err; BNZeroMemory (&attrib, sizeof (API_Attribute)); BNZeroMemory (&defs, sizeof (API_AttributeDefs)); attrib.header.typeID = API_LinetypeID; /* fill attrib.linetype */ /* fill defs for non solid linetypes */ err = ACAPI_Attribute_Create (&attrib, &defs); ltypeIndex = attrib.header.index; ACAPI_DisposeAttrDefsHdls (&defs);
- Version: API 1.3 or later
- Header: ACAPinc.h