cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
mcbabo
Participant

Get Materials of Multi-layer components from current selected Wall

I want to extract the materials of a wall I have currently selected

 

I only know that I get the selected elements with this code (i guess)

GS::Array<API_Neig> walls;

GSErrCode err = ACAPI_Selection_Get(nullptr, &walls, false, true, API_InsidePartially);

 


image.png
2 Replies 2
kuvbur
Advocate

 

	API_Element					element = {};
	API_ModelElemStructureType	structtype = {};
	API_AttributeIndex			constrinx = {};
	double						fillThick = 0;
	BNZeroMemory(&element, sizeof(API_Element));
	element.header.guid = elemGuid;
	err = ACAPI_Element_Get(&element);
	if (err != NoError) {return err;}
structtype = element.wall.modelElemStructureType;
		if (structtype == API_CompositeStructure) constrinx = element.wall.composite;
		if (structtype == API_BasicStructure) constrinx = element.wall.buildingMaterial;
		fillThick = element.wall.thickness;
API_Attribute						attrib;
		API_AttributeDef					defs;
		BNZeroMemory(&attrib, sizeof(API_Attribute));
		BNZeroMemory(&defs, sizeof(API_AttributeDef));
		attrib.header.typeID = API_CompWallID;
		attrib.header.index = constrinx;
		err = ACAPI_Attribute_Get(&attrib);
		if (err != NoError) {return err;}
		err = ACAPI_Attribute_GetDef(attrib.header.typeID, attrib.header.index, &defs);
		if (err != NoError) {return err;}
		for (short i = 0; i < attrib.compWall.nComps; i++) {
			/// you code for (*defs.cwall_compItems)[i].buildingMaterial, (*defs.cwall_compItems)[i].fillThick
		}
		ACAPI_DisposeAttrDefsHdls(&defs);

 

Industrial Architect and Structural Design Engineer, developer of free addon for sync GDL param and properties

mcbabo
Participant

Thanks for your code, but could you please explain the functions of every line. I am very new to the API, so I don't understand all of it.

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!