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

Error using Meshbuilder.AddRevolvedGeometry

Anonymous 11 years ago 0
This discussion was imported from CodePlex

mcrxb wrote at 2012-02-09 17:51:

I'm receiving the following error when trying to add a revolved geometry:

Cannot implicitly convert type 'void' to 'System.Windows.Media.Media3D.Geometry3D'

My code looks like this:

private IList<Point> profile = new List<Point>();
private MeshBuilder mb = new MeshBuilder();

profile.Add(new Point(0, 0));
profile.Add(new Point(ShankRadius, 0));
profile.Add(new Point(ShankRadius, ShankLength - ChamferOffset));           
GeometryModel3D ShankGeometry = new GeometryModel3D();
ShankGeometry.Geometry = mb.AddRevolvedGeometry(profile, new Point3D(0, 0, 0), new Vector3D(0, 1, 0), 30);
ShankGeometry.Material = Materials.Hue;
ShankGeometry.BackMaterial = Materials.Hue;
vc.Add(ShankGeometry);

I get the error on the ShankGeometry.Geometry line. Any help would be greatly appreciated!


objo wrote at 2012-02-13 20:06:

try

mb.AddRevolvedGeometry(profile, new Point3D(0, 0, 0), new Vector3D(0, 1, 0), 30);
ShankGeometry.Geometry = mb.ToMesh();

mcrxb wrote at 2012-02-21 14:10:

That worked perfect, thank you. One follow up question: I'm adding the revolves to a Model3D collection and want to set a different color for each revolved geometry (say I have two cylinders stacked on top of each other, one red and one blue) but for some reason it only uses the material of the last object added to the collection...do I need to clear this somehow? Should I be creating a new MeshBuilder for every revolve?


objo wrote at 2012-02-21 14:22:

you need a new GeometryModel3D to define objects with different materials. Geometry can be reused, but I think it is necessary to freeze (use the freeze argument in the MeshBuilder.ToMesh method).


mcrxb wrote at 2012-02-21 14:28:

I'm creating a new GeometryModel3D every time I add to the collection:

points.Add(new Point(0, 0));
points.Add(new Point(0, 1));
points.Add(new Point(1, 1));

mb.AddRevolvedGeometry(points, new Point3D(0, 0, 0), new Vector3D(0, 1, 0), 50);
vc.Add(new GeometryModel3D(mb.ToMesh(), Materials.Gray));
points.Clear();

points.Add(new Point(0, 0));
points.Add(new Point(0, 2));
points.Add(new Point(2, 2));

mb.AddRevolvedGeometry(points, new Point3D(0, 0, 0), new Vector3D(0, 1, 0), 50);
vc.Add(new GeometryModel3D(mb.ToMesh(), Materials.Blue));
points.Clear();


objo wrote at 2012-02-21 20:47:

I think you should also create a new MeshBuilder every time - the add methods are not clearing the existing mesh in the MeshBuilder.

0

Fix to STL binary reader

Anonymous 11 years ago 0
This discussion was imported from CodePlex

MattyBoy wrote at 2014-04-09 17:17:

Change line 506 and 507 to:

this.Header = System.Text.ASCIIEncoding.ASCII.GetString(reader.ReadBytes(80)).Trim();

ReadChars(80) doesn't work in a binary file with nulls, etc...

objo wrote at 2014-04-29 10:29:

Can you provide an example StL file that fails?

objo wrote at 2014-04-29 10:32:

Submitted the change, but would still like to include unit tests for this issue.

MattyBoy wrote at 2014-05-01 19:38:

I have a sample STL file. How should I send it to you?

objo wrote at 2014-05-05 14:56:

Alt 1. Create a fork, add the example STL file to ~/Models/stl and make a pull request.
Alt 2. Make the file available for download somewhere. Dropbox, OneDrive, etc.
0

Materials won't load

Anonymous 11 years ago 0
This discussion was imported from CodePlex

sion005 wrote at 2011-10-26 17:49:

Greetings, I'm using Helix in an application to view 3d models, however, when I import the model, it's all black, with no materials. I tried several models, including the ones used on the Studio example, but the result was the same. Probably I'm doing some newbie mistake, but i would appreciate some tips to solve this.

 Here is the code that I use to load the model:

 // Fields
private TerrainCreator tc;
private Model3D CurrentModel;
private ModelVisual3D render;


public MainWindow()
{
this.InitializeComponent();

this.render = new ModelVisual3D();

this.CurrentModel = ModelImporter.Load("C:\\Users\\Pedro\\Desktop\\Helix\\HelixToolkit-Examples\\StudioDemo\\Models\\Ferarri40.3ds");

this.render.Content = this.CurrentModel;
this.view.Add(render); // this is the HelixView3D

}


objo wrote at 2011-10-26 20:43:

hi Pedro! a simple question first: did you add lights to your scene? Helix toolkit has a couple of light visuals, and also a 'headlight' in the HelixViewport3D control.


sion005 wrote at 2011-10-31 15:49:

Problem solved. I didn't had any lights! Thanks a lot!

0

Databinding HelixView (MVVM)

Anonymous 11 years ago 0
This discussion was imported from CodePlex

vuurvos wrote at 2011-04-21 16:08:

Hi,

I want to bind the HelixView3D to a model (MVVM design pattern). The only fully working way I found was by not using the MVVM design pattern. Since the MVVM pattern is a must and used in other all parts of the project, I want to use it also for the HelixView3D.

When I bind to the ModelVisual3D.content to its content in the model, the Viewport3DHelper doesnt work anymore. The viewport3DHelper doesn't detected a Visual3D which is near the clicked point. When I check the VisualChildernCount, its shows me one child.

I think the VisualChild isn't the child (3D Model) which I am clicking on. I guess its an ambientlight visual....

Regards

VuurVOS

 


zeux wrote at 2011-04-25 20:54:

try adding this to HelixView3D:

protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)

        {
            //base.OnItemsChanged(e);
           switch (e.Action)
            {
                case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
                    Add(e.NewItems.ToList<Visual3D>());
                    break;
                case System.Collections.Specialized.NotifyCollectionChangedAction.Move:
                    break;
                case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
                    Remove(e.OldItems.ToList<Visual3D>());
                    break;
                case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
                    break;
                case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
                    ClearChildren();
                    break;
                default:
                    break;
            }
        }
works like a charm for me - it's not fully implemented, obviously - but I think you get the idea


objo wrote at 2011-06-19 12:27:

vuurvos: I added a MvvmDemo that binds to HelixVis3D.ItemsSource. Adding new Visual3Ds should work now. (In the past I have used to add Visual3Ds in the XAML and bind to Model3Ds in the ViewModels)

zeux: thanks for pointing out the missing code! I added it to HelixView3D with some modifications (seems like you have added different Add/Remove methods) The implementation of Move and Replace is also remaining, as you point out.  

The MvvmDemo is not complete, will add more when I learn more Caliburn.Micro...

0

Orientation of image assigned to SphereVisual3D

Anonymous 11 years ago 0
This discussion was imported from CodePlex

tacheleu wrote at 2012-12-07 20:42:

I am using the helixtoolkit of codeplex.

¿How I can set the orientation of the image that I assign to a sphere3D?

I can assign the ImageMaterial but ¿how to rotate/orientate the image?

Thanks in advace


objo wrote at 2012-12-07 21:25:

To rotate the image, try applying a Transform2D to the TextureCoordinates in your sphere geometry.

Or create a material from a VisualBrush or ImageBrush that contains a rotated image (slower performance).

http://msdn.microsoft.com/en-us/library/system.windows.media.transform(v=vs.95).aspx
http://msdn.microsoft.com/en-us/library/system.windows.media.media3d.meshgeometry3d.texturecoordinates.aspx

0

F1 = click on bottom of cube

Anonymous 11 years ago 0
This discussion was imported from CodePlex

