Pre loader

I wonder how to bind SceneObject.

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

I created an ObjectModel3D object in ViewModel and bound it to View, but the Scale and Position values are not applicable.
What’s wrong with my code?

View:

<UserControl x:Class="Example.TestChart.Views.TestChartView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:local="clr-namespace:Example.TestChart.Views"
         xmlns:locals="clr-namespace:Example.TestChart.ViewModels"
         xmlns:s3D="http://schemas.abtsoftware.co.uk/scichart3D"
         mc:Ignorable="d" 
         xmlns:prism="http://prismlibrary.com/"
         prism:ViewModelLocator.AutoWireViewModel="True"
         xmlns:object="clr-namespace:SciChart.Charting3D.Visuals.Object;assembly=SciChart.Charting3D"
         d:DesignHeight="300"
         d:DesignWidth="300">


<Grid>
    <s3D:SciChart3DSurface x:Name="SciChart"
                   Grid.Column="1"
                   BorderThickness="0"
                   WorldDimensions="1000,500,500"
                   RenderableSeries="{s3D:SeriesBinding RenderableSeriesCollenction}"
                   SceneObjects="{Binding SceneEntity3Ds}"
                   Grid.Row="1"
                   >

        <s3D:SciChart3DSurface.Camera>
            <s3D:Camera3D 
                          Position="30,400,-1250"
                          Target="40,200,500"
                          />
        </s3D:SciChart3DSurface.Camera>

        <s3D:SciChart3DSurface.XAxis>
            <s3D:NumericAxis3D  AxisTitle ="X" 
                        TextFormatting ="n2" 
                        AutoRange = "Never" 
                        VisibleRange ="0,100" 
                        GrowBy =" 10, 10" 
                        FlipCoordinates="True"
                        TickLabelAlignment ="Camera" 
                        />

        </s3D:SciChart3DSurface.XAxis>
        <s3D:SciChart3DSurface.YAxis>
            <s3D:NumericAxis3D  AxisTitle ="Y" 
                        TextFormatting ="n2" 
                        AutoRange = "Never" 
                        VisibleRange ="0,100" 
                        GrowBy =" 10, 10" 
                        TickLabelAlignment ="Camera" />
        </s3D:SciChart3DSurface.YAxis>
        <s3D:SciChart3DSurface.ZAxis>
            <s3D:NumericAxis3D  AxisTitle ="Z" 
                        TextFormatting ="n2" 
                        AutoRange = "Never" 
                        VisibleRange ="0,100"
                        GrowBy ="10,10" 
                        TickLabelAlignment ="Camera" />

        </s3D:SciChart3DSurface.ZAxis>

        <s3D:SciChart3DSurface.ChartModifier>
            <s3D:ModifierGroup3D>
                <s3D:OrbitModifier3D ExecuteOn="MouseLeftButton"/>
                <s3D:MouseWheelZoomModifier3D />
                <s3D:ZoomExtentsModifier3D AnimateDurationMs="500" ResetPosition="-10,400,-850" ResetTarget="0,200,500"/>
            </s3D:ModifierGroup3D>
        </s3D:SciChart3DSurface.ChartModifier>

    </s3D:SciChart3DSurface>
</Grid>

ViewModel:

    namespace Example.TestChart.ViewModels
{
    using SciChart.Charting3D.Visuals.RenderableSeries;
    using System;
    using System.Collections.ObjectModel;
    using System.Windows.Media;
    using Example.BaseClass;
    using SciChart.Charting3D.Visuals.Object;
    using System.Reflection;
    using System.IO;
    using SciChart.Charting3D;


public class TestChartViewModel : ViewModelBase
{
    public TestChartViewModel() 
    {

        RenderableSeriesCollenction = new ObservableCollection<IRenderableSeries3DViewModel>();
        SceneEntity3Ds = new ObservableCollection<ObjectModel3D>();
        addr();
    }

    public void addr()
    {
        string filePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Objects\\Pawn_Low.obj");
        var obj = new ObjectModel3D(new Uri(filePath), Color.FromRgb(Convert.ToByte(255), Convert.ToByte(255), Convert.ToByte(0)))
        {
            Position = new Vector3(0.5f, 1f, 0.8f),
            CoordinateMode = ObjectCoordinateMode.Relative
        };
        obj.Scale = new Vector3(0.2f, 0.2f, 0.2f);
        SceneEntity3Ds.Add(obj);

    }

    private ObservableCollection<IRenderableSeries3DViewModel> _renderableSeriesCollenction;
    public ObservableCollection<IRenderableSeries3DViewModel> RenderableSeriesCollenction
    {
        get { return _renderableSeriesCollenction; }
        set { _renderableSeriesCollenction = value; }
    }

    private ObservableCollection<ObjectModel3D> _sceneEntity3Ds;
    public ObservableCollection<ObjectModel3D> SceneEntity3Ds
    {
        get { return _sceneEntity3Ds; }
        set { _sceneEntity3Ds = value; }
    }

}

}

Version
SciChart3D 6.6.0.26505
Images
  • You must to post comments
0
0

Hi Keunyoung,

Thanks for your inquiry.
We have recently published a hotfix for adding 3D Objects to SciChart3DSurface. E.g. ObjectModelSource.Source and ObjectModelSource.StreamSource properties were fixed.
The changes are available in SciChart v7.0.1.27097 and newer. Here is how to get our Nightly builds:
https://support.scichart.com/index.php?/Knowledgebase/Article/View/17232/37/getting-nightly-builds-with-nuget

We also have a custom example demonstrating how 3D objects can be added in XAML and via StreamSource published in our GitHub repository. Here is a link:
https://github.com/ABTSoftware/SciChart.Wpf.Examples/tree/SciChart_v7_Dev/Sandbox/CustomerExamples/AddObjectsToA3DChart

Please try it out and let us know your feedback.

With best regards,
Lex
SciChart Technical Support Engineer

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies