Model |
public class ModelDecoratorVisual3D : BaseVisual3D
The ModelDecoratorVisual3D type exposes the following members.
Name | Description | |
---|---|---|
ModelDecoratorVisual3D | Constructor | |
ModelDecoratorVisual3D(String) | Constructor |
Name | Description | |
---|---|---|
BoundingBoxLineColor | Gets or sets the color of the lines that show the bounding box. Default values is Red. | |
BoundingBoxLineThickness | Gets or sets the thickness of the lines that show the bounding box. Default values is 2. | |
CalculateBoundingBoxFromPositions | Gets or sets a boolean that specifies if bounding box is calculated from transforming all the positions in the TargetModel3D so that the bounding box will exactly fit the model even when it is rotated (when value is true). When CalculateBoundingBoxFromPositions is false, then bounding box is calculated by transforming the Model3D bounding box. This is much faster, but not as accurate (bounding box can be bigger than the actually transformed model). Default value is false. | |
NormalsLineColor | Gets or sets the color of the lines that show the normals. Default values is Green. | |
NormalsLineLength | Gets or sets the length of the normal lines. When set to NaN (by default) the normals length is calculated from the size of the TargetModel3D. | |
NormalsLineThickness | Gets or sets the thickness of the lines that show the model normals. Default values is 1. | |
RootModelVisual3D | Gets or sets a ModelVisual3D that is a parent ModelVisual3D for TargetModel3D. | |
ShowBoundingBox | Gets or sets a boolean that specifies if a wire box that encloses the TargetModel3D is shown. | |
ShowNormalLineArrow | Gets or sets a nullable Boolean that specifies if normal lines are shown with arrows. If this property is set to null (by default), then arrows are shown when mesh has less then 1000 positions. When using Ab3d.DXEngine and this class is used on a model with a lot of triangles then showing arrows may be very slow (lines with arrows are not hardware accelerated). | |
ShowNormals | Gets or sets a boolean that specifies if normals of the TargetModel3D are shown. The TargetModel3D must be GeometryModel3D and not Model3DGroup. | |
ShowTriangles | Gets or sets a boolean that specifies if triangles of the TargetModel3D are shown. The TargetModel3D must be GeometryModel3D and not Model3DGroup. | |
TargetModel3D | Gets or sets Model3D for witch bounding box, normals or triangles will be shown with this ModelDecoratorVisual3D. | |
TrianglesLineColor | Gets or sets the color of the lines that show the triangles. Default values is Blue. | |
TrianglesLineThickness | Gets or sets the thickness of the lines that show the triangles. Default values is 1. |
Name | Description | |
---|---|---|
CreateModel |
CreateModel creates the Model3D objects and sets them to Content property.
(Overrides BaseVisual3DCreateModel) | |
OnBoundingBoxPropertyChanged | OnBoundingBoxPropertyChanged | |
OnCalculateBoundingBoxFromPositionsPropertyChanged | OnCalculateBoundingBoxFromPositionsPropertyChanged | |
OnNormalsPropertyChanged | OnNormalsPropertyChanged | |
OnTargetModel3DPropertyChanged | OnTargetModel3DPropertyChanged | |
OnTrianglesPropertyChanged | OnTrianglesPropertyChanged | |
Refresh | Recreates the shown lines. Can be called when the TargetModel3D has been moved. |
Name | Description | |
---|---|---|
BoundingBoxLineColorsProperty | BoundingBoxLineColorsProperty | |
BoundingBoxLineThicknessProperty | BoundingBoxLineThicknessProperty | |
CalculateBoundingBoxFromPositionsProperty | CalculateBoundingBoxFromPositionsProperty | |
NormalsLineColorProperty | NormalsLineColorProperty | |
NormalsLineLengthProperty | NormalsLineLengthProperty | |
NormalsLineThicknessProperty | NormalsLineThicknessProperty | |
RootModelVisual3DProperty | RootModelVisual3DProperty | |
ShowBoundingBoxProperty | ShowBoundingBoxProperty | |
ShowNormalLineArrowProperty | ShowNormalsLineArrowProperty | |
ShowNormalsProperty | ShowNormalsProperty | |
ShowTrianglesProperty | ShowTrianglesProperty | |
TargetModel3DProperty | TargetModel3DProperty | |
TrianglesLineColorProperty | TrianglesLineColorProperty | |
TrianglesLineThicknessProperty | TrianglesLineThicknessProperty |
Name | Description | |
---|---|---|
DumpHierarchy |
Display details about the hierarchy of Visual3D children to Debug console (for example to Visual Studio's Immediate window).
(Defined by Extensions) | |
ForEachGeometryModel3D |
Performs the specified action on each GeometryModel3D inside the rootModelVisual3D.
(Defined by Extensions) | |
ForEachVisual3D |
Performs the specified action on each ModelVisual3D inside the rootModelVisual3D.
(Defined by Extensions) | |
GetName |
Gets name of the Visual3D that was previously set by SetName extension method.
(Defined by Extensions) | |
SetName |
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) |
ModelDecoratorVisual3D is a Visual3D that can be used to show bounding box, normals and triangles for the specified TargetModel3D.
The TargetModel3D property should be set to the Model3D that will be "decorated" with bounding box, triangles or normals. It is also recommended to set the RootModelVisual3D that specifies a parent ModelVisual3D for TargetModel3D. This way ModelDecoratorVisual3D can take into account any transformations that are used on parent Visual3D objects.
When showing bounding box, you can set the CalculateBoundingBoxFromPositions to calculate the bounding box from all positions. This will produce a bounding box that will exactly fit the model even when it is rotated. But when the model is complex, it can take a few moments to calculate the exact bounding box. When the CalculateBoundingBoxFromPositions is set to false (by default), the shown bounding box will be calculated by transforming the model's bounds. This is much faster but can show a bounding box that is bigger then the rotated model.
By default it calculates the shown bounding box with transforming the
The following XAML shows how a ModelDecoratorVisual3D can be used (it should be defined inside Viewport3D):
<visuals1:ModelDecoratorVisual3D x:Name="SelectedModelDecorator" ShowBoundingBox="False" BoundingBoxLineColor="Red" BoundingBoxLineThickness="2" ShowNormals="True" NormalsLineColor="Blue" NormalsLineThickness="1" ShowTriangles="True" TrianglesLineColor="Green" TrianglesLineThickness="1" TargetModel3D="{Binding ElementName=MyModel3D}" />