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

InvalidOperationException when setting opacity

Anonymous 10 years ago 0
This discussion was imported from CodePlex

keegean wrote at 2011-10-27 01:34:

I was trying to change the opacity on a material using the MaterialHelper and it gave me the following exception:

System.InvalidOperationException was unhandled by user code
  Message=Cannot set a property on object '#FFFFFF00' because it is in a read-only state.
  Source=WindowsBase
  StackTrace:
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
       at System.Windows.Media.Brush.set_Opacity(Double value)
       at HelixToolkit.MaterialHelper.ChangeOpacity(Material material, Double d)
       at HelixToolkit.MaterialHelper.ChangeOpacity(Material material, Double d)
       at Boids.BoidsViewModel.AddSightBoxes()
       at Boids.BoidsViewModel.set_ShowSight(Boolean value)
  InnerException:

 

I had created a Visual3D object and I set the material on it. I wanted to change the opacity so I used the helper. I passed in the Material of the Visual3D object, that is when I received this exception.


objo wrote at 2011-10-27 08:59:

is your material frozen? can you try changing the material without the helper method from Helix Toolkit?


keegean wrote at 2011-10-29 14:54:

I think the material was frozen. I was able to create the material and then modify it with the helper and then set on the object.

0

This api was accessed with arguments from the wrong context

Niteen 10 years ago updated by Asdf Fdsa 3 years ago 2
Hello,

We are adding and removing the ModelVisual3D object using background worker process and we got the the following error message:

Error : "This api was accessed with arguments from the wrong context"

Here is my code:

Private Sub backgroundWorker_ProgressChanged(sender As Object, e As ProgressChangedEventArgs)

Dim list = helixViewport3D.Children.OfType(Of ModelVisual3D).ToList()
For Each item As ModelVisual3D In list
If TypeOf item Is ModelVisual3D AndAlso item.GetName() = "Mesh" Then
helixViewport3D.Children.Remove(item)
End If
Next
Dim visual = CType(e.UserState, ModelVisual3D)
helixViewport3D.Children.Add(visual)
End Sub

We are used the BackgroundWorker thread to update the UI from background process. Can you please suggest how to solve this issue.

Please find the attached screem shot.


Thanks,
Niteen Patil







0

Right Mouse click

Anonymous 10 years ago 0
This discussion was imported from CodePlex

egse wrote at 2014-02-04 16:05:

Hi,

I am trying to get a hit test on the right mouse click.
However, I think the viewport is consuming the Event even I don't want to rotate. Is it possible to only consume the Event if the mouse has moved during the mousedown Event?
0

Reset camera on Zoom

Anonymous 10 years ago 0
This discussion was imported from CodePlex

JohnSourcer wrote at 2013-01-23 11:41:

Hi All,

I configure a camera at a sphere as follows, but when I zoom and then rotate it, it no longer rotates the sphere but seems to remember the original axis and rotates around that. Do I have to reset it or is there some way of always making sure it rotates around the center of the sphere:

view = sender as HelixViewport3D;
CameraController cameraController = view.CameraController;
cameraController.IsPanEnabled = false;
cameraController.CameraRotationMode = CameraRotationMode.Turntable;
cameraController.TouchMode = TouchMode.Rotating;
cameraController.CameraMode = CameraMode.Inspect;
cameraController.InertiaFactor = 0.5;

 

 


objo wrote at 2013-01-23 20:25:

Maybe the up axis (the ModelUpDirection property) should be changed to 0,1,0? (in this toolkit the default up axis is 0,0,1) 


JohnSourcer wrote at 2013-01-24 12:27:

Thanks for the reply, objo.

Sadly that doesn't help. You can observe this behaviour in your Earth Demo. If you start infinite spin rotation on the globe, stop it, scale the globe (down or up) and then start infinite spin again. 

BTW, this is an excellent bit of work. I know others have mentioned this but I too would be happy to pay for it. Reasonably ;)

 

0

BillboardVisual3D emissive text

Anonymous 10 years ago 0
This discussion was imported from CodePlex

DavidBrough wrote at 2014-03-20 00:27:

Sorry, I'm having trouble making the text display of the BillboardVisual3D scene lighting independent but cannot seem to do so in spite of setting the material type to emissive.
Any hints on how to fix this?

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

Does anyone know how to do this?
0

edit obj

Dihydrogensulfid 9 years ago updated by Lucas Silva 9 years ago 1

HI!

For an extention of my masterthesis, I need to calculate and present flowpaths of an digital surface model.

Therefore I have to questions.


1. i can import an *.obj-file with helix in a viewport with:

