This is the discussion forum for Helix Toolkit.
For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!
0

ModelViewer Example

Anonymous 10 years ago updated by anonymous 6 years ago 1
This discussion was imported from CodePlex

xion wrote at 2012-04-04 00:26:

Hi Objo,

fine work all the Helix stuff! Keep it up, please!

I've noticed differences in displaying .obj files, exported from 3dsmax, between the downloadable compiled example of ModelViewer(Nov2011) and the example in the current source dowload package.

The already compiled version displays the .obj file pretty well, including transparency.
The non-compiled recommended source version fails to display some objects correctly.

There's a bunch of code commented out. When I remove the comments some of the code is buggy (list1, fileModelVisual3D.Children)

Could you please give a feedback on it?

Thanks and regards, xion.


objo wrote at 2012-04-05 01:32:

hi xion, can you provide some simple .obj test files that renders incorrectly? We have tried to solve some texture/transparency bugs since the november version, but there is probably some work left... Also, some features of the .obj format (smoothing groups?) are not yet supported.


xion wrote at 2012-04-06 17:29:

Yes I can provide the .obj file. Send you a p.m. with a downloadlink.


objo wrote at 2012-04-07 23:13:

Thanks, I think I found the bug - the "Tr" setting in the material file should set the material opacity to 1-Tr.


xion wrote at 2012-04-08 00:35:

Thats interesting! Is it a buggy .mtl file? I used the latest 3dsmax design to export the file.

Expression Blend (MS) has the same problems on import these obj/mtl files.


objo wrote at 2012-04-08 00:39:

sorry, I thought the error was in the helix interpreter, but then I checked the spec:

d alphadefines the transparency of the material to be alpha. The default is 1.0 (not transparent at all) Some formats use Tr instead of d;Tr alphadefines the transparency of the material to be alpha. The default is 1.0 (not transparent at all). Some formats use d instead of Tr;
Your file has d=1 and Tr=0 for the same material - which should be an error.
I can add a "SkipTransparencyValues" property on the importer if this is a common error for files exported from 3dsmax.

objo wrote at 2012-04-08 01:08:

I have added a "SkipTransparencyValues" property to the "ObjReader". I also added support for smoothing groups.


xion wrote at 2012-04-08 11:44:

Thank you! 2012.2.2.1.46 shows all materials correctly. Thats great!

In 3dsmax the transparency value is called Opacity, which is set to 100% if the material is non-transparent. Maybe here's the clue.


objo wrote at 2012-04-08 13:05:

Good! 

Opacity 100% should be exported as d = 1.0 or Tr = 1.0 if the wikipedia spec is correct. I think the exporter you are using will export d=1.0 and Tr=0.0.

See http://en.wikipedia.org/wiki/Material_Template_Library

0

TubeVisual3D and Material

Anonymous 10 years ago 0
This discussion was imported from CodePlex

jacobya wrote at 2012-01-12 23:19:

Hi,

Let me first start off by saying thank you very much for your efforts and for sharing this code, it is a tremendous piece of software and exceptionally well written.  I'm wondering if you can give me your advice on how to accomplish the following: 

I'm using the TubeVisual3D class to represent a pipe and what I'd like to do is draw a colored circle at a specific location on the surface of the pipe.  Any suggestions on how this could be done, is there something in the existing library that would allow me to do this?  I'm currently looking at using the Material attribute of the TubeVisual3D to accomplish this, but I'm not sure if this is the best approach.

Again, thanks very much, great work.

Jason


objo wrote at 2012-01-13 19:47:

You could do this by a rendering the circle to a bitmap and use that as a texture. But the edge of the circle will not look very sharp when zooming close, and it could be challenging to calculate the right texture coordinates.

I think it would be better to render the circle(s) as a separate mesh slightly outside the tube, but then the challenge is to calculate the 3D coordinates... Look at how the tangents and normals are calculated in the tube implementation, I hope this can help!


jacobya wrote at 2012-01-13 20:56:

Hi objo,

