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

Enable/disable Camera transformation

Anonymous 11 years ago updated by Michael Powell 10 years ago 1
This discussion was imported from CodePlex

JoJo1 wrote at 2013-12-10 06:26:

Hi,
I need to enable or disable the camera transformations (pan, rotate, zoom). In case of disabling the camera transformation I set the HelixViewport3D properties 'IsPanEnabled', 'IsRotationEnabled' and 'IsZoomEnabled' to false. This will disable the transformations for mouse input.
Unfortunately the camera can still be transformed by keyboard input:
Ctrl+F, Ctrl+B, Ctrl+L, Ctrl+R, Ctrl+U, Ctrl+D: change view to front, back, left, right, up or down
A,D,W,S,Q,Z: moving along x,y and z axis

Is there any other property to be set?
Is this the intended behavior or is it maybe a bug?

objo wrote at 2013-12-12 21:42:

This sounds like a bug, I have added issue
https://helixtoolkit.codeplex.com/workitem/10011

objo wrote at 2013-12-13 14:46:

This should be corrected now: the view cube is disabled when IsRotationEnabled = false, and ADSWQZ is disabled when IsMoveEnabled = false
0

How to overlay image on wire frame model in Helix SharpDX version

vsharu 10 years ago updated by ไอยดา สุรีวงค์ 4 years ago 1

Hi , i want to overlay image while model in wireframe mode.

please help me to do how to do that

0

Suggestion for ViewCube

Anonymous 11 years ago 0
This discussion was imported from CodePlex

Elemental wrote at 2011-11-18 07:24:

I really like your ViewCube, but one of my collegues at work had an idea that makes it even beter (in my opinion ;-) )

When you click on one side of the cube it rotates to the side. The change is that it rotates to the opposite site on double click.

It an easy change and I thought maybe you want to add it to your library...

 

       private DateTime lastClick = DateTime.MinValue;

        void cube_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            DateTime currentTime = DateTime.Now;

            Vector3D normalVector = this.m_dicNormalVectors[sender];
            Vector3D upVector = this.m_dicUpVectors[sender];

            //check if this was a double click or a normal click
            if ((currentTime - lastClick).TotalSeconds < 0.5)
            {
                //this was a double click, so scroll to the opposite side of the cube
                normalVector = this.m_dicOppositeNormalVectors[sender];
                upVector = this.m_dicOppositeUpVectors[sender];
            }
            lastClick = currentTime;

            var camera = this.MainViewport.Camera as ProjectionCamera;
            Point3D target = camera.Position + camera.LookDirection;
            double distance = camera.LookDirection.Length;

            Vector3D lookDirection = -normalVector;
            lookDirection.Normalize();
            lookDirection = lookDirection * distance;

            Point3D pos = target - lookDirection;
            Vector3D upDirection = upVector;
            upDirection.Normalize();

            Helper.AnimateTo(camera, pos, lookDirection, upDirection, 500);
        }

 

Best Regards


objo wrote at 2011-11-18 19:00:

good idea! I added double-click to the ViewCube in change set 72415!


Elemental wrote at 2011-11-20 18:55:

Wow, I learn so much from your toolkit!

Didn't know the MouseButtonEventArgs has a ClickCount property :-)

0

Calculate volume of Object

Anonymous 11 years ago 0
This discussion was imported from CodePlex

JustFreak wrote at 2013-05-09 21:08:

Hello,

First of all wonderful job with the library!! I have been using the ModelImporter class for loading STL files into my program, but I would also like to calculate the Volume of a given GeometryModel with a MeshGeometry or a whole ModelGroup with several geometry models inside. I have already found a method to calculate a volume from here Calculate Volume but since I'm new to this I'm not sure how to re-factor it to fit in my case. Any help is greatly appreciated.
Thanks

objo wrote at 2013-05-27 15:23:

