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!
+1

Viewport2DVisual3D

Anonymous 4 years ago • updated by anonymous 5 months ago 14
This discussion was imported from CodePlex

DuaneTNM wrote at 2011-08-25 03:21:

Are there any examples showing Viewport2DVisual3D with HelixView3D.  Can this type of 2D on 3D be achieved with the HelixToolKit.

 

Thanks


objo wrote at 2011-08-25 07:44:

Hi DuaneTNM, sorry there is no example using Viewport2DVisual3D. But I don't think there should be any problem to use it with the controls in HelixToolkit! 


mipa87 wrote at 2011-08-30 17:42:

First, thank you for this project.

How can I use common WPF controls (buttons, sliders) with this toolkit (with supporting button click, slider value changed and etc.)? I'm using Viewport2DVisual3D for this, render is ok, but events are not triggered. What I'm doing wrong?

Thanks

Here is my code:

             <helix:HelixView3D IsHeadLightEnabled="True" ZoomToFitWhenLoaded="True" ShowFrameRate="True" ShowFieldOfView="True" ShowCoordinateSystem="True" MouseDown="HelixView3D_MouseDown" Name="helixView3D" IsHitTestVisible="true">
                <helix:HelixView3D.Camera>
                    <PerspectiveCamera Position="0, 0, 4"/>
                </helix:HelixView3D.Camera>
                <ModelVisual3D>
                    <ModelVisual3D.Content>
                        <Model3DGroup x:Name="group">
                            <DirectionalLight Color="White" Direction="-1, -1, -3" />
                        </Model3DGroup>
                    </ModelVisual3D.Content>
                    <Viewport2DVisual3D>
                        <Viewport2DVisual3D.Geometry>
                            <MeshGeometry3D Positions="-1,1,0 -1,-1,0 1,-1,0 1,1,0"
TextureCoordinates="0,0 0,1 1,1 1,0" TriangleIndices="0 1 2 0 2 3"/>
                        </Viewport2DVisual3D.Geometry>

                        <Viewport2DVisual3D.Material>
                            <DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
                        </Viewport2DVisual3D.Material>
                        <Viewport2DVisual3D.Visual>

                            <StackPanel Orientation="Vertical">
                                <Button Click="Button_Click">Button</Button>
                                <Slider Value="100" ValueChanged="Slider_ValueChanged" />
                            </StackPanel>
                        </Viewport2DVisual3D.Visual>
                    </Viewport2DVisual3D>
                </ModelVisual3D>
            </helix:HelixView3D>


objo wrote at 2011-08-31 20:36:

I think this is related to issue 8172, and it is not solved yet...

http://helixtoolkit.codeplex.com/workitem/8172


mipa87 wrote at 2011-09-01 00:06:

Thanks for the reply, I solved it with IsViewportHitTestVisible="True"

Here is good article about it: http://msdn.microsoft.com/en-us/library/ms752097.aspx

I have one another question, what's the difference between HelixView3D and ViewPort3DConrtroller?

And here is my working code:

<helix:HelixView3D IsViewportHitTestVisible="True">
	<helix:HelixView3D.Camera>
		<PerspectiveCamera LookDirection="-10,-10,-10" Position="10,10,10" UpDirection="0,0,1"/>
	</helix:HelixView3D.Camera>
	<helix:DefaultLightsVisual3D/>
	<ModelVisual3D>
		<Viewport2DVisual3D >
			<Viewport2DVisual3D.Transform>
				<RotateTransform3D>
					<RotateTransform3D.Rotation>
						<AxisAngleRotation3D x:Name="uiRotate" Angle="40" Axis="0, 1, 0" />
					</RotateTransform3D.Rotation>
				</RotateTransform3D>
			</Viewport2DVisual3D.Transform>
			<Viewport2DVisual3D.Geometry>
				<MeshGeometry3D Positions="-1,1,0 -1,-1,0 1,-1,0 1,1,0"
TextureCoordinates="0,0 0,1 1,1 1,0" TriangleIndices="0 1 2 0 2 3"/>
			</Viewport2DVisual3D.Geometry>
			<Viewport2DVisual3D.Material>
				<DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
			</Viewport2DVisual3D.Material>
			<Viewport2DVisual3D.Visual>
				<StackPanel Orientation="Vertical">
					<Button Background="Yellow" Click="Button_Click">Button1</Button>
					<Slider Value="100" ValueChanged="Slider_ValueChanged" />
				</StackPanel>
			</Viewport2DVisual3D.Visual>
		</Viewport2DVisual3D>
	</ModelVisual3D>
</helix:HelixView3D> 

objo wrote at 2011-09-14 09:24:

try the newest version of the library, hopefully the fix on UIElements works.