Thanks for the advice, I will look at rendering the circle as a separate mesh slightly outside the tube.  I seem to be having difficulty applying a Material to the TubeVisual3D class.  Am I doing something wrong here?  In this case the tube shows up completely green:

<Window x:Class="PipeDemo.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ht="clr-namespace:HelixToolkit.Wpf;assembly=HelixToolkit.Wpf"
     Title="Pipe Demo" Height="480" Width="640">
	<Window.Resources>
		<MaterialGroup x:Key="dm1">
			<DiffuseMaterial>
				<DiffuseMaterial.Brush>
					<LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5">
						<LinearGradientBrush.GradientStops>
							<GradientStop Color="Yellow" Offset="0" />
							<GradientStop Color="Red" Offset=".25" />
							<GradientStop Color="Blue" Offset=".50" />
							<GradientStop Color="LimeGreen" Offset=".75" />

						</LinearGradientBrush.GradientStops>
					</LinearGradientBrush>
				</DiffuseMaterial.Brush>
			</DiffuseMaterial>
		</MaterialGroup>
	</Window.Resources>
	<Grid>
		<ht:HelixViewport3D ZoomExtentsWhenLoaded="True" PanGesture="LeftClick"  >
			<ht:SunLight  />
			<ht:GridLinesVisual3D/>
			<ht:TubeVisual3D Path="{Binding Pipe}" Diameter="5" IsPathClosed="False" Material="{StaticResource dm1}" BackMaterial="{StaticResource dm1}" />
		</ht:HelixViewport3D>
	</Grid>
</Window>

 and my code:

public IList<Point3D> Pipe { get; set; }
		
public Window1()
{
	InitializeComponent();
	Pipe = this.CreatePath();
	DataContext = this;
}



private IList<Point3D> CreatePath()
{
	List<Point3D> list = new List<Point3D>();
	for (int i = -5; i < 5; i++)
	{
		list.Add(new Point3D(i * 10, 0, 5));
	}
	return list;
}

 



objo wrote at 2012-01-13 21:10:

I see the TubeVisual3D is not currently supporting texture coordinates. 

I will add a Values property where you can set the texture X (u) coordinates. The Y value (around the tube) is difficult to define and will simply be linear from 0 to 1.

You can also create the tube geometry by MeshBuilder.AddTube (where you also can specify the diameters along the tube).


jacobya wrote at 2012-01-19 03:53:

Hi objo,

Thanks for adding the TextureCoordinates property to the TubeVisual3D class, I also see that you added a Diameters property as well.  I'm still not sure how to apply a texture to a TubeVisual3D though, would it be possible for you to give me a very simple example?  I basically want to apply a RadialGradientBrush to a TubeVisual3D, any advice you can provide is greatly appreciated.

Thanks


objo wrote at 2012-01-19 10:53:

see the "StreamLinesDemo" example. It is currently using MeshBuilder.AddTube, but could now be rewritten to use the TubeVisual3D. The example uses a linear gradient brush (hue colours) in the material, and uses the streamline velocities (scaled to [0,1]) as "values" (first texture coordinate). It is difficult to control the position of the texture around the tube (second texture coordinate) (unless we specify a normal direction for each point of the path), so I am currently only using "1-dimensional" textures.

0

Using MeshBuilder for bounding box in MVVM

Anonymous 10 years ago 0
This discussion was imported from CodePlex

ahmad_luqman wrote at 2013-04-02 15:06:

I want to create a bounding box in helix view port in MVVM.

My ViewModel has this:
var size = 6000;
var axesMeshBuilder = new HelixToolkit.Wpf.MeshBuilder();
var bb = new Rect3D(-1 * size / 2, -1 * size / 2, -1*size, size, size, size);
axesMeshBuilder.AddBoundingBox(bb, 10);
Box = axesMeshBuilder.ToMesh();
Which sets the Geometry3d type Box property in ViewModel:
public Geometry3D Box { get; set; }
And the Xaml View has:
         <h:HelixViewport3D>
            <h:SunLight />
            <ModelVisual3D>
                <ModelVisual3D.Content>
                    <GeometryModel3D Geometry="{Binding Box}" Material="{h:Material Black}"/>
                </ModelVisual3D.Content>
            </ModelVisual3D>
        </h:HelixViewport3D>
