We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-05-23 08:47 AM
I want to identify the MEP object type like whether it's a pipe, duct, bend, cable tray etc. I am getting the library object and properties. How do i identify if an object and library part is of specific type (pipe, duct, bend, cable tray etc). Any link to documentation or code snippet would be helpful.
2023-05-23 10:12 AM
You can filter it by API_ElemVariationID.
Structural engineer, developer of free addon for sync GDL param and properties
2023-05-23 12:43 PM
But it doesn't have classification for MEP elements. I need MEP element identification.
2023-05-23 12:52 PM
That's right, there is no MEP in the standard list of subtypes, since MEP is not part of Archiсad. All MEP elements are registered with the ACAPI_Register_Subtype function and you can look up their API_ElemVariationID and build a dictionary with constants.
Structural engineer, developer of free addon for sync GDL param and properties
2023-05-23 12:55 PM
Can we access this type info of library parts using API
2023-05-23 01:13 PM
No, you need to look up the value in the element's API_Elem_Head
Structural engineer, developer of free addon for sync GDL param and properties
2023-05-23 03:44 PM
But element's API_Elem_Head has type set as API_ObjectID for all the MEP library parts. I'm not able to distinguish between them.
2023-05-23 05:05 PM
Not sure this will help- BUT- since MEP elements are just special Library Parts, they all appear to have a special parameter which distinguishes the MEP version number - currently 4. You could simply create a schedule with lists the Parameter -- "MEP Version" - If the object has that parameter, it is a MEP element, if not, just a object.
If you are confined to a C++ AddOn, you can use the functions of "ACAPI_LibPart_Get to get the part's USID and then use "ACAPI_LibPart_GetParams" to iterate through the parameters to find,or not, the "MEP Version" variable.
A third variant would be to use a simple Python script to return all the parameters of a Library Object, then search though that. That requires a C++ AddOn in association with the script to return the information. Such a AddOn and sample script is available on my GitHub site, if interested.
By far, the easiest is to just create a schedule and filter the results, but you my have other requirements?
2023-05-23 05:06 PM
API_ObjectID is API_ElemTypeID. Look at API_ElemVariationID, it is part of API_ElemType struct
Structural engineer, developer of free addon for sync GDL param and properties