You can use the Visual3DHelper.TraverseModel method to traverse the Model3DGroup. This method will also give you the transforms that should be applied to each MeshGeometry3D to calculate the volumes correctly!
0

specific object visibility range

Anonymous 11 years ago 0
This discussion was imported from CodePlex

mihaipruna wrote at 2014-04-20 00:42:

I'd like for certain objects like billboards to disappear automatically from view as my camera is far enough away. Mostly interested in billboards and stuff doing that.
Is there a way to do this without having to remove objects from the viewport?
Thanks

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

This is an interesting feature request. I added
https://helixtoolkit.codeplex.com/workitem/10037
0

Visual3D material with alpha color

Anonymous 11 years ago 0
This discussion was imported from CodePlex

viettp wrote at 2011-10-02 19:22:

I found that alpha color of plane in ExportDemo only work if the transparent plane is declared last.

I need transparent surface feature in my project and don't want to depend on order of visuals. Is there anyway to overcome this issue?


objo wrote at 2011-10-03 19:31:

try the SortingVisual3D, this object sorts its children on distance from the camera to the center of each child's bounding box. 

This is sufficient for simple models like the one shown in the TransparencyDemo, but for more complicated models it might not always give the correct result..

http://helixtoolkit.codeplex.com/wikipage?title=TransparencyDemo

0

Cuttingplane demo

Anonymous 11 years ago 0
This discussion was imported from CodePlex

etick wrote at 2013-02-16 11:56:

Great work on this, will tryuto create a IFC importer for it and create some functions to select objects that can be manipulated (Hide, Transparent etc..)

But have a question about the cutting plane demo!

Is it possible to draw the wall transparent or an simple axis where the cutting planes are.
And how can you manipulate them (move, add, remove)

objo wrote at 2013-03-12 11:44:

Yes, it should be possible to add a (semi-)transparent plane and a TranslateManipulator to do this. Use bindings to control the cutting plane. See the Manipulator example in the 'Example Browser'!
0

Light problem in Helix Sharp DX

Amit Pathak 9 years ago updated 9 years ago 1

Hello,

I am trying to build an obj file viewer using Helix Toolkit with SharpDX. So far I am able to load an object file and render it's contents to Helix Viewport3DX. Model looks good with some obj files but for others there are some lightning problem and back surfaces are always black. I am not sure what am I doing wrong. Is this light problem due to the fact that SharpDX does not support back materials??


Problem using Helix Sharp DX:

Image 21


Original model looks like this in Adobe DC Reader:

Image 22


Viewport3DX settings are:


<Window.Resources>

<DataTemplate x:Key="Template1">
<hx:MyMeshGeometryModel3D Geometry="{Binding Geometry}" Transform="{Binding Transform}" Material="{Binding Material}"/>
</DataTemplate>
<hx:RenderTechniqueConverter x:Key="RenderTechniqueConverter"/></Window.Resources>

<hx:Viewport3DX x:Name="helixViewport"

Camera="{Binding Camera}" CameraRotationMode="Trackball"
RenderTechnique="{Binding RenderTechnique}"
RenderTechniquesManager="{Binding RenderTechniquesManager}"
EffectsManager="{Binding EffectsManager}"
BackgroundColor="{Binding BackgroundColor}"
UseDefaultGestures="False">
<hx:Viewport3DX.InputBindings>
<MouseBinding Gesture="LeftClick" Command="hx:ViewportCommands.Rotate"/>
<MouseBinding Gesture="MiddleClick" Command="hx:ViewportCommands.Zoom"/>
<MouseBinding Gesture="RightClick" Command="hx:ViewportCommands.Pan"/>
</hx:Viewport3DX.InputBindings>
<hx:AmbientLight3D Color="{Binding AmbientLightColor}"/>
<hx:DirectionalLight3D Color="{Binding DirectionalLightColor1}" Direction="-1,-1,-1"/>
<hx:DirectionalLight3D Color="{Binding DirectionalLightColor2}" Direction="1,-1,-0.1"/>
<hx:DirectionalLight3D Color="{Binding DirectionalLightColor3}" Direction="0.1,1,-1"/>
<hx:DirectionalLight3D Color="{Binding DirectionalLightColor4}" Direction="0.1,0.1,1"/>
<hx:ItemsModel3D x:Name="itemsModel3d" ItemTemplate="{StaticResource Template1}" ItemsSource="{Binding Items}/">
</hx:Viewport3DX>
0

