GraphicBuilder Class

Provides methods for constructing a RenderGraphic from geometric primitives. GraphicBuilder is primarily used for creating Decorations to be displayed inside a Viewport.

The typical process for constructing a RenderGraphic proceeds as follows:

  1. Use RenderContext.createGraphicBuilder to obtain a builder.
  2. Set up the symbology using GraphicBuilder.activateGraphicParams.
  3. Add one or more geometric primitives using methods like GraphicBuilder.addShape and GraphicBuilder.addLineString, possibly setting new symbology in between.
  4. Use GraphicBuilder.finish to produce the finished RenderGraphic.

note Most of the methods which add geometry to the builder take ownership of their inputs rather than cloning them. So, for example, if you pass an array of points to addLineString(), you should not subsequently modify that array.

see Decorator.

see RenderContext.createGraphicBuilder.

see RenderSystem.createGraphicBuilder.

see DecorateContext.

see DynamicsContext.

Methods

Name Description
activateGraphicParams(graphicParams: GraphicParams): void Abstract Sets the current active symbology for this builder.  
addArc(arc: Arc3d, isEllipse: boolean, filled: boolean): void Abstract Appends a 3d open arc or closed ellipse to the builder.  
addArc2d(ellipse: Arc3d, isEllipse: boolean, filled: boolean, zDepth: number): void Abstract Appends a 2d open arc or closed ellipse to the builder.  
addFrustum(frustum: Frustum): void Add Frustum edges.  
addLineString(points: Point3d[]): void Abstract Appends a 3d line string to the builder.  
addLineString2d(points: Point2d[], zDepth: number): void Abstract Appends a 2d line string to the builder.  
addLoop(loop: Loop): void Abstract Append a 3d planar region to the builder.  
addPath(path: Path): void Abstract Append a 3d open path to the builder.  
addPointString(points: Point3d[]): void Abstract Appends a 3d point string to the builder.  
addPointString2d(points: Point2d[], zDepth: number): void Abstract Appends a 2d point string to the builder.  
addPolyface(meshData: Polyface, filled: boolean): void Abstract Append a mesh to the builder.  
addRangeBox(range: Range3d): void Add Range3d edges.  
addShape(points: Point3d[]): void Abstract Appends a closed 3d planar region to the builder.  
addShape2d(points: Point2d[], zDepth: number): void Abstract Appends a closed 2d region to the builder.  
finish(): RenderGraphic Abstract Processes the accumulated symbology and geometry to produce a renderable graphic.  
setBlankingFill(fillColor: ColorDef): void Set the current active symbology for this builder to be a blanking fill before adding a planar region. Beta  
setSymbology(lineColor: ColorDef, fillColor: ColorDef, lineWidth: number, linePixels: LinePixels = LinePixels.Solid): void Sets the current active symbology for this builder.  

Properties

Name Type Description
pickId undefined | string    
placement Accessor Transform The local coordinate system transform applied to this builder's geometry.  
type GraphicType The type of this builder.  
viewport Viewport The viewport in which the resultant RenderGraphic will be drawn.  

Defined in

Last Updated: 13 June, 2024