示例#1
0
文件: Block.cs 项目: lomatus/SharpDxf
        /// <summary>
        /// Initializes a new instance of the <c>Block</c> class.
        /// </summary>
        /// <param name="name">Block name.</param>
        public Block(string name)
            : base(DxfObjectCode.Block)
        {
            if (string.IsNullOrEmpty(name))
                throw (new ArgumentNullException("name"));

            this.name = name;
            this.basePoint = Vector3f.Zero;
            this.layer = Layer.Default;
            this.attributes = new Dictionary<string, AttributeDefinition>();
            this.entities = new List<IEntityObject>();
            this.record=new BlockRecord(name);
            this.end = new BlockEnd(this.layer);
        }
示例#2
0
        /// <summary>
        /// Writes a new block record to the table section.
        /// </summary>
        /// <param name="blockRecord">Block.</param>
        public void WriteBlockRecord(BlockRecord blockRecord)
        {
            if (this.activeTable != StringCode.BlockRecordTable)
            {
                throw new InvalidDxfTableException(this.activeTable, this.file);
            }
            this.WriteCodePair(0, blockRecord.CodeName);
            this.WriteCodePair(5, blockRecord.Handle);
            this.WriteCodePair(100, SubclassMarker.TableRecord);

            this.WriteCodePair(100, SubclassMarker.BlockRecord);

            this.WriteCodePair(2, blockRecord);
        }