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.
SOLVED!

How to create composite slabs through Add On

kency
Booster

Hello, 

 

We are trying to create a slab with Composite structure and wanted to know how we can set the option "Concrete Floor Insulated with 10mm Tile" through the Add On. We were following the API structure of ArchiCAD 25 and we wanted to try by giving different value for composite field. But today the API reference got updated to ArchiCAD 27 and it showed a function ACAPI_CreateAttributeIndex to create the composite field. But this function is only supported in ArchiCAD 27.

 

Summarizing my queries:

1. How to set the option Concrete Floor Insulated with 10mm Tile through Add On code.

2. Is there any way we can refer to the ArchiCAD 25 version?

kency_0-1697093497516.png

@roni 

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Hi Kency,

 

1. Yes ACAPI_CreateAttributeIndex was introduced with AC27. Up to AC26 you can just assign an integer directly to the composite field and that should work.

slabElement.slab.composite = attributeIndexOfYourComposite;

To find out the attribute index from the composite name, you would have to iterate over all composite attributes and match the name.

 

2. Right now the only way to access older documentation is to download the DevKit, install it with the documentation and read it offline.

 

Best,
Bernd

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com

View solution in original post

7 REPLIES 7
4dProof
Advisor

genuinely curious why you would need to? I mean, this is such a simple basic fundamental workflow baked into Archicad, I can't fathom why you wouldn't just edit the composite in Archicad rather than trying to 'squeeze blood from a stone' as it were. Even if it is a case of needing it updated in multiple files; fix it in one, export the attribute via the att manager, and import into all projects, appending by index. Even if I had to update 30 projects, this would be only about 10 minutes longer than the time it takes to open those files.

 

BIM solutions and trouble shooting (self proclaimed) expert. Using Archicad 26 5002 US on Mac OS 11.5.2
Solution

Hi Kency,

 

1. Yes ACAPI_CreateAttributeIndex was introduced with AC27. Up to AC26 you can just assign an integer directly to the composite field and that should work.

slabElement.slab.composite = attributeIndexOfYourComposite;

To find out the attribute index from the composite name, you would have to iterate over all composite attributes and match the name.

 

2. Right now the only way to access older documentation is to download the DevKit, install it with the documentation and read it offline.

 

Best,
Bernd

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com

Hi 4dProof,

 

Often questions here are already distilled down to their most basic component where people are stuck. I agree that it might look like a lot of work for something that can be done quickly manually as you've mentioned.

 

But often what we do here is embedded in a much bigger workflow where it's just one tiny step to set a specific composite material. And most of the time we don't even know what material to set since we are not the ones running the Add-On! It depends on how the users use our Add-Ons and how their project is setup. So we really have to do a lot of those easy steps very generally. But then again it's easier to ask and answer programming questions if going back to specifics 😉

Hope that gives a bit of an insight on what is going on here.
Best,
Bernd

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com
kency
Booster

Thank you so much @BerndSchwarzenbacher  . Much appreciated 🙌. Just a few more follow-up questions:

1. Where can we get the list of Composite Attribute? Is there a list already provided in the Dev Kit files?

2. The downloaded DevKit did not contain the Documentation folder only the Example and Support folder was there. 👀 Please note we downloaded almost 3 weeks back.

cc: @roni 

Happy to help 🙂

 

1. It's a two step process. First get the number of attributes of a specific type and then iterate through it. For AC25 a sample code would be something like this:

API_AttributeIndex num = 0;
err = ACAPI_Attribute_GetNum (API_CompWallID, &num);
if (err != NoError) { return err; }

for (API_AttributeIndex id = 1; id <= num; ++id)
{
	API_Attribute attr{};
	attr.header.typeID = typeID;
	attr.header.index = id;

	// can also leave the following two lines out
	// if you want to work with the cstr coming from attr.header.name instead
	GS::UniString uniStrName;
	attr.header.uniStringNamePtr = &uniStrName;

	err = ACAPI_Attribute_Get (&attr);
	if (err == APIERR_DELETED || err == APIERR_BADINDEX) { continue; }
	if (err != NoError) { return err; }

	if (uniStrName == nameOfAttrToFind) {
		// do something here
	}
}

Also check out the Attribute_Test example from the DevKit.

 

2. Are you on Mac maybe? I'm not sure why, but some versions of the DevKit for macOS seem to come without a documentation.
    For the Windows versions you find an option to install the Documentation with the devKit. So maybe you have access to a windows machine somewhere where you can install the devkit + doc and copy it from there.

 

Best, Bernd

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com
kency
Booster

1. Ok, will try this out.

2. Yes, I am using Mac.

@BerndSchwarzenbacher,

fair enough. I totally get that we all work within our usual comfort zones and our own specific project, office, and workflow needs...

but, nah, it still makes no sense to me. I'll just keep hoping it doesn't come to that level of complexity for me

 

For my personal experiences, I struggle to get my clients to adopt the most simple workflows and tools; like integrated schedules, properties, or even associated labels... if I have to start teaching python, c++, or even GDL, I wont find a single firm willing to hire me.

BIM solutions and trouble shooting (self proclaimed) expert. Using Archicad 26 5002 US on Mac OS 11.5.2
Learn and get certified!