Exemplo n.º 1
0
        public static ToolWithConeViewModel Create(Tool tool, Point3D position, Vector3D direction)
        {
            var vm  = new ToolWithConeViewModel();
            var tvm = ToolViewModel.Create(tool, new Point3D(), direction);

            vm.Name      = $"{tool.Name}(cone)";
            vm.Material  = PhongMaterials.PolishedSilver;
            vm.Geometry  = ToolsHelpers.GetConeModel(tool.ConeModelFile);
            vm.Transform = new TranslateTransform3D()
            {
                OffsetX = position.X, OffsetY = position.Y, OffsetZ = position.Z
            };
            vm.Visible = true;
            vm.Children.Add(tvm);
            tvm.Parent = vm;

            return(vm);
        }
        public static AngularTransmissionViewModel Create(Tool tool, Point3D position, Vector3D direction)
        {
            var at   = tool as AngolarTransmission;
            var atvm = new AngularTransmissionViewModel()
            {
                Name      = at.Name,
                Material  = PhongMaterials.PolishedSilver,
                Geometry  = ToolsHelpers.GetConeModel(at.BodyModelFile),
                Transform = new TranslateTransform3D()
                {
                    OffsetX = position.X, OffsetY = position.Y, OffsetZ = position.Z
                },
                Visible = true
            };

            foreach (var item in at.Subspindles)
            {
                atvm.Children.Add(ToolViewModel.Create(item.Tool, item.Position.ToPoint3D(), item.Direction.ToVector3D()));
            }

            return(atvm);
        }