This works but unit tests on ViewModel fails with exception:
System.ServiceModel.CommunicationObjectAbortedException: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it has been Aborted.
This is because I am setting the MeshBuilder in View Model. Ideally this logic should be in Xaml View. Can you suggest how can I move the MeshBuilder logic to XAML and bind to Rect3d?

Something like this:
         <h:HelixViewport3D>
            <h:SunLight />
            <ModelVisual3D>
                <ModelVisual3D.Content>
                    <GeometryModel3D Material="{h:Material Black}">
                        <!--Mesh Builder logic here -->
                    <GeometryModel3D />
                </ModelVisual3D.Content>
            </ModelVisual3D>
        </h:HelixViewport3D>
In case if the above answer is no we can't do that, alternatively how can we draw similar bounding box following MVVM?

ahmad_luqman wrote at 2013-04-02 15:40:

I think I got it.
This works:
<h:BoundingBoxVisual3D Diameter="10" BoundingBox="{Binding Box}" Fill="White"/>
Thanks for the cool library.
0

importing Geometry3D

Anonymous 10 years ago updated by anonymous 6 years ago 1
This discussion was imported from CodePlex

medecai wrote at 2012-04-23 17:56:

 

Hey there,

first of all, i want to thank you for providing such an awesome Toolkit!

Second I have a question concerning the ModelImporter. I was using the beta (helixToolkit-release) for some time now and it was possible to import Geometry3D data by:

  private Geometry3D LoadGeoFromFile(string objPath)
        {
            Model3DGroup group = ModelImporter.Load(objPath);
            GeometryModel3D model = group.Children[0] as GeometryModel3D;
           
            return model.Geometry;

        }

I could afterwards bind the Geometry in Wpf like

 <helix:HelixViewport3D>
                <ModelVisual3D>
                    <helix:DefaultLights/>
                    <ModelVisual3D.Content>
                        <GeometryModel3D Geometry="{Binding TestFile}" Changed="GeometryModel3D_Changed">
                            <GeometryModel3D.Material>
                                <DiffuseMaterial>
                                    <DiffuseMaterial.Brush>
                                        <SolidColorBrush Color="Gray"/>
                                    </DiffuseMaterial.Brush>
                                </DiffuseMaterial>
                            </GeometryModel3D.Material>
                        </GeometryModel3D>
                        
                    </ModelVisual3D.Content>
                </ModelVisual3D>
            </helix:HelixViewport3D> 

and was therefore able to display the geometry just with a plain brush (to improve performance). Right now I tried
the newest source code (to check if loading times etc. improved) but the described procedure isn't working anymore.
The ViewPort only shows parts of the whole model at best.
Did something substantial change which could forbid this way of doing it or is it just a minor thing which I am not seeing ('cause
I am still starting to learn programming)?

Cheers

Mede

 

objo wrote at 2012-04-25 07:08:

What kind of file are you importing? It should still be possible to extract the geometry from the returned Model3D, but I don't think you should depend on this being in Children[0] (an imported file could contain more than one GeometryModel3D).


medecai wrote at 2012-04-25 13:19:

 

Obj.-Files exportet by blender. And you are, of course, completely right concerning the number of geometries in the file. Which is most likely the problem of most models not be shown correctly . For me it seemed to be the easiest way to include lots of models/geometries and be able to transform them in relation to each other by binding (in Wpf), like moving an arm for example. Somehow it was working just fine for the beta-release of helix toolkit.

Seems that I have to find out how I can bind to different models and transform them the correct way =)

 

EDIT: I found a workaround:

 

