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

Material/Texture can't be loaded in HelixViewport3D

Anonymous 11 years ago 0
This discussion was imported from CodePlex

charismatubagus wrote at 2013-01-25 07:50:

Hi I am a newbie in HelixToolkit. I would like to load 3D model (.obj and .mtl) into the scene. However, I can only load the object. The material can't be seen.  

This is my code.

 

 

<h:HelixViewport3D Canvas.Left="377" Canvas.Top="253" Name="helixViewport3D1" Margin="195,190,185,12">
     <h:FileModelVisual3D x:Name="model3D" >
                
     </h:FileModelVisual3D>
</h:HelixViewport3D>
string _3DClothPath = (string)Application.Current.FindResource("3DClothes");
model3D.Source = _3DClothPath;
0

Box Selection

Anonymous 11 years ago 0
This discussion was imported from CodePlex

rinaldin wrote at 2013-10-27 13:25:

Hi all,
I'm trying for a long time to implement the box selection on the control using ContainerUIElement3D.

The last step in the box selection is to recognize which 3d objects are included, partially or totally, in the rectangle created with the mouse by the user ove the viewport.
To do this, I wrote the following code:
For Each element As ContainerUIElement3D In HelixViewport3D1.Children
                Dim position = Overlay.GetPosition3D(element)
                Dim position2D = matrix.Transform(position)
                If position2D.X > rectOrig.X And position2D.X < (rectOrig.X + rect.Width) And _
                   position2D.Y > rectOrig.Y And position2D.Y < (rectOrig.Y + rect.Height) Then
                    ' select element
                    Dim element1 = TryCast(sender, ModelUIElement3D)
                    Dim model = TryCast(element1.Model, GeometryModel3D)

                    If model.Material Is Materials.Green Then
                        model.Material = Materials.Yellow ' is selected!
                    ElseIf model.Material Is Materials.Yellow Then ' deselect
                        model.Material = Materials.Green
                    End If

                End If

            Next
but I receive every time an Invalid Cast exception in the first row (for each...); it seems I cannot use the ContainerUIElement3D inside the helixViewport.

Can you help?
0

AddExtrudedGeometry

Anonymous 11 years ago updated by ไอยดา สุรีวงค์ 4 years ago 2
This discussion was imported from CodePlex

rinaldin wrote at 2013-10-28 15:52:

Can you provide an example with meshBuilder.AddExtrudedGeometry?
I tried to use it, but with no success. Instead, the ExtrudedVisual3D works fine.

Thanks,
Giovanni

rinaldin wrote at 2013-12-20 20:31:

anyone?

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

It is possible this is an obsolete method. (The MeshBuilder needs some refactoring)
Can you use the AddTube method? It can take a general section.

AnotherBor wrote at 2014-01-08 02:15:

Good to know!
Yesterday I wanted to check it out for Rinaldin but even though params were logically correct the mesh was wrong.
All the faces were compressed to a single plane that seemed to be defined by the first pair of points in the section.

objo wrote at 2014-01-08 07:30:

Second thought: it would be good to have the AddExtrudedGeometry method too. I see the intention was to extrude a section between two points which is much simpler than making a tube. I have added an issue: https://helixtoolkit.codeplex.com/workitem/10012
0

Newbie help please

Anonymous 11 years ago 0
This discussion was imported from CodePlex

Lainy wrote at 2013-10-18 23:04:

I've struggled with this most of today, I'm sure its simple.

Just how do I get helix control on my WPF application? I usually use VB but need\want to learn WPF as I want to learn some 3D object manipulation.

I added a helixToolkit.wpf.dll as a reference and expected a control to be available to drop onto my WPF app. But no...?

I have :
Imports System.Text
Imports System.Collections.Generic
Imports System.IO.Ports 'for COM port manipulations
Imports System.Windows.Forms
Imports System.Windows.Forms.FolderBrowserDialog

Imports System.Windows
Imports System.Windows.Media
Imports System.Windows.Media.Media3D
Imports HelixToolkit.Wpf

At the top of my MainWindow.xaml.vb...

Would be really grateful any pointers?

Thanks

DK_danik wrote at 2013-10-22 13:56:

Maybe you must do this one helixtoolkit documentation
0

Visual3D's pinned to the camera

Anonymous 11 years ago 0
This discussion was imported from CodePlex

RobPerkins wrote at 2012-11-08 17:28:

I'm trying to think of a way to add something like a BillboardVisual3D such that its position stays fixed relative to the camera. Ultimately it would have an ArrowVisual3D reaching from the Billboard into the model space itself, pointing at a feature. 

This would mean that as the camera is rotated, panned, zoomed, etc, the control would stay "stuck" to the front of the frustum, as it were. 

If I understand things correctly the camera in Helix3D is the thing doing the moving during panning, rotating, and zooming; no transformations are computed on the model itself. 

How would you approach this?


objo wrote at 2012-11-12 22:15:

Yes, in this library the camera properties are modified, not the world or camera transforms.

You need to update the 3D positions of your visuals each time the camera move. I think you could create a plane at the camera 'target' position, with the camera direction as the normal vector. Then use Viewport3DHelper.GetRay and Ray3D.PlaneIntersection to calculate the 3D positions.


RobPerkins wrote at 2012-11-12 23:05:

Good; that signifies an approach I could take. What if instead of doing that, we simply position the control in the visual tree as a 2D ContentControl atop the viewport, and then extend an ArrowVisual3D from the frustum front to a world coordinate? Would the same ViewPort3DHelper and Ray3D methods be useful, or is there something simpler?

(Yes, I can figure this out on my own, but I thought the discussion here would be beneficial to others.)


objo wrote at 2012-11-13 06:05:

Yes, that should also work - I have tested 2D overlays in the ExampleBrowser/OverlayDemo. The "target" adorner and "zoom by rectangle" features in HelixViewport3D are also 2D overlays.

0

How to use Vector3D when Drawing a Box

Anonymous 11 years ago 0
This discussion was imported from CodePlex

AQSRanck wrote at 2014-07-01 20:31:

I want to draw a set of Boxes around the perimeter of a polygon, forming a "rim" around the polygon. My solution is to create a "RimVisual" to handle the task.

I have a list of points3D for each vertex of the polygon, and can easily find the vector3D for the next vertex by subtracting the previous point3D from the next point3D, giving me the length as well.

The first box would be added with an AddBox(StartPoint, X Double, Y Double, Z double). This works fine. The question is how to Add the next rim perimeter box?

Ideally, an addBox construct would require a StartPoint, Vector and XYZ Doubles, but none exists. So the question is how can I accomplish this with an existing constructor of the AddBox.

Or perhaps another tool is more suited.

Thanks,
Bob

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

sorry, I don't understand the problem here.
Why can't you
foreach (var vertex in yourPolygon)
  yourMeshBuilder.AddBox(vertex, 1, 1, 1);

AQSRanck wrote at 2014-07-02 15:35:

In fact your comment is a very close description to what I did when I discovered the issue.

The boxes are arranged nicely around the perimeter but they are all aligned in the same direction.

What we want is for each box to start at one vertex and end at the next vertex.

I have some nice screen shots that illustrate my work in Helix, that I would like to share with you, but need advice on how to get them to you.

Bob

AQSRanck wrote at 2014-07-04 21:47:

This has to be so simple yet after several days of experimenting, I still cannot draw a set of boxes around the Perimeter of a Polygon, where each box starts at one vertex and ends at the next vertex.

The solution you propose draws a box at each vertex but even if the box is a long rectangle, does not allow the azimuth of the box to be oriented towards the next vertex.

Is there a tool that allows you to describe a start point and an end point for a Box (like a Pipe), or alternatively a feature that allows you to describe a start point, a vector , and xyz sizes for the box?

I have fooled around at length with the 4th construct on Box that uses a - - center Point , Vector, Vector, X Double, Y Double, Z Double, and Faces Enum. Since I don't know what this construct is intended to do, I get really crazy boxes, some with a side missing and some with sides drawn in very unusual places. So I suspect that this construct of the AddBox is not the answer.

AQSRanck wrote at 2014-07-23 15:23:

Problem solved. This may qualify as another "Rubber Ducky".
I work with 2D CAD (where the origin is the upper left) and have a really tough time in 3D changing the origin to the center of the figure - - - in my mind.

The first chapter of Petzolds book helped get me reoriented for 3D. The mystery of the crazy shapes (4th Construct of AddBox) was also solved in Petzolds book, where he introduced me to the "basis vectors". I built a tester project that allows you to change the values of points, vectors, and lengths with dependency properties for any of the Helix figures. It has turned out to be an invaluable as a tool to get my head around what is going on in 3D. It has also eliminated endless experimentation with values to see the effect.

When learning something new like 3D, the resources are rather slim, but Petzolds book should be everyone's primer.
Bob
0

Create events for objects created at runtime?

Anonymous 11 years ago 0
This discussion was imported from CodePlex

andrey7b wrote at 2012-11-20 11:16:

I'm using the components of the helixtoolkit to my application and I came across the following situation, when I create an object, a rectangle, for example, and within it I create another object, of type square, only smaller, I can't seem to find the events for this object, I want to move it using the mouse, how should I proceed? Or object created in this way does not have events?

0

Selection Methods (Rectangle/Polygon Pick)

Anonymous 11 years ago 0
This discussion was imported from CodePlex

MalcolmWadia wrote at 2012-11-28 12:57:

Hi,

Great job with this toolkit!

We are using a standard hit-test method in the Helixviewport3d but was wondering if anyone knew the best way to implement, for example, a box select method?

 

There doesn't seem to be any specific selector classes but it might be nice to have these.


rinaldin wrote at 2013-09-29 17:08:

Hi MalcomWadia,
FYI I'm asking more or less the same thing here.
0

Best place to trigger element sorting when camera position changes

Anonymous 11 years ago 0
This discussion was imported from CodePlex

PhilDotC wrote at 2014-04-17 23:12:

Hi, I have several billboard elements which follow the camera. I need to sort these for transparency reasons whenever the camera moves. Is there an event I can use to achieve this by adding the appropriate code in the handler?

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

What is transparent - the billboards or other objects in the scene?
Should the billboards be shown behind or in front of the other objects in the scene?
Can you create an example/demo?

PhilDotC wrote at 2014-04-29 13:02:

I have uploaded an example solution here:

Download demo solution zip file

If you pan around you will see that depending upon which direction you are looking from the transparency works or doesn't depending on which billboard is nearest the camera. I need to add code to sort the viewport contents depending on their distance from the camera but I am unsure where to hook this in. It would be nice if the was a camera position changed event or something like that or perhaps you can suggest a better solution.

objo wrote at 2014-05-05 15:03:

Thanks for creating the demo, now I understand :)
I created https://helixtoolkit.codeplex.com/workitem/10046
0
Under review

How to render an arch

Michael Powell 11 years ago updated 11 years ago 2
How would I render an arch, or arc, or semi-circle? Is there a CircleVisual3D element? Possibly a SphereVisual3D with a rectangular cross section? Or a fancy grouping of PipeVisual3D calculated along the geometry of an arc. Of course if I could just render the arc, that would be that.

My math/geometry is a bit rusty, but I can puzzle it out.

Thank you...