var modelImporter = new ModelImporter();
modelImporter.DefaultMaterial = material;
Model3DGroup model3DGroup = new Model3DGroup();
model3DGroup = modelImporter.Load("C:/exampleAreas/Area01.obj");

ModelVisual3D newVisual = new ModelVisual3D { Content = model3DGroup };

MyView.Children.Add(newVisual); // add it to the viewport


but how can I get acess to the geometry of the *.obj to readout the normal-vectors?


2. Is it possible to interact with the positions of the vertices of a loaded *.obj-file?

The hidden agenda is: manipulating the loaded *.obj-file, so the user can modify the height of vertices and change the flowpath.


It would be great if someone could give my a hint or small example :-)

Thanks for reading!


greetings!

0

Visual Studio 2010

Anonymous 10 years ago 0
This discussion was imported from CodePlex

rroveri wrote at 2012-10-22 16:03:

Hello, 


i am not able to open the examples with Visual Studio 2010. Does anybody else have the same problem?

Thanks in advance

Riccardo 


objo wrote at 2012-10-22 19:53:

Hi Riccardo, the examples are converted to .NET 4.5 and requires VS 2012 to compile. The HelixToolkit.Wpf library contains projects for both 4.0 and 4.5, but I don't want to maintain two sets of project files for all the examples. 

To build with .NET 4.0, simply change the TargetFrameWorkVersion to v4.0 in the csproj files, no other change should be necessary!


rroveri wrote at 2012-10-23 16:27:

Thank you, changing the target did the job.

0

AddPolygon works only for convex polygons

Anonymous 10 years ago 0
This discussion was imported from CodePlex

baucez wrote at 2012-05-07 14:40:

I tryed to use MeshBuilder.AddPolygon to draw a concave polygon and it does not work as expected. In fact the method uses a TriangleFan in case of more than 4 points. That is ok if the polygon is convex but does not work in the other cases.

I think Delaunay triangulation is something that can be used in this case.

Is it implemented in the toolkit?

Does exists any work around?

 

 

Thanks


objo wrote at 2012-05-07 17:49:

Right, the AddPolygon method only works for convex polygons. A simple polygon triangulation method has been implemented in Geometry\CuttingEarsTriangulator.cs, maybe you can use this?


baucez wrote at 2012-05-08 12:30:

Great! It works perfectly!!

I was wondering why you don't use it in the mesh builder for polygons. I understand that the computational time is higher but it works in every case.

0

Run on .Net 3.5

Anonymous 10 years ago 0
This discussion was imported from CodePlex

jjbravo wrote at 2012-06-29 01:30:

Hi,

First, great toolkit, thank you!

I have a project which can only run .net 3.5, I've tried compiling the toolkit under 3.5 and with exception for the surface stuff, it compiles. It also shows 3D models ok, the only thing I can't get to work for what I'm doing on this project is the movement of the camera with the mouse and the ZoomToExtend function.

Can anyone point me in the direction of where in the code I can look for this to see if I can resolve this?

Thanks,

John


objo wrote at 2012-07-07 01:34:

Sorry, I am not sure which difference between 3.5 and 4.0 that causes this behaviour (could it be the command bindings?), and I don't have time to debug in 3.5 right now.

I used mouse events before, but switched to commands to make it more flexible. Can you check if the MouseGestureHandler.Execute method is called when trying to rotate the view? If commands will not work, you could revert to overriding CameraController.OnMouseRight/MiddleButtonDown as before, something like this:

protected override void OnMouseRightButtonDown(MouseButtonEventArgs e) { 
  base.OnMouseRightButtonDown(e);
  if (e.Handled) return;
  this.rotateHandler.Execute(this, null);
  e.Handled = true;
}

If you find the problem and it can be solved with some conditional compiling directives I can check it into the repository!


jjbravo wrote at 2012-07-09 19:06:

Thanks!

I'll let you know what I find and post it here.

 

0

ZoomExtents for thin models

Anonymous 10 years ago 0
This discussion was imported from CodePlex

hulahoops wrote at 2012-09-26 17:52:

I find that the ZoomExtents function is not suitable for my needs since most of my models are flat and long (or tall and thin). Using a bounding sphere is therefore not the best solution. Instead I adapted Eric Sink's "retrieval of a 2D bounding box from a Viewport3D" code at http://www.ericsink.com/wpf3d/A_AutoZoom.html and then used the ZoomToRectangle method in the Helix toolkit following manipulation of the 2d bounding box to keep the aspect ratio the same as that of the viewport ratio.

This works great for all views except the front and back views where the ZoomToRectangle call seems to rotate the view a few degrees away from the default view.  Any ideas why?

BTW absolutely fantastic work in producing the tookit .

Regards

Simon