VB.net simple program

Anonymous 9 years ago 0
This discussion was imported from CodePlex

rinaldin wrote at 2013-09-25 17:09:

Hi all,
I'm new to the Helix 3D Toolkit, and I just want to use it in VB.net programs. I started a new WPF project, referenced the libraries needed, and added the following code:
Imports System
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Media
Imports System.Windows.Media.Media3D
Imports HelixToolkit.Wpf

Class MainWindow
    Dim visualChild As New ModelVisual3D
    Dim plotmodel As New Model3DGroup

    Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded

        Dim label1 As GeometryModel3D = TextCreator.CreateTextLabelModel3D("test", Brushes.White, True, 32,
                                                           New Point3D(0, 0, 0),
                                                           New Vector3D(1, 0, 0), New Vector3D(0, 1, 0))
        visualChild.Content = plotmodel

    End Sub

End Class
The XAML code is:
<Window x:Class="MainWindow"
    Title="Prova" Height="378" Width="605" xmlns:h="http://helixtoolkit.codeplex.com" WindowStartupLocation="CenterScreen">
        <h:HelixViewport3D HorizontalAlignment="Stretch" Name="HelixViewport3D1" VerticalAlignment="Stretch" Background="Black" Margin="0" TextBrush="White" CoordinateSystemLabelForeground="White" InfoForeground="White" />
I get no error messages, but I expect to see in the viewport the string "text", but nothing happens! Can you help me please? I think this thread would be very important for who wants to start developing with Helix in VB.net.

Thank you,

rinaldin wrote at 2013-09-25 21:30:


I think there's a bug in the Helix code, because the code I posted worked fine, exept for the TextColor property in the line:
Dim label1 As GeometryModel3D = TextCreator.CreateTextLabelModel3D("test", Brushes.White, True, 32,
The value Brushes.White has no effect!!! The text is still rendered in black. I try to modify also the HelixViewport3D1.TextBrush property, but still no changes!

I'm opening a new issue on this site.


objo wrote at 2013-09-25 23:16:

Did you remember to add light(s) to your scene?

rinaldin wrote at 2013-09-26 10:46:

Thank you, solved. I added the line:
plotmodel.Children.Add(New AmbientLight(Colors.White))
and all text has the proper color.