Click or drag to resize
AB4D logo

TextVisual3D Class

TextVisual3D class is used to create Visual3D that represents a 3D texts created by a series of 3D lines.
Inheritance Hierarchy

Namespace: Ab3d.Visuals
Assembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.1.8864.1045
Syntax
C#
public class TextVisual3D : BaseTextVisual3D

The TextVisual3D type exposes the following members.

Constructors
 NameDescription
Public methodTextVisual3D Constructor
Public methodTextVisual3D(String) Constructor
Top
Properties
 NameDescription
Public propertyPosition Gets or sets the top left 3D position of the first character.
Top
Methods
 NameDescription
Protected methodCreateModel Creates this Model3D
(Overrides BaseVisual3DCreateModel)
Top
Fields
 NameDescription
Public fieldStatic memberPositionProperty PositionProperty
Top
Extension Methods
 NameDescription
Public Extension MethodDumpHierarchy Display details about the hierarchy of Visual3D children to Debug console (for example to Visual Studio's Immediate window).
(Defined by Extensions)
Public Extension MethodForEachGeometryModel3D Performs the specified action on each GeometryModel3D inside the rootModelVisual3D.
(Defined by Extensions)
Public Extension MethodForEachVisual3D Performs the specified action on each ModelVisual3D inside the rootModelVisual3D.
(Defined by Extensions)
Public Extension MethodGetName Gets name of the Visual3D that was previously set by SetName extension method.
(Defined by Extensions)
Public Extension MethodSetName Sets Name property to Visual3D. Note that if name is not correct for WPF, it can be corrected (name must start with a letter or the underscore character (_), and must contain only letters, digits, or underscores). In this case the SetName method will set the corrected name to the object and return false (in this case you can call GetName to get the corrected name). True is returned when the original name is set to the object.
(Defined by Extensions)
Top
Remarks

TextVisual3D class is used to create Visual3D that represents a 3D texts created by a series of 3D lines.

The 3D text is positioned by its Position property. It specifies the top left position of the first character.

The direction of the text is defined by TextDirection and UpDirection properties. TextDirection is a Vector3D that defines the direction in which the text is drawn (default value is (1,0,0) - a vector that is pointing in the x axis direction). The UpDirection defines the text's up direction (default value is (0,1,0) - a vector that is pointing up).

The displayed text is defined by the Text property. It is possible to display also special characters - most of the characters from ASCII 32 (space) to ASCII 254 can be displayed. The new line '\n' and tab '\t' characters are also supported. Tab is displayed as 4 spaces.

Text appearance is controlled by FontSize, TextColor and LineThickness properties. FontSize defines the height of the characters (in the UpDirection). TextColor is used to define the color of the text. LineThickness specifies the thickness of the used 3D lines. The default value is 1.

Example

The following code shows how to display the 3D text.

The following namespace declaration needs to be added to the root element: xmlns:visuals="clr-namespace:Ab3d.Visuals;assembly=Ab3d.PowerToys"

XAML
<Viewport3D Name="MainViewport">
    <visuals:TextVisual3D x:Name="TextVisual1" Position="-150 30 0" 
                          LineThickness="2" FontSize="30" TextColor="Yellow"
                          Text="This is a sample 3D text"/>
</Viewport3D>
See Also