For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!

How to get a 2d bitmap of 3d control
mcab21 wrote at 2013-11-26 13:57:
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:
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

context menu when right clicking on objects in 3d view
mihaipruna wrote at 2014-01-06 20:32:
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:
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:
2) Yes, change the gesture as AnotherBor suggests
mihaipruna wrote at 2014-01-09 17:28:

How to correctly load .obj and .3ds in an HelixViewPort3D?
zoras1986 wrote at 2013-06-05 16:59:
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:
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.

rotation
sebastienjouhans wrote at 2013-07-30 11:04:
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:

UIElement Visual3DModel behaves differently than MeshGeometryVisual3D
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.

Relevant WPF code:
<h:HelixViewport3D x:Name="view1">Demo2Element3D construction (Blue glass):
<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>
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

Drag & drop behaviour changing between HelixToolkit and HelixToolkit.Wpf
psteclik wrote at 2013-09-27 20:04:
objo wrote at 2013-09-29 09:20:
Can you reproduce the behaviour in a small example?

Camera Binding
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);

Documentation ?!
Zakos wrote at 2013-09-03 09:08:
objo wrote at 2013-09-05 07:56:

Layers or Groups in Exporter
Capn_K wrote at 2013-07-30 03:59:
At the moment, I'm not entirely sure where to start.
Our code is creating objects using ExtrudedVisual3d and QuadVisual3d which end up as direct children of the viewport.
I was thinking I could create a nested structure of ModelVisual3d elements under the viewport, each of which contains a set of children which make up that layer. But this wouldn't know about the 'name' of that layer.
Similarly, when exporting the decendant exporter class is not called until the base class has traversed down to the Geometry3dModel, at which point it's unaware of the ModelVisual3d which it belongs to.
The obj exporter is the only exporter that I can see which exports groups, but it creates a new group for each GeometryModel3d, which is not what I want in this case.
Should I be looking at Dependency Properties/Attached Properties to achieve this? But where to put them?
Clues? Suggestions?
objo wrote at 2013-09-08 08:48:
https://helixtoolkit.codeplex.com/workitem/9994

make Point Visual3D clickable?
bennasi wrote at 2012-11-16 11:12:
Is it possible to make a point Visual 3D clickable? If yes how?
Thanks
objo wrote at 2012-11-19 17:00:
No, the PointsVisual3D class is not based on the UIElement3D, so there will be no mouse events. Try changing the base class to ModelUIElement3D!
bennasi wrote at 2012-11-23 16:28:
Could you give me a small example of how I could make a clickable point then? Am really new to wpf 3D.
If not a good reference to how to start with wpf 3d would be much appreciated.
I am trying to make a grid of points (of which the positions I have) and lines connecting them.
Customer support service by UserEcho