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

ACAPI_LibraryPart_GetSection return value from ArchiCAD 27

Fermat
Contributor

From ArchiCAD 27 the ACAPI_LibPart_GetSection function has been replaced by the ACAPI_LibraryPart_GetSection one. Till ArchiCAD 26 when I try to get data from an empty '2DDR' (

API_Sect2DDraw) section using the ACAPI_LibPart_GetSection function I obtained an APIERR_NOLIBSECT error. From ArchiCAD 27 (and also on ArchiCAD 28) the result of the ACAPI_LibraryPart_GetSection function call is NoError. Is there a way to understand that the section doesn't exist?

Regards

Silvia


2.png
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
LChen
Graphisoft
Graphisoft

Hi,

I'd suggest you to check the section handle if you cannot get error code. By the way, I've checked AC28 (build 3110), it returns APIERR_NOLIBSECT in case of empty section.

	section.sectType = API_Sect2DDraw;

	GSHandle	sectionHdl;
	err = ACAPI_LibraryPart_GetSection(libPart.index, &section, &sectionHdl, &sectionStr);

	if (sectionHdl == nullptr) {
		ACAPI_WriteReport("Section is empty!", false);
	}

HTH.

View solution in original post

1 REPLY 1
Solution
LChen
Graphisoft
Graphisoft

Hi,

I'd suggest you to check the section handle if you cannot get error code. By the way, I've checked AC28 (build 3110), it returns APIERR_NOLIBSECT in case of empty section.

	section.sectType = API_Sect2DDraw;

	GSHandle	sectionHdl;
	err = ACAPI_LibraryPart_GetSection(libPart.index, &section, &sectionHdl, &sectionStr);

	if (sectionHdl == nullptr) {
		ACAPI_WriteReport("Section is empty!", false);
	}

HTH.