Closed LitsaM closed 9 years ago
Ok so I figured it out. I should add the position after the model was loaded, so I tried to find that part and I found out that its here
namespace Xbim.Presentation
{
public static class Rect3DExtensions
{
public static XbimRect3D ToXbimRect3D(this Rect3D r3D)
{
return new XbimRect3D(r3D.X, r3D.Y, r3D.Z, r3D.SizeX, r3D.SizeY, r3D.SizeZ);
}
}
}
So by adding numbers instead of variables r3D.X etc I can change the position of the mode. But I have a question. what "r3D.SizeX, r3D.SizeY, r3D.SizeZ" do? I mean what do they change if I change them. I did some experiments, I did see some changes but I can't understand what they do exactly.
Hi Litsa. I will try to take a deeper look at this issue over the weekend and see if I have any feedback for you - just been busy with work over the past few days. :)
Andy
Ok Andy thank you so much :)
Hi Litsa, sorry for the long delay, we had a few things to sort out before being able to respond to this. There have been changes in the camera/zooming code.
The comments below relate to the develop branch of the code... Master will follow in a bit. Or if you are using Nuget packages then update from https://www.myget.org/F/xbim-develop/api/v2 including pre-releases.
I'm not sure about the context in which you are trying to achieve a different zooming behaviour, so I'll try to be generic, but feel free to post again to add details.
Ok, so if you wish to set a camera different from the default at runtime after load you should use the .SetCamera() function of the viewer. Your code would likely build a suitable camera, just pass that. For any guidance on cameras you might want to look at the Helix Toolkit documentation disregarding r3d (described below, anyway).
If you are using the viewer component in your code you might want to change the behaviour of the default zoom. For this I've just marked the ViewHome() function Virtual so you can now override it and take control of the default zoom behaviour.
Rect3D is basically a bounding box with position and size, position being the min coordinate over each axis and size the difference between the max and min coordinates; _viewBounds contains the bounding box for all loaded models (you can load multiple models using a federation) and it transforms the scene in meters as unit (each model is scaled according to its unit defaults if needed). ModelPositions contains information about the scaling of models if you need to transform the coordinate of the camera according to their transform.
Viewport.ZoomExtents(r3D); is a native HelixToolkit call, so you'll find the documentation there, however you can remove that call and use your custom camera in your override.
I hope this helps, but I'd be happy to give any other help more swiftly this time around.
I'm closing the issue, feel free to write again if it needs refining.
Hi Claudio. I am sorry for not replying I was busy and I just saw your messages. Thank you very much for your reply, I have stopped working with my project but I hope I will be back in 2 months, I'll check the zooming again and I will let you know if it worked or if I need anything else.
Thank you again
Sincerely,
Pantelitsa Mavrovounioti
On 9 September 2015 at 21:10, Claudio Benghi notifications@github.com wrote:
Closed #7 https://github.com/xBimTeam/XbimWindowsUI/issues/7.
— Reply to this email directly or view it on GitHub https://github.com/xBimTeam/XbimWindowsUI/issues/7#event-405122941.
Hi again,
I am trying to set a default camera position for the model but I can't find how. I first added this code:
And didn't work so then I added this (after I deleted everything from above):
...
But then I figured out that they changed the camera podition but when my program opens the model, then the camera position changes. I don't know how to explain that so you can understand but I guess that after opening the model there is somewhere in the project that they give an initial or default matrix for the view of the model or the camera positions of viewing the model. But I can't find where is that so I can change it.