コード例 #1
0
ファイル: FormBrowseFile.cs プロジェクト: minrogi/PLMPackLib
        private bool LoadDrawing(string filePath)
        {
            try
            {
                // show factory viewer control
                _factoryViewer.Visible = true;
                // get factory reference
                PicFactory factory = _factoryViewer.Factory;
                // clear factory
                factory.Clear();

                string fileExt = System.IO.Path.GetExtension(filePath).ToLower();
                if (string.Equals(".des", fileExt, StringComparison.CurrentCultureIgnoreCase))
                {
                    // load des file
                    DES_FileReader fileReader = new DES_FileReader();
                    PicLoaderDes picLoader = new PicLoaderDes(factory);
                    fileReader.ReadFile(filePath, picLoader);
                }
                else if (string.Equals(".dxf", fileExt, StringComparison.CurrentCultureIgnoreCase))
                {
                    // load dxf file
                    PicLoaderDxf picLoader = new PicLoaderDxf(factory);
                    picLoader.Load(filePath);
                    picLoader.FillFactory();
                }
                // fit view to loaded entities
                _factoryViewer.FitView();
            }
            catch (Exception /*ex*/)
            {
            }
            return true;
        }
コード例 #2
0
ファイル: DESQuerier.cs プロジェクト: minrogi/PLMPackLib
        public static DESQuerier LoadFile(string filePath)
        {
            if (!File.Exists(filePath))
                throw new DESQuerierFileNotFoundException(filePath);
            // instantiate factory
            PicFactory factory = new PicFactory();
            // instantiate loader
            PicLoaderDes picLoader = new PicLoaderDes(factory);
            // load file
            DesLib4NET.DES_FileReader reader = new DES_FileReader();
            reader.ReadFile(filePath, picLoader);
            // test for valid entities

            // return DESQuerier
            return new DESQuerier(factory);
        }
コード例 #3
0
ファイル: ThumbnailGenerator.cs プロジェクト: minrogi/PLMPack
 public static void GenerateImage(Size size, string filePath, string thumbnailFilePath)
 {
     // load file
     PicFactory factory = new PicFactory();
     string fileExt = System.IO.Path.GetExtension(filePath);
     if (string.Equals(".des", fileExt, StringComparison.CurrentCultureIgnoreCase))
     {
         PicLoaderDes picLoaderDes = new PicLoaderDes(factory);
         using (DES_FileReader fileReader = new DES_FileReader())
             fileReader.ReadFile(filePath, picLoaderDes);
     }
     else if (string.Equals(".dxf", fileExt, StringComparison.CurrentCultureIgnoreCase))
     {
         using (PicLoaderDxf picLoaderDxf = new PicLoaderDxf(factory))
         {
             picLoaderDxf.Load(filePath);
             picLoaderDxf.FillFactory();
         }                
     }
     // draw image
     Image bmp;
     ThumbnailGenerator.GenerateImage(size, factory, false, out bmp);
     bmp.Save(thumbnailFilePath);
 }
コード例 #4
0
        private bool LoadDrawing(string filePath)
        {
            try
            {
                // show factory viewer control
                factoryViewer.Visible = true;
                // get factory reference
                PicFactory factory = factoryViewer.Factory;
                // clear factory
                factory.Clear();

                string fileExt = System.IO.Path.GetExtension(filePath).ToLower();
                if (string.Equals(".des", fileExt, StringComparison.CurrentCultureIgnoreCase))
                {
                    // load des file
                    DES_FileReader fileReader = new DES_FileReader();
                    PicLoaderDes picLoader = new PicLoaderDes(factory);
                    fileReader.ReadFile(filePath, picLoader);
                }
                else if (string.Equals(".dxf", fileExt, StringComparison.CurrentCultureIgnoreCase))
                {
                    // load dxf file
                    PicLoaderDxf picLoader = new PicLoaderDxf(factory);
                    picLoader.Load(filePath);
                    picLoader.FillFactory();
                }
                else if (string.Equals(".ai", fileExt, StringComparison.CurrentCultureIgnoreCase))
                { 
                    // load ai file
                    
                }
                // fit view to loaded entities
                factoryViewer.FitView();

                if (textBoxName.Text.Length == 0)
                    textBoxName.Text = System.IO.Path.GetFileNameWithoutExtension(filePath);
                if (textBoxDescription.Text.Length == 0)
                    textBoxDescription.Text = System.IO.Path.GetFileNameWithoutExtension(filePath);
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
            return true;
        }
コード例 #5
0
ファイル: FormMain.cs プロジェクト: minrogi/PLMPackLib
        private void LoadPicadorFile(string filePath, string fileFormat)
        {
            _factoryViewCtrl.Visible = true;

            PicFactory factory = _factoryViewCtrl.Factory;

            if (string.Equals("des", fileFormat, StringComparison.CurrentCultureIgnoreCase))
            {
                PicLoaderDes picLoaderDes = new PicLoaderDes(factory);
                using (DES_FileReader fileReader = new DES_FileReader())
                    fileReader.ReadFile(filePath, picLoaderDes);
                // remove existing quotations
                factory.Remove((new PicFilterCode(PicEntity.eCode.PE_COTATIONDISTANCE))
                                    | (new PicFilterCode(PicEntity.eCode.PE_COTATIONHORIZONTAL))
                                    | (new PicFilterCode(PicEntity.eCode.PE_COTATIONVERTICAL)));
                // build autoquotation
                PicAutoQuotation.BuildQuotation(factory);
            }
            else if (string.Equals("dxf", fileFormat, StringComparison.CurrentCultureIgnoreCase))
            {
                using (PicLoaderDxf picLoaderDxf = new PicLoaderDxf(factory))
                {
                    picLoaderDxf.Load(filePath);
                    picLoaderDxf.FillFactory();
                }
            }
            // update _factoryViewCtrl
            _factoryViewCtrl.FitView();
        }