Beispiel #1
0
        private void WriteSectionsAndClose(DxfWriter writer, IEnumerable <DxfSection> sections)
        {
            var writtenItems  = new HashSet <IDxfItem>();
            var outputHandles = Header.Version >= DxfAcadVersion.R13 || Header.HandlesEnabled; // handles are always enabled on R13+

            foreach (var section in sections)
            {
                foreach (var pair in section.GetValuePairs(Header.Version, outputHandles, writtenItems))
                {
                    writer.WriteCodeValuePair(pair);
                }

                if (section is DxfEntitiesSection)
                {
                    var entitiesSection = (DxfEntitiesSection)section;
                    var addedObjects    = new HashSet <DxfObject>(Objects);
                    foreach (var additionalObject in entitiesSection.AdditionalObjects)
                    {
                        if (additionalObject != null && addedObjects.Add(additionalObject))
                        {
                            Objects.Add(additionalObject);
                        }
                    }
                }
            }

            writer.Close();
        }
Beispiel #2
0
        private void WriteSectionsAndClose(DxfWriter writer, IEnumerable <DxfSection> sections)
        {
            foreach (var pair in GetCodePairs(sections))
            {
                writer.WriteCodeValuePair(pair);
            }

            writer.Close();
        }
Beispiel #3
0
        private void WriteSectionsAndClose(DxfWriter writer, IEnumerable <DxfSection> sections)
        {
            var writtenItems  = new HashSet <IDxfItem>();
            var outputHandles = Header.Version >= DxfAcadVersion.R13 || Header.HandlesEnabled; // handles are always enabled on R13+

            foreach (var section in sections)
            {
                foreach (var pair in section.GetValuePairs(Header.Version, outputHandles, writtenItems))
                {
                    writer.WriteCodeValuePair(pair);
                }
            }

            writer.Close();
        }
Beispiel #4
0
        private void WriteSectionsAndClose(DxfWriter writer, IEnumerable<DxfSection> sections)
        {
            var writtenItems = new HashSet<IDxfItem>();
            var outputHandles = Header.Version >= DxfAcadVersion.R13 || Header.HandlesEnabled; // handles are always enabled on R13+
            foreach (var section in sections)
            {
                foreach (var pair in section.GetValuePairs(Header.Version, outputHandles, writtenItems))
                {
                    writer.WriteCodeValuePair(pair);
                }
            }

            writer.Close();
        }
Beispiel #5
0
        private void WriteStream(Stream stream, bool asText)
        {
            var writer = new DxfWriter(stream, asText);
            writer.Open();

            var nextHandle = SetHandles();
            Header.NextAvailableHandle = nextHandle;

            // write sections
            var outputHandles = Header.Version >= DxfAcadVersion.R13 || Header.HandlesEnabled; // handles are always enabled on R13+
            foreach (var section in Sections)
            {
                foreach (var pair in section.GetValuePairs(Header.Version, outputHandles))
                    writer.WriteCodeValuePair(pair);
            }

            writer.Close();
        }