Virtually draws the shape of an element

    GSErrCode  ACAPI_Element_ShapePrims (
        const API_Elem_Head&      elemHead,
        ShapePrimsProc*          shapePrimsProc



[in] Identifies the element to be processed.
[in] The function to be called to process the element primitives.


Return Values

The function has completed with success.
The passed parameter is nullptr; element
Not the appropriate database was open for the operation. For example you tried to access a 2D element while the 3D window – and also the 3D database – was active.
The element type is invalid,
the element guid is invalid, or
the element type is not supported by the server application
This error code is returned when the element specified by the elemHead.guid parameter is not on the current floor.
Elements that cannot be drawn from primitives were specified in the typeID parameter, for example API_CamSetID in Archicad.

For other common API errors see the API Errors document.

This function can return an error code generated by the user defined function specified by the ShapePrimsProc pointer.



This function draws the element from drawing primitives (see API_PrimElement), using the shapePrimsProc function.

The API_PrimElement (the first parameter of ShapePrimsProc) can also contain a control code; these codes mark the beginning and the end of the drawing of sub-parts. It can also contain information on connected elements (e.g. for walls, you get the indices of windows and doors in that wall).

These drawing procedures can not be nested.

To enable Renovation Overrides or Graphical Overrides see APIAny_EnableRenovationOverrideID and APIAny_EnableVisualOverrideID.



/* The following example shows the usage of ACAPI_Element_ShapePrims */
/* and a sample ShapePrimsProc functions */

static GSErrCode __ACENV_CALL   Own_DrawElementPrim (const API_PrimElement *primElem,
                                                 const void *par1,
                                                 const void *par2,
                                                 const void *par3)
    switch (primElem->header.typeID) {
    case API_PrimPointID:        Own_DrawPrimPoint (&primElem->point); break;
    case API_PrimLineID:         Own_DrawPrimLine (&primElem->line); break;
    case API_PrimArcID:          Own_DrawPrimArc (&primElem->arc); break;
    case API_PrimTextID:         Own_DrawPrimText (&primElem->text,par1); break;
    case API_PrimPLineID:        Own_DrawPrimPLine (&primElem->pline, par1, par2); break;
    case API_PrimTriID:          Own_DrawPrimTri (&primElem->tri); break;
    case API_PrimPolyID:         Own_DrawPrimPoly (&primElem->poly, par1, par2, par3); break;

    case API_PrimCtrl_HatchBorderBegID:   gHatchBrdMode = true;     break;
    case API_PrimCtrl_HatchBorderEndID:   gHatchBrdMode = false;    break;
    case API_PrimCtrl_HatchLinesBegID:    gHatchLinesMode = true;         break;
    case API_PrimCtrl_HatchLinesEndID:    gHatchLinesMode = false;  break;
    default:  break;
}   /* Own_DrawElementPrim */

/* In the main program */
API_Elem_Head header;
for (GS::Array<API_Guid>::ConstIterator it = elemList.Enumerate (); it != nullptr && !lastErr; ++it) {
    BNClear (header);
    header.guid = *it;
    lastErr = ACAPI_Element_ShapePrims (header, Own_DrawElementPrim);



Version: API 1.3 or later
Header: ACAPinc.h


See Also

API_ElemTypeID, API_PrimElement
ShapePrimsProc, ACAPI_LibPart_ShapePrims
ACAPI_LibPart_GetHotspots, APIDb_DrawStoryControlID
Element Manager, API Functions