Click or drag to resize
AB4D logo

ObjModelVisual3DSizeX Property

Gets or sets the size in of the 3D model in X dimension.

Namespace: Ab3d.Visuals
Assembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.1.8864.1045
Syntax
C#
public double SizeX { get; set; }

Property Value

Double
Remarks

The default value of SizeX is -1. This means that the original X Size of the object is preserved.

How the SizeX is applied to the shown model depends on the PreserveScaleAspectRatio property.

If it is false, than the x size of the shown object will be the same as the specified SizeX (if -1 than the original object x size is used).

If PreserveScaleAspectRatio is true (by default), than the aspect ratio of the 3D model is preserved. This means that the model is stretched to one side mode than to the other - the scale is evenly set to all the axis. This also means that if all SizeX, SizeY and SizeZ are defined, the object will be scaled so it will not exceed and of the specified sizes.

Example

The following example shown a 3D model from ab3d.obj file. The model's center is positioned at (-250, 0, 0) and its size is set so its SizeX is 80. Note that by default the PreserveScaleAspectRatio is set to true.

XAML
<ObjModelVisual3D:ObjModelVisual3D Source="/Resources/ab3d.obj" 
                   SizeX="80"
                   Position="0 40 0" PositionType="Center"/>

The following code shows the same mode, but this time it is custom sized:

XAML
<ObjModelVisual3D:ObjModelVisual3D Source="/Resources/ab3d.obj" 
                   SizeX="50" SizeY="30" SizeZ="40"
                   PreserveScaleAspectRatio="False"
                   Position="0 40 0" PositionType="Center"/>
See Also