Note that HelixView3D is renamed to HelixViewport3D and the IsViewportHitTestVisible property is removed.


mipa87 wrote at 2011-09-27 19:33:

Thanks, it works now correctly!

+1

Help required in opennig a 3D model (.ply) using FileModelVisual3D in WPF

Anonymous 4 years ago 0
This discussion was imported from CodePlex

pyrrhicpk wrote at 2012-09-24 03:38:

Hi,

I have just started using HelixToolkit and trying to load a 3D model (.ply) in my WPF application using FileModelVisual3D with the following code:

 

FileModelVisual3D scan = new FileModelVisual3D();
scan.Source = "C:\\box.3ds";
       
myview.Children.Add(scan); //myview is my HelixViewport3D
this.Content = myview;

Running the above code does not show the model. Any suggestions?

Thanks

+1

MVVM with background work

Anonymous 4 years ago 0
This discussion was imported from CodePlex

g_todeschini wrote at 2013-08-13 17:41:

I'm trying to create a WPF application using the MVVM pattern.
In my view (UserControl class derived) I've placed the HelixViewport3D control and I've assigned an instance of my ViewModel to the DataContext property

<h:HelixViewport3D RotateGesture="Alt+RightClick" PanGesture="RightClick">
<h:HelixViewport3D.Camera>
<OrthographicCamera Position="80.22,0,0" LookDirection="-80.22,0,0" UpDirection="0,0,1" Width="56"/>
</h:HelixViewport3D.Camera>
<h:SunLight />
<ModelVisual3D Content="{Binding Model3D}" />
</h:HelixViewport3D>

The ModelVisual3D content property is binded with the Model3D propery of my ViewModel.

All works fine but I would like to create the model in a function that works in background. I've tried to do this using both the BackgroundWorker class that the Task.Factory.StartNew but I've always get the message that the object is property of another thread.

One of my attempt is the following

public class MyViewModel : BaseViewModel
{
private MyData _model; // the data on which to generate my 3d model
private Model3DGroup _model3d;
private CancellationTokenSource _source;

public Model3DGroup Model3D
{
    get { return _model3d; }
    set
    {
        if (_model3d != value)
        {
            _model3d = value;
             RaisePropertyChanged(() => Model3D);
        }
    }
}

private void CreateModel3D(object dispatcherObject)
{
    Dispatcher dispatcher = (Dispatcher)dispatcherObject;

    Material nodesMaterial = MaterialHelper.CreateMaterial(Colors.Green);
    double size = Math.Max(_model.Limits.Width, _model.Limits.Height);
    double dn = size / 100;
    double db = size / 120;
    int thetaDiv = 10;

    foreach (Strauss.Node node in _model.Nodes)
    {
         MeshBuilder meshBuilder = new MeshBuilder(false, false);
         meshBuilder.AddSphere(new Point3D(node.X, node.Y, node.Z), dn, thetaDiv, thetaDiv / 2);
         MeshGeometry3D mesh = meshBuilder.ToMesh(true);
         dispatcher.Invoke((Action)(() => _model3d.Children.Add(new GeometryModel3D { Geometry = mesh, Material = nodesMaterial, BackMaterial = nodesMaterial })));
    }
}

private void ModelLoaded(object sender, EventArgs args)
{
    System.Windows.Window win = App.Current.Windows[0];
    DocManagerViewModel docManager = win.DataContext as DocManagerViewModel;
    _source = new CancellationTokenSource();
    Task task = Task.Factory.StartNew(CreateModel3D, _model3d.Dispatcher, _source.Token);
}
}

The process starts from the ModelLoaded event handler.

Can anyone please help me?
Thanks in advance.

RobPerkins wrote at 2013-08-14 18:02:

1 -- Use Task.Factory.StartNew(). BackgroundWorker is prone to a race condition.
2 -- All WPF objects, including GeometryModel3D and MeshGeometry3D, have to be "Frozen" to be passed between threads. See "Freezable" in the MSDN documentation.

Change the code in CreateModel3D from what you have to something like:
var gm3d = new GeometryModel3D { Geometry = mesh, Material = nodesMaterial, BackMaterial = nodesMaterial };
dispatcher.Invoke((Action)(() => _model3d.Children.Add(gm3d.GetAsFrozen())));
+1

Event that fires when the camera stops moving

Anonymous 4 years ago 0
This discussion was imported from CodePlex

everytimer wrote at 2014-07-31 21:24:

I need to perform an operation right after the user has stopped moving the camera (everytime he does it).

I'm doing it now by subscribing to every MouseEvent that allows interaction with the camera (specifically ButtonUp). The problem is that when the user has zoomed I don't have a way to know when he has stopped zooming. Other issue of capturing mouse events is that when the camera change has been generated programatically (set some saved view, etc) and there is some animation I can't do it either.

