We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2004-08-19 06:13 AM - last edited on 2023-08-07 12:17 PM by Doreena Deng
2004-08-19 06:29 AM
lciscon wrote:I haven't done it, so don't have any code to share ... The Element Manager example project's Element_Basics.cpp file has a lot of sample calls to ACAPI_Element_Create (but no slab). The only reference to API_SlabType in the example source files is in this same example's Element_Modify.cpp file.
Is there some sample code that demonstrates *creating* a slab element?
2004-08-23 05:38 PM
2004-08-24 12:32 AM
lciscon wrote:It's difficult to say at what point your code is failing without more information. Perhaps you could describe your slab creation in pseudo-code?
...I am having a problem creating a slab "from scratch" (rather than modify an existing slab element).
...but no matter what I do I get a APIERR_BADPOLY error out of the create call.
Initialise an API_Polygon structure (nSubPolys, nCoords, nArcs) Allocate handles for the relevant fields of an API_ElementMemo structure (vertexIDs, coords, parcs, pends) For each polygon (perimeter, then holes) { For each vertex in the current polygon { Fill in the vertex coordinate (coords) Fill in the vertex ID (vertexIDs - optional) If the vertex is the end of an arc Fill in the arc end details (parcs) } Fill in the polygon end details (pends) }Make sure you allocate handles for the memo structures, not pointers. Contact me privately if you're still getting bogged down and I'll take a quick look at your source.