Example #1
0
        private void GetRevitSnapshot()
        {
            try
            {
                string tempImg = Path.Combine(Path.GetTempPath(), "BCFier", Path.GetTempFileName() + ".png");
                var    options = new ImageExportOptions
                {
                    FilePath = tempImg,
                    HLRandWFViewsFileType = ImageFileType.PNG,
                    ShadowViewsFileType   = ImageFileType.PNG,
                    ExportRange           = ExportRange.VisibleRegionOfCurrentView,
                    ZoomType        = ZoomFitType.FitToPage,
                    ImageResolution = ImageResolution.DPI_72,
                    PixelSize       = 1000
                };
                doc.ExportImage(options);

                AddViewControl.AddViewpoint(tempImg);
                File.Delete(tempImg);
            }
            catch (System.Exception ex1)
            {
                TaskDialog.Show("Error!", "exception: " + ex1);
            }
        }
Example #2
0
        private void GetRevitSnapshot()
        {
            try
            {
                var tempImg = Path.Combine(Path.GetTempPath(), "BCFier", Path.GetTempFileName() + ".png");

                var success = SaveControlPng(_control, tempImg);
                if (!success)
                {
                    return;
                }
                AddViewControl.AddViewpoint(tempImg);
                File.Delete(tempImg);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error!", "exception: " + ex);
            }
        }
Example #3
0
        public void GetNavisSnapshot()
        {
            try
            {
                string tempImg = Path.Combine(Path.GetTempPath(), "BCFier", Path.GetTempFileName() + ".png");
                // get the state of COM
                ComApi.InwOpState10 oState = ComBridge.State;
                // get the IO plugin for image
                ComApi.InwOaPropertyVec options = oState.GetIOPluginOptions("lcodpimage");
                //export the viewpoint to the image
                oState.DriveIOPlugin("lcodpimage", tempImg, options);
                Bitmap bitmap      = new Bitmap(tempImg);
                var    imageStream = new MemoryStream();
                bitmap.Save(imageStream, ImageFormat.Jpeg);
                bitmap.Dispose();

                AddViewControl.AddViewpoint(tempImg);
                File.Delete(tempImg);
            }
            catch (Exception ex1)
            {
                MessageBox.Show("exception: " + ex1, "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }