private void WriteStream(Stream stream, bool asText) { var writer = new DxfWriter(stream, asText, Header.Version); writer.Initialize(); WriteSectionsAndClose(writer, Sections); }
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(); }
private void WriteSectionsAndClose(DxfWriter writer, IEnumerable <DxfSection> sections) { foreach (var pair in GetCodePairs(sections)) { writer.WriteCodeValuePair(pair); } writer.Close(); }
private DxfWriter PrepareWriter(Stream stream, bool asText) { UpdateTimes(); Normalize(); var writer = new DxfWriter(stream, asText); writer.Open(); var nextHandle = DxfPointer.AssignHandles(this); Header.NextAvailableHandle = nextHandle; return(writer); }
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(); }
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(); }
private DxfWriter PrepareWriter(Stream stream, bool asText) { UpdateTimes(); Normalize(); var writer = new DxfWriter(stream, asText); writer.Open(); var nextHandle = DxfPointer.AssignHandles(this); Header.NextAvailableHandle = nextHandle; return writer; }
public override string ToString() { return($"[{DxfWriter.CodeAsString(Code)}: {Value ?? "<null>"}]"); }
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(); }