예제 #1
0
        /// <summary>
        /// Creates Image Type Options for image/pdf import.
        /// </summary>
        /// <param name="filePath">File path to image/PDF.</param>
        /// <param name="resolution">Optional resolution.</param>
        /// <param name="pageNumber">Optional page number if PDF has more than one page.</param>
        /// <returns>Image Type Option object.</returns>
        // ReSharper disable once MethodOverloadWithOptionalParameter
        public static ImageTypeOptions Create(string filePath, double resolution = 72, int pageNumber = 1)
        {
            try
            {
                var doc = DocumentManager.Instance.CurrentDBDocument;
                TransactionManager.Instance.EnsureInTransaction(doc);
#if !Revit2018 && !Revit2020 && !Revit2021
                var options = new Autodesk.Revit.DB.ImageTypeOptions(filePath, false, ImageTypeSource.Link)
                {
                    PageNumber = pageNumber,
                    Resolution = resolution
                };
#else
                var options = new Autodesk.Revit.DB.ImageTypeOptions(filePath)
                {
                    PageNumber = pageNumber,
                    Resolution = resolution
                };
#endif
                TransactionManager.Instance.TransactionTaskDone();

                return(new ImageTypeOptions(options));
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
예제 #2
0
 private void InternalSetImageTypeOptions(Autodesk.Revit.DB.ImageTypeOptions ito)
 {
     InternalImageTypeOptions = ito;
 }
예제 #3
0
 public ImageTypeOptions(Autodesk.Revit.DB.ImageTypeOptions ito)
 {
     InitImageTypeOptions(ito);
 }