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
Under review

Replace ViewCube

Khalid A. 10 years ago updated by datadeal Sedr 4 years ago 101

At the moment it seems that the ViewCube is a fixed Element of the HelixViewPort, that gets built up in the Code with the "AddCubeFaces" methods, etc.

It would be really nice to be able to replace the whole ViewCube with any model the user wants. That would allow us to have some kind of "MiniMap".


0

Camera View Setting

Anonymous 11 years ago 0
This discussion was imported from CodePlex

msankarsingh wrote at 2012-12-14 16:58:

Hi, 

Awesome toolkit. I am new to WPF and 3D.

I am trying to implement camera setting similar to this project  http://carvisualizer.plus360degrees.com/away3d/ any suggestion on how to implement it. Thanks in advance for your help.

0

How to get a 2d bitmap of 3d control

Anonymous 11 years ago 0
This discussion was imported from CodePlex

mcab21 wrote at 2013-11-26 13:57:

Hi,

Im looking to take a snap shot of whats in the helix HelixViewport3D control by clicking a button. Has anyone done this before? Any advice appreciated!

Thanks!

tbd2 wrote at 2013-11-27 14:41:

something like this should do the work (helix is your HelixViewport3D):


Bitmap RenderBitmapAndSaveToFile(int width, string fileName)
{
double scale = width / helix.ActualWidth;

int height = (int)(helix.ActualHeight * scale);

RenderTargetBitmap bmp = new RenderTargetBitmap( width, height, 96 * scale, 96 * scale, PixelFormats.Pbgra32);

// draw the bitmap Background
Rectangle vRect = new Rectangle();
vRect.Width = bmp.Width;
vRect.Height = bmp.Height;
vRect.Fill = helix.Background;
vRect.Arrange(new Rect(0, 0, vRect.Width, vRect.Height));
bmp.Render(vRect);

bmp.Render(helix.Viewport);

PngBitmapEncoder aEncoder = new PngBitmapEncoder();
aEncoder.Frames.Add(BitmapFrame.Create(bmp));

Directory.CreateDirectory(System.IO.Path.GetDirectoryName(fileName));

using (Stream stm = File.Create(fileName))
{
aEncoder.Save(stm);
}
}

regads,
Joachim
0

context menu when right clicking on objects in 3d view

Anonymous 11 years ago 0
This discussion was imported from CodePlex

mihaipruna wrote at 2014-01-06 20:32:

I would like to have a context menu to pop up when I right click on an object.
Two questions:
1) does Helix have any functions to create menus?
2) right click seems to control the camera, is there a way to override that? or switch camera control to a combination of left and right click buttons together?

AnotherBor wrote at 2014-01-07 05:27:

I don't know it Helix has GUI functions - although you could just pop a menu by the cursor using system API.
About how to control the camera, you can select which button (gesture) does what like this for example:
v3d.RotateGesture = new System.Windows.Input.MouseGesture(MouseAction.LeftClick);
where v3d is HelixViewport3D type.

objo wrote at 2014-01-07 22:44:

1) Use a standard WPF ContextMenu
2) Yes, change the gesture as AnotherBor suggests

mihaipruna wrote at 2014-01-09 17:28:

Thank you!
0

How to correctly load .obj and .3ds in an HelixViewPort3D?

Anonymous 11 years ago 0
This discussion was imported from CodePlex

zoras1986 wrote at 2013-06-05 16:59:

Hello everyone,
i know that this has been a solved issue, but i cannot get out of this mess.
I have tried all the possibilities that i found over internet, but i cannot figure out why some objects are loaded well and some others not. I tried three different ways...I post some code:
FileModelVisual3D Mymodel= new FileModelVisual3D();
Mymodel.source = MODELS[i]; //where MODELS[i] is a string with the path of the model, let's //say C:/fish.obj
view1.Children.Add(Mymodel);//where view1 is my helixviewport3d
so i try:
Model3DGroup modelGroup = ModelImporter.Load(MODELS[i]);
GeometryModel3D Mymodel = (GeometryModel3D)modelGroup.Children[0];
newVisual = new ModelVisual3D { Content = MyModel }; //or Content = modelGroup;
view1.Children.Add(newVisual);//where view1 is my helixviewport3d
then i try:
var reader = new StudioReader();
Model3D MyModel = reader.Read(path); //where path is the object path
newVisual = new ModelVisual3D { Content = MyModel };
view1.Children.Add(newVisual);//where view1 is my helixviewport3d
i tried also:
ObjReader reader2 = new ObjReader();
Model3DGroup modelGroup = reader2.Read(MODELS[i]);
GeometryModel3D _objRead = (GeometryModel3D)modelGroup.Children[0];
newVisual = new ModelVisual3D { Content = _objRead};
view1.Children.Add(newVisual);//where view1 is my helixviewport3d
and obviously i'have tried also the loading directly from xaml, without any significant results :(
also i tried what have been described here https://helixtoolkit.codeplex.com/discussions/354077, meaning the loading from stream, but without any success...

No one of this method is working for me :( i cannot see well all the models that i find both in the helix samples both on internet. The best result that i've obtained, till now, is with the use of the second method (create a ModelGroup3D and show it through the use of a ModelVisual3D, that will be the helixViewPort children...

Can someone told me what i'm doing wrong? Could someone give me a piece of code that is actually working? because i've searched over the internet and all i read is that everyone could get this fantastic tool to work but me :'(

have a nice day and thanks in advance...:)

objo wrote at 2013-06-08 07:30:

Do you have lights in your scene? I think your code using ModelVisual3D looks ok.
I recommend setting a breakpoint on line 527 in StudioReader.cs, then you can check if the texture is loaded correctly!
Textures are not supported when loading from a stream.
0

rotation

Anonymous 11 years ago 0
This discussion was imported from CodePlex

sebastienjouhans wrote at 2013-07-30 11:04:

Hi,

Instead of using the mouse to rotate around an object I want to use some buttons.

is it the AddRotateForce method I should use to do this where x and y would be the coordinate in world around the object?

Thanks
Seb

objo wrote at 2013-08-08 08:29:

No, the arguments are relative to the screen coordinate system. See the usage by the arrow keys!
0

UIElement Visual3DModel behaves differently than MeshGeometryVisual3D

Domvs Phi 10 years ago updated by ไอยดา สุรีวงค์ 4 years ago 2
Hello. I am testing HelixToolKit and I am trying to achieve a simple task:
Create a revolve object and display it on the 3D view port. Since I need the object to be clickable, I am adding it using the UIElement example (changed it to have the rotation instead of the sphere). This is partially achieved, this is, the object displays and I can click on it (and have a desired event), but the object does not render well as the MeshGeometryVisual3D.

See image. Blue glass was added with UIElement, while the red one with MeshGeometryVisual3D. The red one is ok - it is what I want to obtain, while the blue presents parts transparent. If I rotate the camera those parts turn solid, but others transparent. I do not believe that is a question of light as I tested several. The blue glass is half the size of the red one on propose.
In resume red glass is perfect, blue glass is defected.

Image 10

Relevant WPF code:

 <h:HelixViewport3D x:Name="view1">
<h:SunLight/>
<h:GridLinesVisual3D Center="6 0 -0.5" Fill="Gray" Visible="True"/>
<local:Demo2Element3D></local:Demo2Element3D>
<h:MeshGeometryVisual3D Transform="{h:Translate -5,0,0}" MeshGeometry="{Binding GlassGeometry}" Fill="Red" Visible="True"/>
</h:HelixViewport3D>

