public Bind ( System.Windows.Media.Media3D.ModelVisual3D source ) : void | ||
source | System.Windows.Media.Media3D.ModelVisual3D | /// Source Visual3D which receives the manipulator transforms. /// |
return | void |
public void displayManipulator() { this.parent.cleanManipulator(); if (_manipulator == null) { Rect3D r = this.Content.Bounds; _manipulator = new CombinedManipulator(); //_manipulator.Position = new Point3D(r.X + (r.SizeX/2),r.Y + (r.SizeY / 2),r.Z + (r.SizeZ/2)); _manipulator.Offset = new Vector3D(r.X + (r.SizeX / 2), r.Y + (r.SizeY / 2), r.Z + (r.SizeZ / 2)); _manipulator.Pivot = new Point3D(r.X + (r.SizeX / 2), r.Y + (r.SizeY / 2), r.Z + (r.SizeZ / 2)); //_manipulator.Pivot = new Point3D(0, 0, 0); _manipulator.Diameter = Math.Max(r.SizeX, Math.Max(r.SizeY, r.SizeZ)) + 1; _manipulator.Length = _manipulator.Diameter * 0.75; _manipulator.Bind(this); Bind(_manipulator); //addTeethRoot(); //test //MeshGeometry3D mesh = GetMesh(); //drawBorderEdges(mesh); } tc.Children.Add(_manipulator); }
private void backup_alignObject_Click(object sender, RoutedEventArgs e) { if (alignObjectBool) { //ModelVisual3D m = new ModelVisual3D(); //m.Content = vmodel.Content.Clone(); //view1.Children.Clear(); //view1.Children.Add(m); alignObjectBool = false; } else { alignObjectBool = true; Model3DGroup d = (Model3DGroup)vm.CurrentModel; if (d != null) { Rect3D r = d.Bounds; RotateTransform3D rt = new RotateTransform3D(); Console.WriteLine("rect3D:" + r.X + "," + r.Y + "," + r.Z); Console.WriteLine("rect3D:" + r.SizeX + "," + r.SizeY + "," + r.SizeZ); //rect3D:105.253304,-5.142087,17.12525 //rect3D:64.387794,75.531301,78.013559 CombinedManipulator vModelManipulator = new CombinedManipulator(); vModelManipulator.Diameter = r.SizeX; vmodel.Content = vm.CurrentModel; vModelManipulator.Bind(vmodel); //view1.Children.Clear(); view1.Children.Add(vModelManipulator); } } }
/// <summary> /// @Deprecated /// Not used anymore since changes in CONTAINER design. /// <see cref="displayManipulator"/> /// </summary> public void showHideManipulator() { this.parent.clearManipulator(); if (_manipulator == null) { Rect3D r = this.Content.Bounds; _manipulator = new CombinedManipulator(); //_manipulator.Position = new Point3D(r.X + (r.SizeX/2),r.Y + (r.SizeY / 2),r.Z + (r.SizeZ/2)); _manipulator.Offset = new Vector3D(r.X + (r.SizeX / 2), r.Y + (r.SizeY / 2), r.Z + (r.SizeZ / 2)); _manipulator.Pivot = new Point3D(r.X + (r.SizeX / 2), r.Y + (r.SizeY / 2), r.Z + (r.SizeZ / 2)); //_manipulator.Pivot = new Point3D(0, 0, 0); _manipulator.Diameter = Math.Max(r.SizeX, Math.Max(r.SizeY, r.SizeZ)) + 1; _manipulator.Length = _manipulator.Diameter * 0.75; _manipulator.Bind(this); Bind(_manipulator); } this.parent.Children.Add(_manipulator); }
private void manip(object sender, MouseButtonEventArgs e) { var pt = view1.FindNearestPoint(e.GetPosition(view1)); if (cutLineBool && pt != null) { Point3D endPoint = pt.Value; Model3D d = vm.CurrentModel; //var position = new Point3D(startPoint.Y + ((endPoint.Y - startPoint.Y) / 2), startPoint.X, startPoint.Z); //Vector3D v = (endPoint - startPoint); var position = startPoint + (endPoint - startPoint) * 0.5; //var position = new Point3D(0, 0, 0); RectangleVisual3D r = new RectangleVisual3D(); //r.LengthDirection = new Vector3D(0, 1, 0); if (d != null) { r.Normal = new Vector3D(1,0,0); r.LengthDirection = new Vector3D(0,1,0); //startPoint + (endPoint - startPoint) * 0.5; r.Width = (d.Bounds.SizeX* 1.5); r.Length = (d.Bounds.SizeY * 1.5); r.Origin = position; } var combinedM = new CombinedManipulator(); combinedM.Position = position; combinedM.Offset = new Vector3D(0, 0, 0); combinedM.Diameter = r.Length/2; combinedM.Bind(r); view1.Children.Add(combinedM); view1.Children.Add(r); cutLineBool = false; } }