relationship between HelixViewPort3D and ViewPort3D

Anonymous 11 years ago 0
This discussion was imported from CodePlex

Mrme wrote at 2013-08-05 11:09:

Hi, I hope someone would reply me this time, I don't understand the relationship between these two controls, there is a read only Viewport3D property for the HelixViewPort3D (thus we can't assign it a value), we can't have Viewport3D as a children/content for HelixViewPort3D. then when I export a HelixViewPort3D content to XAML file , I get instead a normal Viewport3D control. of course now the problem I want to load this back, since the Viewport3D property of HelixViewPort3D is read only I can't apply back this Viewport3D to the main HelixViewport3D , is there is any thing that I don't know or this is a bug needs to be corrected ? like not making the Viewport3D property of the HelixViewPort3D as read only ? any "comment" would be appreciated

Mrme wrote at 2013-08-06 10:17:

I found out there is no reason , at least at this stage , for the Viewport3D property on the HelixViewPort3D to be read only, I changed that and I made a new constructor for the HelixViewPort3D that takes a Viewport3D as an argument, so I extract my Viewport3D from the exported ResourceDictionary , I make a new HelixViewPort3D and I pass my Viewport3D to the constructor, that successfully load back my scene, I would like to submit these changes as well if there was really no reason to make the Viewport3D property read only in the first place.

objo wrote at 2013-08-08 08:26:

Yes, it should be possible to replace the Viewport3D control after the HelixViewport3D has been created, but I think you have to be careful with the Children collection and the cameras.
But do you need to replace the Viewport3D? Isn't it easier to replace the content of the viewport and update the properties of the camera?

Mrme wrote at 2013-08-08 10:41:

Viewport.Children is also read only, replacing the Viewport3D loaded the scene , but the CoordinateSystem control and the direction cube are not associated with this Viewport3D anymore, an overloaded constructor did the trick, you are right that the cameras are not preserved but that is not an issue, I don't see why I should worry about the Children collection ? I will keep experimenting and I will update the thread.
0

How to get the viewport 2D coordinates from a Point3D and viceversa?

Anonymous 11 years ago 0
This discussion was imported from CodePlex

fdhaene wrote at 2012-10-25 18:32:

Hi,

Is it possible to get the Viewport3D screen 2D coordinates from a Point3D and

viceversa: getting the Point3D from a 2D point in the Viewport3D.

thanks,

Filip 


objo wrote at 2012-10-26 08:53:

See Viewport3DHelper.Point2DtoPoint3D and Viewport3DHelper.Point3DtoPoint2D


fdhaene wrote at 2012-10-26 10:10:

Hello, I'm trying to convert a 2D screen coordinate to a Point3D in the Viewport. But the following code don't give any result. How exactly should I get the 3D coordinates from 2D screen coordinates with this function?
 Point3D p1, p2;
 Point pIn = new Point(3, 3);
 if (Viewport3DHelper.Point2DtoPoint3D(viewport3D.Viewport, pIn, out p1, out p2))
 {
      MessageBox.Show(p1.X.ToString() + "," + p1.Y.ToString());
 }
In the HelixToolit source code the Viewport3DHelper.Point2DtoPoint3D function has no inverse of the matrixCamera and returns with false
thanks, filip

objo wrote at 2012-11-02 22:36:

hi Filip, if your MatrixCamera has no inverse for the view/projection matrix I don't think it will be possible to un-project the point...