private Geometry3D LoadFromFile(string objPath)
        {
            Model3DGroup group = ModelImporter.Load(objPath);
            MeshBuilder TestMesh = new MeshBuilder(false, false);


            foreach (var m in group.Children)
            {
                var mGeo = m as GeometryModel3D;
                var mesh = (MeshGeometry3D)((Geometry3D)mGeo.Geometry);
                if (mesh!=null) TestMesh.Append(mesh);
            }
            return TestMesh.ToMesh();

        }

Seems to work fine. Or am I again missing something?

 

Btw. Again: this toolkit is just great! Whenever I think I just don't now how the hell I should accomplish something I find again some nice method to help. =)

0

How to clone a Helix UIElement...?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

BogusException wrote at 2014-08-22 20:08:

How can I change this stock (non-Helix) function to work with things like CubeVisual3D?

Right now I get

Value of type 'Helixtoolkit.Wpf.CubeVisual3D' cannot be converted to 'System.Windows.UIElement'. ...which makes sense. Any thoughts?
  • To Be Clear: I don't want to change the cube's type at all, but merely be able to clone it in the way below, returning the correct UIElement equivalent in the Helix namespace...*
    Public Function CloneElement(ByVal orig As UIElement) As UIElement
        If orig Is Nothing Then
            Return (Nothing)
        End If
        Dim s As String = System.Windows.Markup.XamlWriter.Save(orig)
        Dim stringReader As New StringReader(s)
        Dim xmlReader As XmlReader = XmlTextReader.Create(stringReader, New XmlReaderSettings())
        Return CType(System.Windows.Markup.XamlReader.Load(xmlReader), UIElement)
    End Function
The call to this function looks like this (pardon this editor's formatting):
Task.Factory.StartNew(
    Function() { 
        Dispatcher.BeginInvoke(New Action(Sub()
            Dim clone As CubeVisual3D = CType(CloneElement(cube1), CubeVisual3D)
            Messenger.Default.Send(Of HelixToolkit.Wpf.CubeVisual3D)(cube1) ' sends to AddAChildMvvm()
    End Sub))})
It's a threading problem, and the Function creates an instance of the cube in thsi thread, not the thread it was originally created under/in.

Thanks!

pat
:)
0

Problem loading .3ds file with texture

Anonymous 10 years ago updated by vester 8 years ago 1
This discussion was imported from CodePlex

bdeldri wrote at 2014-08-13 22:09:

Hi,

I am trying to load a simple .3ds file with a texture that I exported from Blender. It appears to read some garbage into the texture image name here (StudioReader.cs):
                case ChunkID.MAT_MAP:
                    texture = this.ReadMatMap(reader, size - 6);
                    break;
Then when it tries to load the image, it borks with "System.ArgumentException: Illegal characters in path".

I'm not familiar enough with the .3ds format to know if this is a problem with the reader or with the model, but it does seem to load fine in the OpenSceneGraph viewer.

I have the file and texture available if that would help, but I'm not sure how to attach them to this discussion (if that is even possible).

Thanks!
0

HelixToolkit.Wpf.SharpDX - Transparency and Sorting

Anonymous 10 years ago updated by egon sepp 8 years ago 1
This discussion was imported from CodePlex

eonxxx wrote at 2014-06-26 22:56:

Hithere,

anyone knows something about transparency and sorting with the sharpdx fork?
In the Helix3D lib there's an container object called HelixToolkit.Wpf.SharpDX. It is sorting faces/models related to their camera position. It's quite a bit slow on huge amount of faces. Thats why I'm switched to try the sharpdx fork.

With no sorting, models in the back of the transparent model are often invisible, what destroys the effect of transparency.

In the sharpdx fork, there's no equivalent on the first sight. If it is coded managed, I'd like to say it's same kind of slow. (what is ok for lower count of faces)

Is there a "natural" way of sharpdx, even the use of shaders, for sorting / natural looking transparency / see-through?
Anyone knows?
Thanks in advance!
eon

objo wrote at 2014-07-02 13:21:

Sorry, I don't think transparency is supported yet in the SharpDX library.

