Virtually draws the shape of an element
GSErrCode ACAPI_Element_ShapePrims ( const API_Elem_Head& elemHead, ShapePrimsProc* shapePrimsProc );
Parameters
- elemHead
- [in] Identifies the element to be processed.
- shapePrimsProc
- [in] The function to be called to process the element primitives.
Return Values
NoError
- The function has completed with success.
APIERR_BADPARS
- The passed parameter is
nullptr; element
APIERR_BADDATABASE
- 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.
APIERR_BADID
- The element type is invalid,
the element guid is invalid, or
the element type is not supported by the server application APIERR_REFUSEDCMD
- This error code is returned when the element specified by the
elemHead.guid
parameter is not on the current floor. APIERR_REFUSEDPAR
- Elements that cannot be drawn from primitives were specified in the
type
parameter, for exampleAPI_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.
Remarks
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.
Example
/* 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.type.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); }
Requirements
- 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