Capsule

References
public sealed class Capsule
Represents the basic Grasshopper UI capsule object. A capsule is a slab with optional plugs and messaging bar.

Constructors

Capsule

#
public Capsule(SlabF slab, float barHeight = 0)
Create a capsule.
slab (SlabF)Capsule shape.
barHeight (float = 0)Messaging bar height.

Properties

BarHeight

#
public float BarHeight { get; }
Gets the height of the messaging bar.

Bounds

#
public RectangleF Bounds { get; }
Get the outer bounds of the entire capsule.

HasAnyMessage

#
public bool HasAnyMessage { get; }
Gets whether any message indicator has been set.

HasErrorMessage

#
public bool HasErrorMessage { get; set; }
Gets or sets whether the error message indicator ought to be drawn.

HasInfoMessage

#
public bool HasInfoMessage { get; set; }
Gets or sets whether the info message indicator ought to be drawn.

HasInputPlugs

#
public bool HasInputPlugs { get; }
Gets whether any input plugs have been set.

HasOutputPlugs

#
public bool HasOutputPlugs { get; }
Gets whether any output plugs have been set.

HasWarningMessage

#
public bool HasWarningMessage { get; set; }
Gets or sets whether the warning message indicator ought to be drawn.

InputPlugCount

#
public int InputPlugCount { get; }
Gets the number of input plugs on this capsule.

OutputPlugCount

#
public int OutputPlugCount { get; }
Gets the number of output plugs on this capsule.

Slab

#
public SlabF Slab { get; }
Get the geometry of the capsule shape.

Methods

AddCustomPlug

#
public void AddCustomPlug(Plug plug)
Add a custom plug.
plug (Plug)Plugs to add.

AddInputPlug

#
public void AddInputPlug(float yPosition, GripKind kind)
Add an input plug at a given y-coordinate.
yPosition (float)Elevation of plug.
kind (GripKind)Plugs kind.

AddOutputPlug

#
public void AddOutputPlug(float yPosition, GripKind kind)
Add an output plug at a given y-coordinate.
yPosition (float)Elevation of plug.
kind (GripKind)Plugs kind.

CreateFromInner

#
public static Capsule CreateFromInner(Shape shape, RectangleF innerBounds)
Create a capsule from the inner (apex) bounds.
shape (Shape)Capsule shape.
innerBounds (RectangleF)Bounds of the apex face.

CreateFromOuter

#
public static Capsule CreateFromOuter(Shape shape, RectangleF outerBounds)
Create a capsule from the outer bounds.
shape (Shape)Capsule shape.
outerBounds (RectangleF)Outer bounds.

Draw

#
public void Draw(Graphics graphics, Parts elements, Shade shade, Skin skin)
Draw this capsule into a graphics context.
graphics (Graphics)Graphics to draw with.
elements (Parts)Capsule elements to draw.
shade (Shade)Capsule shading.
skin (Skin)Optional grip skins.

Draw

#
public void Draw(Graphics graphics, Shade shade, Skin skin)
Draw this capsule into a graphics context.
graphics (Graphics)Graphics to draw with.
shade (Shade)Capsule shading.
skin (Skin)Optional grip skins.

DrawEdges

#
public void DrawEdges(Graphics graphics, Skin skin, Shade shade)
Draw the silhouette edges. This is typically the fifth and last part of the capsule drawing process, after DrawOverlay(Graphics, Skin, Shade).
graphics (Graphics)
skin (Skin)
shade (Shade)

DrawFaces

#
public void DrawFaces(Graphics graphics, Skin skin, Shade shade)
Draw the apex and side faces. This is typically the second part of the capsule drawing process, after DrawGrips(Graphics, Skin).
graphics (Graphics)
skin (Skin)
shade (Shade)

DrawGrips

#
public void DrawGrips(Graphics graphics, Skin skin)
Draw all grips. This is typically the first part of the capsule drawing process.
graphics (Graphics)
skin (Skin)

DrawMessaging

#
public void DrawMessaging(Graphics graphics, Skin skin)
Draw the messaging hints, if any. This is typically the third part of the capsule drawing process, after DrawFaces(Graphics, Skin, Shade).
graphics (Graphics)
skin (Skin)

DrawOverlay

#
public void DrawOverlay(Graphics graphics, Skin skin, Shade shade)
Draw the overlay. This is typically the fourth part of the capsule drawing process, after DrawMessaging(Graphics, Skin).
graphics (Graphics)
skin (Skin)
shade (Shade)

InputPlug

#
public Plug InputPlug(int index)
Gets the input plug at the given index.
index (int)Index of plug to retrieve.
Plugs at given index.

OutputPlug

#
public Plug OutputPlug(int index)
Gets the output plug at the given index.
index (int)Index of plug to retrieve.
Plugs at given index.