eonxxx wrote at 2014-07-06 10:59:

Just transparency is supported via:
          // model materials
            this.RedMaterial = PhongMaterials.Red;
            var diffColor = this.RedMaterial.DiffuseColor;
            diffColor.Alpha = 0.5f;
...a material thing. But sorting is the problem.
I'll gonna try a shader approach.
Thank you...

objo wrote at 2014-07-11 21:58:

Let us know if you solve this with shaders, getting transparency working properly with SharpDX would be a really nice feature!

http://en.wikipedia.org/wiki/Order-independent_transparency

eonxxx wrote at 2014-08-09 22:46:

I struggled with a more basic problem:
How to bind in a custom shader to my HELIX app?
0

Adding Tubes to the Flights Demo programmatically (4 days on this is too long...)

Anonymous 10 years ago 0
This discussion was imported from CodePlex

BogusException wrote at 2014-07-18 04:06:

Experts,

This is just getting to the point where it is dragging me down mentally. I hate being stuck on something long after I've 'paid my dues' (searched & tried way more than I should have to on a single issue)...

It is actually simple:

-Do what the OnMouseDown() does i the Flights Demo, but programmatically.
Private Overloads Sub OnMouseDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
Dim ftv = New ConnectionVisual3D(Me, ConnectionPoints(0), ConnectionPoints(1))
ftv.MyOpacity = 1.0
view1.Children.Add(ftv)

2014-07-18 EDIT:

I neglected to show how I am calling my child WPF window (the Flight Demo). This is probably important:
Private Sub mnuDisplay_DisplayEarth_click(sender As Object, e As RoutedEventArgs)
            Dim wpfEarth As New TheEarthWindow(Me)
            wpfEarth.Show()
            Dim newWindowThread As New Thread(New ThreadStart(Sub()
                                                                  Dim tempWindow As New TheEarthWindow(Me)
                                                                  AddHandler tempWindow.Closed, Sub(s2, e2) Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Background)
                                                                  tempWindow.Show()
                                                                  System.Windows.Threading.Dispatcher.Run()
                                                              End Sub))
            ' required for WPF:
            newWindowThread.SetApartmentState(ApartmentState.STA)
            ' Make the thread a background thread
            newWindowThread.IsBackground = True
            ' Start the thread
            newWindowThread.Start()
Q: I tried DOZENS of ways to open up a child WPF window, and this was the best I could do. How does spawning a child WPF Window like this impact addressing and adding children in the child window (I called the Flight Demo window "TheEarthWindow" here)?

TIA!

ORIGINAL POST FOLLOWS

I have the main thread watching a MSMQ, which feeds it 'connections'. Al lthis is fine. The problem comes when I go to add the 'connecction' to the 'earth', and I get either:
  1. The dread "The calling thread cannot access this object because a different thread owns it."
  2. Or the less frequent "This API was accessed with arguments from the wrong context."
...no matter WHAT I try... I have even gone as far as creating events & delegates, adding connections to the ObservableCollection, creating my own OCs, and every manner of delegates, invokes, and Dispatchers.

I have even tried creating my own ItemsControl in XAML, but I can't figure out how to code it for the tubes (no intellisense accepts it), or where in the 'tree' to place the following:
        <ItemsControl ItemsSource="{Binding Flights}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                        <Viewport3D /> <---???
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
Here is how I last was configured to
    Private Sub AddTheConnection(sender As Object, e As EventArgs)
        Try
            Me.childConn.MyOpacity = 1.0
            TheEarthSphere.Children.Add(childConn)
            Me.Connections.Add(childConn) ' for reference so they can be removed later...
        Catch ex As Exception
            Dim m As String = "AddTheConnection"
            log.Fatal(m & "() Exception.Message(): " & ex.Message)
            log.Fatal(m & "() Exception.ToString(): " & ex.ToString)
            log.Fatal(m & "() Exception.StackTrace(): " & ex.StackTrace)
        End Try
    End Sub
