API Reference > imodeljs-frontend > Rendering > GraphicPrimitive GraphicPrimitive Type alias Union type representing a graphic primitive that can be supplied to GraphicBuilder.addPrimitive. Each primitive type corresponds to one of GraphicBuilder's addXXX methods. This is useful when the precise type of geometry is not known at the point at which it is added to the builder. As a simple example: function getPrimitives(): GraphicPrimitive[] { const primitives: GraphicPrimitive[] = [{ type: "polyface", polyface: getPolyface(), filled: true }]; if (someCondition()) primitives.push({ type: "linestring", points: getPoints() }); else primitives.push({ type: "arc", arc: getArc(), isEllipse: true }); return primitives; } function addGraphics(builder: GraphicBuilder) { for (const primitive of getPrimitives()) builder.addPrimitive(primitive); } GraphicPrimitive = GraphicLineString | GraphicLineString2d | GraphicPointString | GraphicPointString2d | GraphicShape | GraphicShape2d | GraphicArc | GraphicArc2d | GraphicPath | GraphicLoop | GraphicPolyface | GraphicSolidPrimitive Defined in core/frontend/src/render/GraphicPrimitive.ts Line 154 Last Updated: 12 June, 2024