Click or drag to resize
AB4D logo

WireframeVisual3D Class

WireframeVisual3D shows the 3D model specified in OriginalModel property as wireframe model. In XAML the OriginalModel can be also specified as content of the WireframeVisual3D element.
Inheritance Hierarchy

Namespace: Ab3d.Visuals
Assembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.2.9104.2045
Syntax
C#
[ContentPropertyAttribute("OriginalModel")]
public class WireframeVisual3D : BaseVisual3D

The WireframeVisual3D type exposes the following members.

Constructors
 NameDescription
Public methodWireframeVisual3D Constructor
Public methodWireframeVisual3D(String) Constructor
Top
Properties
 NameDescription
Public propertyAutoUpdate Gets or sets a Boolean that specifies if the wireframe geometry is automatically regenerated on each change of OriginalModel or other WireframeVisual3D property (for example LineColor). Default value is true.
Public propertyContent Gets the wireframe model created from OriginalModel. It is not allowed to set this property.
Public propertyIsEmissiveSolidModelColor Gets or sets Boolean that specifies if EmissiveMaterial is used to show SolidModelColor. When true the whole model with the specifed color without any shading. When false the standard shader color is used. Default value is true.
Protected propertyisInsideDXEngine isInsideDXEngine is set to true when this WireframeVisual3D is rendered by DXEngine.
Public propertyLineColor Gets or sets the color of the line. When UseModelColor is set to true the line color is get from model's material (when this is not possible than LineColor is used).
Public propertyLineThickness Gets or sets the thickness of the line in screen coordinates.
Public propertyOriginalModel Gets or sets a Model3D that is used to create wireframe model from. Note that changes to the OriginalModel does not automatically recreate the wireframe model.
Public propertyRemoveDuplicateLines Gets or sets a boolean that specifies if duplicate lines are removed when wireframe model is created. This creates simpler wireframe geometry but can take some time to execute when the wireframe model is created. Default value is true.
Public propertyShowPolygonLines Gets or sets Boolean that specifies if WireframeVisual3D should show polygon lines that are defined with using PolygonIndicesProperty DependencyProperty on MeshGeometry3D objects. See remarks in PolygonIndicesProperty for more info. Default value is false.
Public propertySolidModelColor Gets or sets a Color that represents the color that is used to show solid color when SingleColorSolidModel or WireframeWithSingleColorSolidModel is used for WireframeType.
Public propertyUseModelColor Gets or sets a Boolean that specified if line color is get from the color of model's material (in case of SolidColor DiffuseMaterial) or the specified LineColor is always used.
Public propertyWireframeType Gets or sets how wireframe and solid model will be shown with WireframeVisual3D.
Top
Methods
 NameDescription
Protected methodCreateModel Creates this Model3D
(Overrides BaseVisual3DCreateModel)
Protected methodOnContentChanged OnContentChanged
Protected methodStatic memberOnLineColorPropertyChanged OnLineColorPropertyChanged
Protected methodStatic memberOnOriginalModelPropertyChanged OnOriginalModelPropertyChanged
Protected methodStatic memberOnSolidModelColorPropertyChanged OnSolidModelColorPropertyChanged
Protected methodOnVisualParentChanged OnVisualParentChanged
(Overrides BaseVisual3DOnVisualParentChanged(DependencyObject))
Protected methodStatic memberOnWireframeVisualPropertyChanged OnWireframeVisualPropertyChanged
Public methodRecreateWireframeModel RecreateWireframeModel creates the wireframe model again.
Protected methodStatic memberValidateLineThicknessPropertyValue Returns true if line thickness is valid double and bigger or equal to 0
Top
Events
 NameDescription
Public eventContentChanged Notify that the Content was changed
Top
Fields
 NameDescription
Public fieldStatic memberIsEmissiveSolidModelColorProperty SelectedModelProperty
Public fieldStatic memberLineColorProperty LineColorProperty
Public fieldStatic memberLineThicknessProperty LineThicknessProperty
Public fieldStatic memberOriginalModelProperty OriginalModelProperty
Public fieldStatic memberShowPolygonLinesProperty ShowPolygonLinesProperty
Public fieldStatic memberSolidModelColorProperty LineColorProperty
Public fieldStatic memberUseModelColorProperty UseModelColorProperty
Public fieldStatic memberWireframeTypeProperty WireframeTypeProperty
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

WireframeVisual3D shows the 3D model specified in OriginalModel property as wireframe model. In XAML the OriginalModel can be also specified as content of the WireframeVisual3D element.

The Model3D specified as OriginalModel can be shown in many different ways (as wirframe only, as various combinations of wireframe and solid model or as solid model). The type of shown object is set by the WireframeType property - the possible values are defined in the WireframeVisual3DWireframeTypes enum.

Performance considerations:
Regenerating wireframe geometry can take long time and therefore it is important to do this as few times as possible.

WireframeVisual3D is subscribed to any changed done in the Model3D set to the OriginalModel property. When AutoUpdate is true (by default) any changes to the OriginalModel will regenerate the whole wireframe geometry. If you are changing a lot of data on the Model3D (for example changing individual Positions on MeshGeometry3D) then each individual change will regenerate the whole wireframe geometry.

Also if you change multiple properties on WireframeVisual3D (for example LineColor and LineThickness), each change will regenerate the whole wirframe geometry.

To prevent that it is possible to set the AutoUpdate to false and after the changes have been made manually call the RecreateWireframeModel method.

Another option is to call BeginInit() method on WireframeVisual3D, do all the changes and then call EndInit() method. For example:

Example
wireframeVisual3D.BeginInit(); wireframeVisual3D.OriginalModel = model3D; wireframeVisual3D.LineColor = Colors.White; wireframeVisual3D.LineThickness = 3; meshGeometry3D.Positions[0] += new Vector3D(0, 10, 0); meshGeometry3D.Positions[1] += new Vector3D(0, 10, 0); // wireframe will be updated only once after the following EndInit call (instead of 5 times) wireframeVisual3D.EndInit();
See Also