This was called any number of ways, and some attempts were without an event signature on the methods. Here is a commented summary of failures:
 ' this crashed App.run:
        'If Not Application.Current.Dispatcher.CheckAccess() Then
        '    Application.Current.Dispatcher.Invoke(New MyFunctionDelegate(AddressOf AddChildToScene))
        '    Return ' Important to leave the culprit thread
        'End If
        '=========================================================================
        ' this:
        'Me.TheEarthSphere.Children.Add(childObject)
        'TheEarthSphere.Children.Add(childObject)
        ' yields: The calling thread cannot access this object because a different thread owns it.
        '=========================================================================
        ' this:
        'Me.Dispatcher.Invoke(Sub()
        '                         TheEarthSphere.Children.Add(childObject)
        '                     End Sub)
        '' yields: This API was accessed with arguments from the wrong context.
        '=========================================================================
        ' this:
        ' MyBase.AddChild(childObject)
        ' yields: The calling thread cannot access this object because a different thread owns it.
        '=========================================================================
        ' this:
        ' Me.AddChild(childObject)
        ' yields: The calling thread cannot access this object because a different thread owns it.
        '=========================================================================
        ' this:
        'stackPanel.Dispatcher.BeginInvoke(DispatcherPriority.Normal, Sub() stackPanel.Children.Add(New TextBlock With {.Text = text})))
        'TheEarthSphere.Dispatcher.BeginInvoke(Sub()
        '                                          TheEarthSphere.Children.Add(childObject)
        '                                      End Sub)
        ' yields: Exception has been thrown by the target of an invocation.
        ' from this line in Firsty: System.Windows.Threading.Dispatcher.Run()
        '=========================================================================
        ' this:
        'Me.view1.Children.Add(childObject)
        ' yields: The calling thread cannot access this object because a different thread owns it.
        '=========================================================================
        ' this:
        'Me.view1.Dispatcher.Invoke(Sub()
        '                               view1.Children.Add(childObject)
        '                           End Sub)
        ' yields: This API was accessed with arguments from the wrong context.
        '=========================================================================
        ' this:
        ' Application.Current.Dispatcher.Invoke(New Action(Sub()
        'Me.Dispatcher.Invoke(New Action(Sub()
        '                                    TheEarthSphere.Children.Add(childObject)
        '                                End Sub))
        ' yields: The calling thread cannot access this object because a different thread owns it.
        '=========================================================================
        'Me.view1.Dispatcher.Invoke(New Action(Sub()
        '                                          'TheEarthSphere.Children.Add(childConn)
        '                                          Me.Conns.Add(childConn)
        '                                      End Sub))
        ' yields: The calling thread cannot access this object because a different thread owns it.
        '=========================================================================
        ' this:
        'Me.Dispatcher.Invoke(New Action(Sub()
        '                                    Me.Conns.Add(childConn)
        '                                End Sub))
        ' yields:
        '=========================================================================
        ' an event to allow thread communication?

        'RaiseEvent ConnectionAdded(Me, EventArgs.Empty)

        '=========================================================================
tried view1.Children.Add(childConn) and got: The calling thread cannot access this object because a different thread owns it.

Seriously, what am I going to have to do to get past this and move on?

Yours in desperation...

pat
:(
0

Super simple C# example

Anonymous 10 years ago 0
This discussion was imported from CodePlex

Bamboozled wrote at 2012-06-03 18:19:

Hi all,

I am trying to learn the very basics of using Helix to build an application using C#. There are some wonderful and sometimes quite spectacular examples of using XAML and C#, but I'm finding them a bit too complicated as a first example.

Frustratingly I haven't found any super simple example online. Has anyone got an example of how to build, e.g., a cube using C# and the Helix toolkit?

Many thanks,

B.


objo wrote at 2012-06-04 22:30:

yes, I agree, the "SimpleDemo" example should contain some very simple C# code too (a ViewModel), not only XAML. Will fix this soon!


objo wrote at 2012-06-04 22:48:

the "SimpleDemo" example has been changed, I hope this helps.


Bamboozled wrote at 2012-06-05 22:01:

I apologise if I'm missing something obvious, but after updating the package ..\Helix\Source\Examples\SimpleDemo\MainWindow.xaml.cs looks like this:

using System.Windows;

namespace ExampleBrowser
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }
}

 

