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

how to create curtainWall accessory?

vanxis
Participant
void		Do_CurtainWall_createAccessory(void)
{
	API_Element element, mask;
	API_LibPart         libPart;
	API_Guid		guid, guid1,guid2;
	API_ElemTypeID	typeID;
	GSErrCode err;


	BNZeroMemory(&element, sizeof(API_Element));

	if (!ClickAnElem("Click a Curtain Wall to Modify", API_CurtainWallFrameID, nullptr, &typeID, &guid)) {
		WriteReport_Alert("No curtain wall was clicked");
		return;
	}
	element.header.guid = guid;
	element.header.typeID = typeID;
	err = ACAPI_Element_Get(&element);
	guid2=element.cwFrame.symbolID;
	guid1 = element.cwFrame.owner;

	////return index///
	BNZeroMemory(&libPart, sizeof(libPart));
	GS::snuprintf(libPart.docu_UName, sizeof(libPart.docu_UName) / sizeof(GS::uchar_t), L("D-T吊件"));
	err = ACAPI_LibPart_Search(&libPart, false);
	if (err != NoError)
	{
		return;
	}
	int indac = libPart.index;

	BNZeroMemory(&element, sizeof(API_Element));
//	element.header.typeID = API_CurtainWallAccessoryID;
	element.cwAccessory.head.typeID = API_CurtainWallAccessoryID;
	err = ACAPI_Element_GetDefaults(&element, nullptr);
	if (err != NoError) {
		ErrorBeep("ACAPI_Element_GetDefaults", err);
		return;
	}
	element.cwAccessory.refFrame = guid;
	//element.cwAccessory.category = APICWAccC_Custom;
	element.cwAccessory.owner = guid1;
	//element.cwAccessory.hasSymbol = true;
	//element.cwAccessory.symbolID = guid2;
	//element.cwAccessory.symbolID = guid2;
	//element.cwAccessory.libInd = indac;

	err = ACAPI_Element_Create(&element, nullptr);

//	ACAPI_DisposeElemMemoHdls(&memo);

}
hello everyone!
I want to click a frame and put an accessory on it ,this is the code ,but when I run it ,it is returned err =-2130312312
Archicad user and Developer
4 REPLIES 4
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Creating new curtain wall subelem (frame, panel, accessory, junction) is not available via API using the ACAPI_Element_Create or ACAPI_Element_CreateExt functions.

You can add only new frames to an existing curtain wall by using the ACAPI_Element_Change on the curtain wall and passing the new frames in the cWallFrames field of the memo.
vanxis
Participant
Tibor wrote:
Creating new curtain wall subelem (frame, panel, accessory, junction) is not available via API using the ACAPI_Element_Create or ACAPI_Element_CreateExt functions.

You can add only new frames to an existing curtain wall by using the ACAPI_Element_Change on the curtain wall and passing the new frames in the cWallFrames field of the memo.
Hi Tibor!
Thanks for your reply !
I tested it in the way you said yesterday, but I didn't find the right parameter input, I don't know how I need to enter parameters in memo if I want to create a accessory or a juction . I have read the “element_test” example,but there is not any information about them. can you give a simple example?
Archicad user and Developer
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
vanxis wrote:
I don't know how I need to enter parameters in memo if I want to create a accessory or a juction.
Sorry if I was not clear enough.
You can add only new frames to an existing curtain wall via API.
Currently there is no way to create new accessories or junctions using the API.
vanxis
Participant
Tibor wrote:
vanxis wrote:
I don't know how I need to enter parameters in memo if I want to create a accessory or a juction.
Sorry if I was not clear enough.
You can add only new frames to an existing curtain wall via API.
Currently there is no way to create new accessories or junctions using the API.
I'm sorry to hear that. I can only find another way. thanks !
Archicad user and Developer

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!