Creating a Slab from scratch
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-08-19
06:13 AM
- last edited on
2023-08-07
12:17 PM
by
Doreena Deng
2004-08-19
06:13 AM
Hello!
I am new to this forum, so please forgive me if this topic has been covered before... I am developing a plugin for ArchiCAD, and I am having a problem creating a slab "from scratch" (rather than modify an existing slab element).
I've read the documentation on the ACAPI_Element_Create() routine, API_SlabType, and API_Polygon (several times). And I *believe* I'm creating and filling the element and memo fields correctly...
...but no matter what I do I get a APIERR_BADPOLY error out of the create call.
Is there some sample code that demonstrates *creating* a slab element?
I appreciate any suggestions, references, or samples.
Thanks again.
-larry
p.s. Everything else I've used in the API has worked fine (i.e. creating walls, reading data, manipulating elements, etc. etc.)
p.p.s. I would include my code...but at this point it's a bit of a mess with all of the experiments I've tried to get it to work... 🙂
I am new to this forum, so please forgive me if this topic has been covered before... I am developing a plugin for ArchiCAD, and I am having a problem creating a slab "from scratch" (rather than modify an existing slab element).
I've read the documentation on the ACAPI_Element_Create() routine, API_SlabType, and API_Polygon (several times). And I *believe* I'm creating and filling the element and memo fields correctly...
...but no matter what I do I get a APIERR_BADPOLY error out of the create call.
Is there some sample code that demonstrates *creating* a slab element?
I appreciate any suggestions, references, or samples.
Thanks again.
-larry
p.s. Everything else I've used in the API has worked fine (i.e. creating walls, reading data, manipulating elements, etc. etc.)
p.p.s. I would include my code...but at this point it's a bit of a mess with all of the experiments I've tried to get it to work... 🙂
Labels:
- Labels:
-
Add-On (C++)
3 REPLIES 3

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-08-19 06:29 AM
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?
Hopefully someone else can help ... or you can weed out your code so that you can post it... Ralph and Oleg will be waking up soon.
Karl
AC 28 USA and earlier • macOS Sequoia 15.4, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-08-23 05:38 PM
2004-08-23
05:38 PM
You can also take a look at the code which creates a library part out of the selection while it works. Or any other code which picks up the API_Element and the API_Element_Memo of an existing slab element.
APIERR_BADPOLY is returned usually if you haven't filled thecoords , parcs , and pends fields of API_ElementMemo correctly.
Also, you might take a look at the description of AP_Polygon.
HTH,
Akos
APIERR_BADPOLY is returned usually if you haven't filled the
Also, you might take a look at the description of AP_Polygon.
HTH,
Akos
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-08-24 12:32 AM
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.
You need to do something along the following lines:
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.
Ralph Wessel BArch
Central Innovation
Central Innovation