There's no C# code. Where should I be looking?


objo wrote at 2012-06-05 22:09:

It seems like you are not looking at the latest version. There should be a line

this.DataContext = new MainViewModel();

in there. Then see MainViewModel.cs for the code.

0

Any easy one this time! Unresponsive WPF Window (as child)

Anonymous 10 years ago 0
This discussion was imported from CodePlex

BogusException wrote at 2014-07-10 03:26:

Experts,

Maybe I can get some help with this problem.

I have the Flights Demo code running fine in a WPF window-as long as that window is the "Startup URI" in my project's Properties -> Application -> Statup URI. It responds to mouse & keyboard as expected.

BUT, when I call that same class from code as a child of a parent WPF window, the child displays fine-and even animates-but is completely unresponsive to mouse & keyboard (except to close the window itself.

Now here is the weird part/hint that might tell the right person what the issue is:

When I close the child WPF window by clicking the close("x") widget, the window goes away, but I can see it still generating log entries!

Figuring on a thread-centric need, I have tried the following with no change in symptoms:

A. Just call it:
Dim wpfEarth As New vASA.TheEarthWindow
wpfEarth.Show()
B. Dispatchers:
(calling function/sub):
Dim thread = New Thread(New ThreadStart(AddressOf Me.DisplayEarthOnThread))
thread.SetApartmentState(ApartmentState.STA)
thread.Start()
thread.Join()
[...]
Private Sub DisplayEarthOnThread()
    Try
        Dim wpfEarth As New vASA.TheEarthWindow
        wpfEarth.Show()
        AddHandler wpfEarth.Closed, Sub(s, e) wpfEarth.Dispatcher.InvokeShutdown()
        System.Windows.Threading.Dispatcher.Run()
    Catch ex As Exception
        [...]
    End Try
End Sub
C. A ton of random variations on:
Dispatcher.Invoke(Sub()
    Dim wpfEarth As New vASA.TheEarthWindow
    wpfEarth.Show()
    AddHandler wpfEarth.Closed, Sub(sender2, e2) wpfEarth.Dispatcher.InvokeShutdown()
    System.Windows.Threading.Dispatcher.Run()
        End Sub)
D. This is SUPPOSED to kill the child window when it closes, but doesn't (still unresponsive like the above ones):
Dim newWindowThread As New Thread(New ThreadStart(Sub()
                                                                  ' When the window closes, shut down the dispatcher
                                                                  ' Start the Dispatcher Processing
                                                                  Dim tempWindow As New TheEarthWindow()
                                                                  AddHandler tempWindow.Closed, Sub(s2, e2) Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Background)
                                                                  tempWindow.Show()
                                                                  System.Windows.Threading.Dispatcher.Run()
                                                              End Sub))
newWindowThread.SetApartmentState(ApartmentState.STA)
' Make the thread a background thread
newWindowThread.IsBackground = True
' Start the thread
newWindowThread.Start()
...
I could really use some insight... The parent is a stock WPF Window Project, and the Child is a HelixViewport3D window...

TIA!

pat
:)

BogusException wrote at 2014-07-11 17:40:

I'm such an idiot...

I always tell people, and it may well be a part of Murphy's or Man Law, but if you are really stuck, just ask someone for help. The fact that you posted a request for help almost guarantees it is a stupid, silly oversight on your part.

Now, with the answer at hand, it WAS a stupid, silly thing, and one which had (relatively) little to do with Helix.

Suitably embarrassed, let's just leave it at "RTFM", shall we? :)

Thanks!

pat
:)

objo wrote at 2014-07-11 21:42:

I am glad you solved it! I did not understand much of that code!
Maybe there should be a special forum for rubber duck problem solving? :-)