BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Archicad C++ API
About Archicad add-on development using the C++ API.

Get MEP Object type in Add On API C++

Ankur Yadav
Participant

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.

8 REPLIES 8
kuvbur
Enthusiast

You can filter it by API_​ElemVariationID.

Structural engineer, developer of free addon for sync GDL param and properties

But it doesn't have classification for MEP elements. I need MEP element identification.

 

AnkurYadav_0-1684838583481.png

 

kuvbur
Enthusiast

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

Can we access this type info of library parts using API

AnkurYadav_1-1684839328249.png

 

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

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.

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?

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

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

Learn and get certified!