I would like to know if there is some event that I can subscribe to know when the Camera is "done", when it has stopped moving.

If such event doesn't exist I would like to know if it is possible to create one without modifying the source code of HelixToolKit and how it could be done.

Thank you very much.
+1

Show wireframe as quads with Helix and SharpDX

Raul Burgos 4 years ago in Question • updated by Muhammad Sabir Rajab 20 hours ago 62
Hello,
Is it possible to get this effect ( Connected Mesh to QuadFaces ) in the viewportDX when a .OBJ model is readed on it?.
I'm using HelixToolkit.Wpf.SharpDX.
Somebody can post a example?
Thanks in advance.

SharpDX WPF
0

Click to select the model

Smile 2 weeks ago 0
  • 我使用以下代码导入了多个模型


Microsoft.Win32.OpenFileDialog对话框=

新的Microsoft.Win32.OpenFileDialog();

dialog.Filter =“3dFile | * .obj”;

if(dialog.ShowDialog()== true && System.IO.File.Exists(dialog.FileName))

{

ObjReader CurrentHelixObjReader = new ObjReader();

Model3DGroup MyModel = CurrentHelixObjReader.Read(dialog.FileName);

ModelVisual3D model = new ModelVisual3D();

model.Content = MyModel;

View3D.Children.Add(模型);

MessageBox.Show( “成功!”);

}


但是,如何通过单击鼠标选择模型并移动它

Media3D WPF
0

Mouse bindings

nsy 2 weeks ago in Question 0

Does anyone know how to change the mouse bindings? At the moment, the right mouse button is used to rotate the object. I would like to move this binding to the left mouse button and free up the right mouse button. The right mouse button will be used to display a context menu.

0

Tubidy mobile mp3 search engine

cenk 2 weeks ago in New feature 0

Tubidy be easily reached thanks to the use of the most popular applications easily available and sees too much complacency. Tubidy's the easiest way to download and convert. Tubidy line does not stay with people they can listen to music and enjoy half the tubidy mobile music they download easily even in intenetsiz environment. In addition, this application is free and we can have this application via Google Play Store.

0

Loading Objects and Meshbuilder Questions

Bob 1 month ago in Question 0

First off, I do not want to waste anyone's time here.  I have searched extensively for answers to my questions but honestly, I haven't found a centralized source where one can go to learn about the Helix Tool Kit.  Any suggestions for the definitive source would be very helpful.


Loading an OBJ model

I am writing an application that is basically an IMU head tracker.  I have used Helix to create three viewports; one each for front, top, and side views.  I am using the teapot for the object.  I have it working where the teapot in each viewport rotates according to the data from the IMU.  I have an OBJ file of a human head and for the life of me, I can't seem to get that file to load.  I don't see the need to load it programmatically.


From an example I found, I added:


<Helix:FileModelVisual3D x:Name="Head3D" Source="c:\malehead.obj"/>

in place of:


<Helix:teapot\>

Is that all that is necessary?  FYI: If I have to do it programmatically, I am using VB, not C# in Visual Studio.


Meshbuilder


I also want to create a POV viewport.  I will have a wireframe sphere with the origin at 0,0,0.  The perspective camera will also be at 0,0,0 so the camera will be showing the wireframe from inside the sphere.  The camera will rotate in three axis based on the incoming IMU data.  Placing text on the wireframe showing the angular distance from 0,0 would be icing on the cake.

I just have not been able to find any example, tutorial, or documentation on how Meshbuilder is used.

Your help is greatly appreciated.

0

Tubidy Mobi

tubidy3 4 months ago • updated by Liliana Gomowska 4 months ago 1
Music comes among the most beautiful and most pleasant hobbies for many. People feel good by listening to music and feel quite good and so naive. Nowadays, when the technology is developing so well, it can be seen that pleasant options will come to the fore in smartphones and tablets, and the most rare works are now carried in the tubidy mobile, and every time and anytime these music can be listened to offline. Among the quality options used in this sense, the tubidy application draws attention.

This application provides assistance in listening to music downloaded from the internet, and is also the most popular way to listen to tubidy mp3. All kinds of smartphone and tablet device that can be downloaded, is extremely simple to install and at the same time also free with this application, anyone can carry all kinds of pieces can no longer carry. It is possible to listen to the songs that are pocketed at leisure times, at rest times or at every place that comes to mind.

The fact that the tubidy music download option is active as its most functional function further highlights this application. Listeners can download songs from Youtube and make their own list and listen to the downloaded songs without the need for internet. Then they can enjoy the application in order to experience the most beautiful and pleasant moments.