private void ProcessFilename(string filename)
        {
            IsValidModel = false;
            IsValidEntity = false;
            IsBusy = true;

            OriginalModelSize = new BindableSize3DModel(0, 0, 0);
            NewModelSize = new BindableSize3DIModel(0, 0, 0);
            Position = new BindablePoint3DModel(0, 0, 0);

            if (File.Exists(filename))
            {
                // validate file is a real model.
                // read model properties.
                Model3D model;
                _originalBounds = Modelling.PreviewModelVolmetic(filename, out model);

                if (!_originalBounds.IsEmpty && _originalBounds.SizeX != 0 && _originalBounds.SizeY != 0 && _originalBounds.SizeZ != 0)
                {
                    Model = model;
                    var rotateTransform = MeshHelper.TransformVector(new System.Windows.Media.Media3D.Vector3D(0, 0, 0), -RotateRoll, RotateYaw - 90, RotatePitch + 90);
                    var bounds = _originalBounds;
                    if (rotateTransform != null)
                    {
                        bounds = rotateTransform.TransformBounds(bounds);
                    }

                    OriginalModelSize = new BindableSize3DModel(bounds);
                    IsValidModel = true;
                    ProcessModelScale();
                }
            }

            IsBusy = false;
        }
Ejemplo n.º 2
0
        private void ProcessFilename(string filename)
        {
            IsValidModel = false;
            IsBusy = true;

            OriginalModelSize = new BindableSize3DModel(0, 0, 0);
            NewModelSize = new BindableSize3DIModel(0, 0, 0);
            Position = new BindablePoint3DModel(0, 0, 0);

            if (File.Exists(filename))
            {
                // validate file is a real model.
                // read model properties.
                Model3D model;
                var bounds = Modelling.PreviewModelVolmetic(filename, out model);
                var size = new BindableSize3DModel(bounds);
                Model = model;

                if (size != null && size.Height != 0 && size.Width != 0 && size.Depth != 0)
                {
                    OriginalModelSize = size;
                    BuildDistance = 10;
                    IsValidModel = true;
                    ProcessModelScale();
                }
            }

            IsBusy = false;
        }