bennasi wrote at 2012-12-03 11:45:

Hi,

How can I make this:

If I press F1 I would like the same thing to happen (switch view) as it would do when clicking on the bottom of the view cube.

 

Thanks


objo wrote at 2012-12-03 21:26:

I think it should be possible to add a KeyBinding to the CameraController.BottomViewCommand!

But why F1? That's for help!


bennasi wrote at 2012-12-04 11:05:

Want to use the keybindings as they are in another software package (ANSA).
so I want to change the function keys to default camera positions. 

I cannot find the helixviewport.cameracontroller.bottomviewcommand.
Could you give me some sample code please. 

0

Disable Touch Pan and Rotate

Anonymous 11 years ago 0
This discussion was imported from CodePlex

rys322 wrote at 2012-04-25 17:29:

Does anyone know of a way to disable the pan and rotate manipulations when using multi-touch? I am using helixview on a project that works great with a mouse, but when I use it on a touch interface the pan and rotate operations interfere with me interacting with objects in the helixview. I do however like the pinch to zoom and would like to keep that want to keep that, but need a way to turn off pan and rotate. If needed I would be happy to make changes to the source, but figured maybe there is a more graceful way to solve the problem. Thanks!


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

I added TouchMode and IsTouchZoomEnabled properties on the HelixViewport3D/CameraController classes. Set TouchMode = None, and it should hopefully not pan/rotate. Sorry, it has not been tested - I have no touch screen...


rys322 wrote at 2012-04-25 23:51:

Thanks for making those changes. Unfortunately, it still has some issues. When touchmode is set to none it still doesn't allow touches to transferred to the objects in the helixview. If you touch anywhere it takes you into camera change mode ( the circle in the center appears) but moving your finger does nothing. 

0

Using Helix 3D with Visual C# Express

Anonymous 11 years ago 0
This discussion was imported from CodePlex

cobra18t wrote at 2011-11-28 17:53:

How can I use the Helix 3D toolkit with Visual C# Express 2010? The suggested SVN method requires an internet connection, which I cannot get on my development machine and NuGet does not work on Visual C# Express 2010. Does anyone know a way around this?

-Thomas


objo wrote at 2011-11-28 19:07:

hi Thomas, you have a "Download" link under the source code page. This will give you everything in a zip. Good luck!

0

scrollwheel zoom stops on large scene

Anonymous 11 years ago 0
This discussion was imported from CodePlex

mihaipruna wrote at 2014-08-17 17:53:

on a scene that spans a wider expanse of xy space,with multiple features, I cannot zoom in on a feature as much as when that feature was by itself. The scrollwheel simply stops zooming in, but the panning distance when dragging the mouse keeps decreasing, so it looks like your camera is "stuck"
Is there a way to enable more zoom on a bigger scene?

mihaipruna wrote at 2014-08-19 17:26:

I figured it out based on another post here:
private void hv_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
           
            if (hv.Camera.LookDirection.Length >= 800 && e.Delta < 0)
            {
                Vector3D vava = hv.Camera.LookDirection;
                vava = Vector3D.Multiply(800 / vava.Length, vava);
                hv.Camera.LookDirection = vava;
            }

            if (hv.Camera.LookDirection.Length <= 1 && e.Delta > 0)
            {
                Vector3D vava = hv.Camera.LookDirection;
                vava.Normalize();
                hv.Camera.LookDirection = vava;
            }
        }
0

How to import 3ds with materials

Anonymous 11 years ago 0
This discussion was imported from CodePlex

musicxpg wrote at 2013-02-26 05:40:

I am using the example "ModelViewer" in "helixtoolkit\Source\Examples\ModelViewer" to load 3ds file. I found the materials are not loaded. I am new to 3d WPF. Could anybody tell me how to load these materials together?

Than you!
Young

musicxpg wrote at 2013-02-26 06:14:

I found the reason. I removed the files to another address. It is why the materials were missed.

Many thanks to author's amazing Helix 3D toolkit!