2019-02-22
06:09 AM
- last edited on
2022-10-04
04:36 PM
by
Daniel Kassai
Solved! Go to Solution.
2019-02-22 10:10 AM
API_Attribute attrib;
GSErrCode err;
BNZeroMemory (&attrib, sizeof (API_Attribute));
attrib.header.typeID = API_LayerID;
strcpy (attrib.header.name, "2D Drafting - General");
err = ACAPI_Attribute_Search (&attrib.header); /* search by name: index returned in header */
if (err != NoError) {
WriteReport_Err ("Layer \"2D Drafting - General\" was not found", err);
return;
}
short GetAttributeIndex (const API_AttrTypeID typeID, const GS::UniString& attributeName)
{
API_Attribute attrib;
GSErrCode err;
BNZeroMemory (&attrib, sizeof (API_Attribute));
attrib.header.typeID = typeID;
attrib.header.uniStringNamePtr = &attributeName;
err = ACAPI_Attribute_Search (&attrib.header); /* search by unistring name: index returned in header */
if (err != NoError)
return -1;
return attrib.header.index;
}
// You can simply call this function:
GetAttributeIndex (API_LayerID, "2D Drafting - General");
2019-02-22 10:10 AM
API_Attribute attrib;
GSErrCode err;
BNZeroMemory (&attrib, sizeof (API_Attribute));
attrib.header.typeID = API_LayerID;
strcpy (attrib.header.name, "2D Drafting - General");
err = ACAPI_Attribute_Search (&attrib.header); /* search by name: index returned in header */
if (err != NoError) {
WriteReport_Err ("Layer \"2D Drafting - General\" was not found", err);
return;
}
short GetAttributeIndex (const API_AttrTypeID typeID, const GS::UniString& attributeName)
{
API_Attribute attrib;
GSErrCode err;
BNZeroMemory (&attrib, sizeof (API_Attribute));
attrib.header.typeID = typeID;
attrib.header.uniStringNamePtr = &attributeName;
err = ACAPI_Attribute_Search (&attrib.header); /* search by unistring name: index returned in header */
if (err != NoError)
return -1;
return attrib.header.index;
}
// You can simply call this function:
GetAttributeIndex (API_LayerID, "2D Drafting - General");
2019-02-22 10:29 AM
API_Attribute attrib; GSErrCode err; BNZeroMemory (&attrib, sizeof (API_Attribute)); attrib.header.typeID = API_LayerID; strcpy (attrib.header.name, "2D Drafting - General"); err = ACAPI_Attribute_Search (&attrib.header); /* search by name: index returned in headerThis particular case is looking up a layer, but the same principle applies for any attribute type.
2019-02-22 03:11 PM