Demo2Element3D construction (Blue glass):

 public class Demo2Element3D : UIElement3D {
public Demo2Element3D()
{
var gm = new GeometryModel3D();
var mb = new MeshBuilder();

var profile = new[] { new Point(0, 0), new Point(0, 0.4), new Point(0.06, 0.36), new Point(0.1, 0.1), new Point(0.34, 0.1), new Point(0.4, 0.14), new Point(0.5, 0.5), new Point(0.7, 0.56), new Point(1, 0.46) };
mb.AddRevolvedGeometry(profile, null, new Point3D(0, 0, 0), new Vector3D(0, 0, 1), 200);
gm.Geometry = mb.ToMesh();
gm.Material = Materials.Blue;
Visual3DModel = gm;
}

Red glass:

 public MeshGeometry3D GlassGeometry {
get
{
var builder = new MeshBuilder(true, true);
var profile = new[] { new Point(0 * 2, 0.4 * 2), new Point(0.06 * 2, 0.36 * 2), new Point(0.1 * 2, 0.1 * 2), new Point(0.34 * 2, 0.1 * 2), new Point(0.4 * 2, 0.14 * 2), new Point(0.5 * 2, 0.5 * 2), new Point(0.7 * 2, 0.56 * 2), new Point(1 * 2, 0.46 * 2) };
builder.AddRevolvedGeometry(profile, null, new Point3D(0, 0, 0), new Vector3D(0, 0, 1), 100);
return builder.ToMesh(true);
}
}

Any information is helpful as I am very new to Helix and even to WPF.
Thank you
0

Drag & drop behaviour changing between HelixToolkit and HelixToolkit.Wpf

Anonymous 11 years ago 0
This discussion was imported from CodePlex

psteclik wrote at 2013-09-27 20:04:

I have moved my project from helixtoolkit to helixtoolkit.wpf and found some difference with drag & drop behaviour. When dragging over HelixViewport3D and its children (i.e. some 3D models in it) I'm getting a lot of DragEnter/DragLeave events. Both events are connected to HelixViewport3D (new version) and HelixView3D (old version).

objo wrote at 2013-09-29 09:20:

I am not aware of any changes related to drag/drop in the HelixViewport3D control.
Can you reproduce the behaviour in a small example?
0

Camera Binding

Anonymous 11 years ago updated by anonymous 6 years ago 0
This discussion was imported from CodePlex

zaurska wrote at 2012-09-03 14:58:

Hi

Can we use binding so the camera follows a moving object?  (the moving object's position being dynamically variable)


Z

 


zaurska wrote at 2012-09-05 14:56:



Answered myself.  More about my lack of binding knowledge than H3D function,  but for general interest for novices like me, this works:

Helix3D should be incorporated into next WPF release!

        <h:HelixViewport3D x:Name="view1" CameraRotationMode="Turntable" IsHeadLightEnabled="True">
            
            <h:HelixViewport3D.Camera>
                <PerspectiveCamera Position="0, -200, 0"  LookDirection="0, 200, 0" FieldOfView="45" UpDirection="0,0,1">
                    <PerspectiveCamera.Transform>
                        <Transform3DGroup>
                            <TranslateTransform3D x:Name="cameraTranslateTransform3D"></TranslateTransform3D>
                        </Transform3DGroup>
                    </PerspectiveCamera.Transform>
                </PerspectiveCamera>
            </h:HelixViewport3D.Camera>
        </h:HelixViewport3D>
then some binding in code since my objects are runtime:
            Binding aBinding = new Binding("OffsetX");
            aBinding.Source = tryMe.outerCasePosition;
            BindingOperations.SetBinding(cameraTranslateTransform3D, TranslateTransform3D.OffsetXProperty, aBinding);
0

Documentation ?!

Anonymous 11 years ago 0
This discussion was imported from CodePlex

Zakos wrote at 2013-09-03 09:08:

I don't find any documentation for "Hello World" demo application , many good comments but 0 documentation , how I start ?

objo wrote at 2013-09-05 07:56:

Sorry, there is no "getting started" documentation yet. But there is a lot of examples, see the source code. Also, all properties and methods should be covered by XML comments.