GDL
About building parametric objects with GDL.

Library Part Test Example Project

Anonymous
Not applicable
(Re-Post)

Has anybody successfully built and ran the Library Part Test Project?
The library part generated, but the window from hatch function doesn't seem to work.
On the windows version I created a breakpoint and it looks like it can't get the Polygon data from the hatch.

Has anybody had better luck?
7 REPLIES 7
Karl Ottenstein
Moderator
Ferenc wrote:
Has anybody successfully built and ran the Library Part Test Project?
The library part generated, but the window from hatch function doesn't seem to work.
Same experience on Mac. I get prompted to click on a wall to insert the window, but nothing happens. No window lib part is created in the the loaded parts either. Proper error dialogs and session report entries are made for the most part - so MakeWindowLibpart is not returning an error...

Would have to put more than a few minutes into this to track it down...

Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Karl Ottenstein
Moderator
Spent a little more time trying to find the problem, and it seems like it might be in the GetSelectedElementPolygon function, which is where poly of type API_Polygon is set from the retrieved fill.... because in MakeWindowLibpart, the value of poly.nCoords is zero...

Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Yepp.
Anonymous
Not applicable
this getpoly failure is annoying though, this would be a useful code example to build on.
Ralph Wessel
Mentor
Karl wrote:
Spent a little more time trying to find the problem, and it seems like it might be in the GetSelectedElementPolygon function, which is where poly of type API_Polygon is set from the retrieved fill.... because in MakeWindowLibpart, the value of poly.nCoords is zero...
Karl
It seems to me that a crucial part is missing. The memo for the element is retrieved with ACAPI_Element_GetMemo, but the element itself is not and consequently will have all null values. It probably needs ACAPI_Element_Get in the procedure to retrieve the polygon data.
Ralph Wessel BArch
Anonymous
Not applicable
Bingo!

Changing the
GetSelectedElementPolygon
to include the Element_Get worked.
element.header.guid  = (*selNeigs).guid;
	err = ACAPI_Element_Get(&element, 0); //--! Thanks Ralph!------			
	if (memo != NULL)
Thanks Ralph!
Karl Ottenstein
Moderator
Thanks, guys; that did it. I checked the 11 devkit, and the code there was:
			element.header.typeID = typeID;
			element.header.index  = (*selNeigs).index;
			err = ACAPI_Element_Get (&element);
which worked. The 12 kit uses the new GUID method for ACAPI_Element_Get, and no doubt the function call got deleted by mistake during the edit.

I've posted the correction on the Wiki on the 12 DevKit update page:
http://www.archicadwiki.com/Developer/API%20DevKit%2012%20Updates

Cheers,
Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB