Пример #1
0
 public void Add(DxfCore.Model.Point point)
 {
     throw new NotImplementedException();
 }
Пример #2
0
        /// <summary>
        /// 加载dxf ASCII文件
        /// </summary>
        /// <param name="file">Dxf文件流</param>
        public void Load(Stream file)
        {
            CultureInfo cultureInfo = CultureInfo.CurrentCulture;

            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            DxfReader dxfReader = new DxfReader(file);

            dxfReader.Open();
            dxfReader.Read();
            dxfReader.Close();

            //header information
            this.version     = dxfReader.Version;
            this.handleCount = Convert.ToInt32(dxfReader.HandleSeed, 16);

            this.extMaxPoint = dxfReader.ExtMaxPoint;
            this.extMinPoint = dxfReader.ExtMinPoint;

            //tables information
            this.appRegisterNames = dxfReader.ApplicationRegistrationIds;
            this.layers           = dxfReader.Layers;
            this.lineTypes        = dxfReader.LineTypes;
            this.textStyles       = dxfReader.TextStyles;
            this.blocks           = dxfReader.Blocks;

            //entities information
            this.arcs      = dxfReader.Arcs;
            this.circles   = dxfReader.Circles;
            this.ellipses  = dxfReader.Ellipses;
            this.points    = dxfReader.Points;
            this.faces3d   = dxfReader.Faces3d;
            this.solids    = dxfReader.Solids;
            this.polylines = dxfReader.Polylines;
            this.lines     = dxfReader.Lines;
            this.inserts   = dxfReader.Inserts;
            this.texts     = dxfReader.Texts;
            this.shaps     = dxfReader.Shaps.Where(p => p.Type != EntityType.Hatch).ToList();
            this.hatchs    = dxfReader.Shaps.Where(p => p.Type == EntityType.Hatch).Select(p => p as Hatch).ToList();
            Thread.CurrentThread.CurrentCulture = cultureInfo;

            #region reasign handles
            //add default viewports
            //foreach (ViewPort viewPort in this.viewports.Values )
            //{
            //    this.handleCount = viewPort.AsignHandle(this.handleCount);
            //}

            ////add default layer
            //Layer.PlotStyleHandle = Conversion.Hex(this.handleCount++);
            //Layer byDefault = Layer.Default;
            //this.layers.Add(byDefault.Name, byDefault);
            //this.handleCount = byDefault.AsignHandle(this.handleCount);

            //// add default line types
            //LineType byLayer = LineType.ByLayer;
            //LineType byBlock = LineType.ByBlock;
            //this.lineTypes.Add(byLayer.Name, byLayer);
            //this.handleCount = byLayer.AsignHandle(this.handleCount);
            //this.lineTypes.Add(byBlock.Name, byBlock);
            //this.handleCount = byBlock.AsignHandle(this.handleCount);

            //// add default text style
            //TextStyle defaultStyle = TextStyle.Default;
            //this.textStyles.Add(defaultStyle.Name, defaultStyle);
            //this.handleCount = defaultStyle.AsignHandle(this.handleCount);

            //// add default blocks
            //Block modelSpace = Block.ModelSpace;
            //Block paperSpace = Block.PaperSpace;
            //this.blocks.Add(modelSpace.Name, modelSpace);
            //this.handleCount = modelSpace.AsignHandle(this.handleCount);
            //this.blocks.Add(paperSpace.Name, paperSpace);
            //this.handleCount = paperSpace.AsignHandle(this.handleCount);

            //// add default application registry
            //ApplicationRegistry defaultAppId = ApplicationRegistry.Default;
            //this.appRegisterNames.Add(defaultAppId.Name, defaultAppId);
            //this.handleCount = defaultAppId.AsignHandle(this.handleCount);

            //add default dimension style
            //foreach (DimensionStyle dimStyle in this.dimStyles.Values)
            //{
            //    this.handleCount = dimStyle.AsignHandle(this.handleCount);
            //}

            //foreach (Block block in this.blocks.Values)
            //{
            //    this.handleCount = block.AsignHandle(this.handleCount);
            //}

            #endregion
        }