internal void method_8(DxfWriter w) { w.Write(305, (object)this.Name); w.Write(306, (object)this.Description); w.Write(140, (object)this.Value); w.method_33(this.dxfBlockParametersValueSet_0, (short)96, (short)141, (short)175, (short)307); }
internal void Write(DxfWriter w) { w.Write(91, (object)this.int_0); w.Write(92, (object)this.int_1); w.Write(93, (object)this.int_2); w.Write(94, (object)this.int_3); }
public void VerifyStringEscapingTest() { var actual = DxfWriter.TransformControlCharacters("a\x7^\x1E b"); var expected = "a^G^ ^^ b"; Assert.Equal(expected, actual); }
internal void Write(DxfWriter w, DxfVisualStyle.Class490 pw) { pw.Write(74, (object)(short)this.EdgeModel); pw.Write(91, (object)(int)this.EdgeStyleFlags); pw.vmethod_0(64, this.IntersectionColor); pw.vmethod_0(65, this.ObscuredColor); pw.Write(75, (object)(short)this.ObscuredLineType); pw.Write(175, (object)(short)this.IntersectionLineType); pw.Write(42, (object)this.CreaseAngle); pw.Write(92, (object)(int)this.EdgeModifierFlags); pw.vmethod_0(66, this.EdgeColor); pw.Write(43, (object)this.OpacityLevel); pw.Write(76, (object)(short)this.EdgeWidth); pw.Write(77, (object)(short)this.OverhangAmount); pw.Write(78, (object)(short)this.JitterAmount); pw.vmethod_0(67, this.SilhouetteColor); pw.Write(79, (object)(short)this.SilhouetteWidth); pw.Write(170, (object)(short)this.HaloGap); pw.Write(171, (object)(short)this.IsolineCount); pw.Write(290, (object)this.EdgePrecisionHidden); if (w.Version >= DxfVersion.Dxf24) { return; } w.Write(174, (object)(short)this.EdgeStyleApplication); }
internal override void Write(DxfWriter w) { base.Write(w); w.method_234("AcDbDiametricDimensionObjectContextData"); w.Write(11, this.point3D_0); w.Write(12, this.point3D_1); }
/// <summary> /// Saves the database of the actual DxfDocument to a stream. /// </summary> /// <param name="stream">Stream.</param> /// <returns>Return true if the stream has been succesfully saved, false otherwise.</returns> /// <remarks> /// On Debug mode it will raise any exception that might occur during the whole process.<br /> /// The caller will be responsible of closing the stream. /// </remarks> public bool Save(Stream stream) { // In dxf files the decimal point is always a dot. We have to make sure that this doesn't interfere with the system configuration. CultureInfo cultureInfo = CultureInfo.CurrentCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; DxfWriter dxfWriter = new DxfWriter(); #if DEBUG dxfWriter.Write(stream, this); Thread.CurrentThread.CurrentCulture = cultureInfo; #else try { dxfWriter.Save(stream, this); } catch { return(false); } finally { Thread.CurrentThread.CurrentCulture = cultureInfo; } #endif return(true); }
internal override void Write(DxfWriter w) { base.Write(w); w.method_234("AcDbObjectContextData"); w.method_219(70, this.Version); w.Write(290, (object)this.IsDefault); }
internal override void Write(DxfWriter w) { base.Write(w); w.method_234("AcDbHatchObjectContextData"); this.dxfPattern_0.Write(w); w.Write(40, (object)this.double_0); w.Write(10, this.vector3D_0); w.Write(90, (object)this.list_0.Count); foreach (DxfHatch.BoundaryPath boundaryPath in this.list_0) { w.Write(90, (object)boundaryPath.Type); bool flag = boundaryPath.IsPolyline ? boundaryPath.PolylineData == null : boundaryPath.Edges.Count == 0; w.Write(290, (object)flag); if (!flag) { if ((boundaryPath.Type & BoundaryPathType.IsAnnotative) != BoundaryPathType.None && boundaryPath.IsPolyline) { if (boundaryPath.PolylineData != null) { boundaryPath.PolylineData.Write(w); } } else if (!boundaryPath.IsPolyline) { boundaryPath.method_1(w); } } } }
internal void Write(DxfWriter w) { w.Write(302, (object)"CONTENT"); w.Write(1, (object)"CELLCONTENT_BEGIN"); w.Write(90, (object)(int)this.tableCellContentType_0); switch (this.tableCellContentType_0) { case TableCellContentType.Value: w.Write(300, (object)"VALUE"); this.dxfValue_0.Write(w); break; case TableCellContentType.Field: case TableCellContentType.Block: w.method_218(340, this.ValueObject); break; } w.Write(91, (object)this.dxfTableAttributeCollection_0.Count); int index = 1; foreach (DxfTableAttribute dxfTableAttribute in (List <DxfTableAttribute>) this.dxfTableAttributeCollection_0) { dxfTableAttribute.Write(w, index); ++index; } w.Write(309, (object)"CELLCONTENT_END"); w.Write(1, (object)"FORMATTEDCELLCONTENT_BEGIN"); w.Write(170, (object)this.dxfContentFormat_0.DataFlags); if (this.dxfContentFormat_0.HasData) { this.dxfContentFormat_0.method_7(w); } w.Write(309, (object)"FORMATTEDCELLCONTENT_END"); }
/// <summary> /// Saves the database of the actual DxfDocument to a dxf file. /// </summary> /// <param name="file">File name.</param> /// <param name="isBinary">Defines if the file will be saved as binary, by default it will be saved as text.</param> /// <returns>Return true if the file has been succesfully save, false otherwise.</returns> /// <remarks> /// If the file already exists it will be overwritten.<br /> /// The Save method will still raise an exception if they are unable to create the FileStream.<br /> /// On Debug mode they will raise any exception that migh occur during the whole process. /// </remarks> public bool Save(string file, bool isBinary = false) { FileInfo fileInfo = new FileInfo(file); this.name = Path.GetFileNameWithoutExtension(fileInfo.FullName); DxfWriter dxfWriter = new DxfWriter(); Stream stream = File.Create(file); #if DEBUG dxfWriter.Write(stream, this, isBinary); stream.Close(); #else try { dxfWriter.Write(stream, this, isBinary); } catch { return(false); } finally { stream.Close(); } #endif return(true); }
public void Write(Class741 dataStore, DxfWriter w) { this.class741_0 = dataStore; w.Write(0, (object)"SECTION"); w.Write(2, (object)"ACDSDATA"); w.Write(70, (object)(short)2); w.Write(71, (object)(short)2); foreach (Class48 schema in dataStore.Schemas) { schema.Write(w); } foreach (KeyValuePair <ulong, List <Stream> > keyValuePair in (Dictionary <ulong, List <Stream> >)dataStore.method_0(Enum53.const_2)) { foreach (Stream stream in keyValuePair.Value) { Class1027 class1027 = new Class1027(); Class496 class496_1 = new Class496(); class496_1.Name = "AcDbDs::ID"; class496_1.DataType = Enum26.const_9; Class496 class496_2 = class496_1; class496_2.Data = new Struct18(320, (object)keyValuePair.Key); class1027.Columns.Add(class496_2); Class496 class496_3 = new Class496(); class496_3.Name = "ASM_Data"; class496_3.DataType = Enum26.const_14; Class496 class496_4 = class496_3; class496_4.Data = new Struct18(310, (object)stream); class1027.Columns.Add(class496_4); class1027.Write(w); } } w.Write(0, (object)"ENDSEC"); }
internal override void Write(DxfWriter w) { base.Write(w); w.Write(100, (object)"AcDbLinkedData"); w.Write(1, (object)this.string_0); w.Write(300, (object)this.string_1); }
internal override void Write(DxfWriter w) { base.Write(w); w.method_219(70, (short)this.AttachmentPoint); w.Write(10, this.XDirection); w.Write(11, this.Location); w.Write(40, (object)this.ReferenceSize.X); w.Write(41, (object)this.ReferenceSize.Y); w.Write(42, (object)this.Size.X); w.Write(43, (object)this.Size.Y); w.method_219(71, this.Columns != null ? (short)this.Columns.Type : (short)0); if (this.Columns == null) { return; } w.method_219(72, (short)this.Columns.ColumnsCount); w.Write(44, (object)this.Columns.ColumnWidth); w.Write(45, (object)this.Columns.Gutter); w.method_221(73, this.Columns.IsAutoHeight); w.method_221(74, this.Columns.IsFlowReversed); if (this.Columns.IsAutoHeight || this.Columns.Type != DxfMTextObjectContextData.ColumnType.DynamicColumns) { return; } foreach (double columnHeight in this.Columns.ColumnHeights) { w.Write(46, (object)columnHeight); } }
internal void Write(DxfWriter w) { w.Write(300, (object)"CELL"); w.Write(1, (object)"LINKEDTABLEDATACELL_BEGIN"); w.Write(90, (object)(int)this.tableCellStateFlags_0); w.Write(300, (object)this.string_0); w.Write(91, (object)this.int_0); w.Write(301, (object)"CUSTOMDATA"); this.dxfTableCustomDataCollection_0.Write(w); w.Write(92, (object)this.int_1); w.Write(95, (object)this.dxfTableCellContentCollection_0.Count); foreach (DxfTableCellContent tableCellContent in (List <DxfTableCellContent>) this.dxfTableCellContentCollection_0) { tableCellContent.Write(w); } w.Write(309, (object)"LINKEDTABLEDATACELL_END"); w.Write(1, (object)"FORMATTEDTABLEDATACELL_BEGIN"); w.Write(300, (object)"CELLTABLEFORMAT"); this.dxfTableCellStyle_0.method_22(w); w.Write(309, (object)"FORMATTEDTABLEDATACELL_END"); w.Write(1, (object)"TABLECELL_BEGIN"); w.Write(90, (object)(this.dxfTableCellStyle_1 == null ? 0 : this.dxfTableCellStyle_1.Id)); w.Write(91, (object)this.int_2); if (this.int_2 != 0) { w.Write(91, (object)this.int_3); w.Write(40, (object)this.double_0); w.Write(41, (object)this.double_1); w.method_218(330, this.UnknownObject); w.Write(92, (object)this.int_4); } w.Write(309, (object)"TABLECELL_END"); }
public void WriteDoubleTest() { Assert.Equal("1.0", DxfWriter.DoubleAsString(1.0)); Assert.Equal("1.000005", DxfWriter.DoubleAsString(1.000005)); Assert.Equal("-1.0", DxfWriter.DoubleAsString(-1.0)); Assert.Equal("-1.000005", DxfWriter.DoubleAsString(-1.000005)); Assert.Equal("1500000000000000.0", DxfWriter.DoubleAsString(1.5e15)); }
public void WriteLongTest() { // longs are written as-is Assert.Equal("1", DxfWriter.LongAsString(1)); Assert.Equal("10", DxfWriter.LongAsString(10)); Assert.Equal("100", DxfWriter.LongAsString(100)); Assert.Equal("-1", DxfWriter.LongAsString(-1)); }
public void VerifyCodeAsStringTest() { // codes written to ASCII files are right-padded for 3 spaces, overflow if too large Assert.Equal(" 0", DxfWriter.CodeAsString(0)); Assert.Equal(" 10", DxfWriter.CodeAsString(10)); Assert.Equal("100", DxfWriter.CodeAsString(100)); Assert.Equal("1000", DxfWriter.CodeAsString(1000)); }
internal override void Write(DxfWriter w) { base.Write(w); w.method_219(70, (short)this.textHorizontalAlignment_0); w.Write(50, (object)(this.double_0 * (180.0 / System.Math.PI))); w.Write(10, this.point2D_1); w.Write(11, this.point2D_0); }
internal override void Write(DxfWriter w) { base.Write(w); w.Write(50, (object)(this.double_0 * (180.0 / System.Math.PI))); w.Write(10, this.point3D_0); w.Write(41, (object)this.vector3D_0.X); w.Write(42, (object)this.vector3D_0.Y); w.Write(43, (object)this.vector3D_0.Z); }
internal override void Write(DxfWriter w) { base.Write(w); w.method_234(this.AcClass); w.Write(90, (object)this.int_0); w.method_219(70, (short)this.imageDisplayFrameFlag_0); w.method_219(71, (short)this.imageDisplayQuality_0); w.method_219(72, (short)this.imageInsertionUnits_0); }
public void Write(DxfWriter w) { w.Write(0, (object)"ACDSRECORD"); w.Write(90, (object)(int)this.uint_0); foreach (Class495 class495 in this.list_0) { class495.Write(w); } }
internal void Write(DxfWriter w, int borderId) { if (!this.bool_1) { return; } w.Write(95, (object)borderId); this.method_5(w); }
internal override void Write(DxfWriter w) { base.Write(w); w.method_234("AcDbHatchViewContextData"); w.method_218(330, this.dxfObjectReference_4 == null ? (DxfHandledObject)null : (DxfHandledObject)this.dxfObjectReference_4.Value); w.Write(10, this.vector3D_1); w.Write(51, (object)this.double_1); w.Write(290, (object)this.bool_1); }
internal void Write(DxfWriter w) { w.Write(1, (object)"DATAMAP_BEGIN"); w.Write(90, (object)this.Count); foreach (DxfTableCustomData dxfTableCustomData in (List <DxfTableCustomData>) this) { dxfTableCustomData.Write(w); } w.Write(309, (object)"DATAMAP_END"); }
internal override void Write(DxfWriter w) { base.Write(w); w.method_234("AcDbScale"); w.method_219(70, (short)0); w.Write(300, (object)this.string_0); w.Write(140, (object)this.double_0); w.Write(141, (object)this.double_1); w.Write(290, (object)this.bool_1); }
internal void Write(DxfWriter w) { w.Write(300, (object)"CELLSTYLE"); this.method_22(w); w.Write(1, (object)"CELLSTYLE_BEGIN"); w.Write(90, (object)this.int_0); w.Write(91, (object)(int)this.cellType_0); w.Write(300, (object)this.string_0); w.Write(309, (object)"CELLSTYLE_END"); }
private void method_22(DxfWriter w, int int32GroupCode, int int64GroupCode, long value) { if (w.Version > DxfVersion.Dxf21) { w.Write(int64GroupCode, (object)value); } else { w.Write(int32GroupCode, (object)(int)value); } }
internal override void Write(DxfWriter w) { base.Write(w); w.Write(290, (object)(this.dxfMTextObjectContextData_0 != null)); if (this.dxfMTextObjectContextData_0 == null) { return; } w.Write(101, (object)"Embedded Object"); this.dxfMTextObjectContextData_0.Write(w); }
internal override void Write(DxfWriter w) { base.Write(w); w.method_234("AcDbBlockAngularConstraintParameter"); w.Write(305, (object)this.Name); w.Write(306, (object)this.Description); w.Write(1011, this.BasePointAngular); w.Write(1012, this.TextPosition); w.Write(140, (object)this.Value); w.Write(280, (object)this.Unknown1); w.method_33(this.dxfBlockParametersValueSet_0, (short)96, (short)141, (short)175, (short)307); }
internal override void Write(DxfWriter w) { base.Write(w); w.Write(100, (object)"AcDbFormattedTableData"); w.Write(300, (object)"TABLEFORMAT"); this.dxfTableCellStyle_0.method_22(w); w.Write(90, (object)this.dxfTableCellRangeCollection_0.Count); foreach (DxfTableCellRange dxfTableCellRange in (List <DxfTableCellRange>) this.dxfTableCellRangeCollection_0) { dxfTableCellRange.Write(w); } }
private void okButton_Click(object sender, EventArgs e) { string entFile = entFileTextBox.Text; if (!String.IsNullOrEmpty(entFile) && !File.Exists(entFile)) { MessageBox.Show("Specified entity translation file does not exist"); entFileTextBox.Focus(); return; } // Are we going to be doing a topological export or not? bool isTopological = polDataRadioButton.Checked; // Are we going to write arcs as polylines? If so, check // environment variable to see if a non-standard arc // tolerance has been specified. double arcTol = 0.0; if (arcPolylineCheckBox.Checked) { // The default tolerance is 1mm on the ground. arcTol = 0.001; // If the environment variable is set, pick up the specified value. string s = System.Environment.GetEnvironmentVariable("CED_ARCTOL"); if (!String.IsNullOrEmpty(s)) { double envtol = Double.Parse(s); // Do a sanity check. if (envtol < 0.000001 || envtol > 1.0) { string msg = String.Format( "Arc tolerance (CED_ARCTOL = {0}) is not in the acceptable range (1 micron to 1 metre).", envtol); MessageBox.Show(msg); return; } arcTol = envtol; } } // Get the output file spec string projectName = EditingController.Current.Project.Name; string fileName = null; using (SaveFileDialog dial = new SaveFileDialog()) { dial.Title = "Save AutoCad file"; dial.Filter = "AutoCAD DXF (.dxf)|*.dxf|All files (*.*)|*.*"; dial.DefaultExt = "dxf"; dial.FileName = projectName + ".dxf"; if (dial.ShowDialog(this) != DialogResult.OK) return; fileName = dial.FileName; } // Only remember the entity translation file if it's non-blank. if (!String.IsNullOrEmpty(entFile)) Settings.Default.EntityTranslation = entFile; // Remember default version for next time string version = versionComboBox.SelectedText; Settings.Default.AutoCadVersion = version; Settings.Default.Save(); // Create the writer with the specified values m_Writer = new DxfWriter(); m_Writer.FileName = fileName; m_Writer.ArcTolerance = arcTol; m_Writer.EntityTranslationFileName = entFile; m_Writer.IsTopological = isTopological; m_Writer.Version = version; this.DialogResult = DialogResult.OK; Close(); }
/// <summary> /// Saves the database of the actual DxfDocument to a stream. /// </summary> /// <param name="stream">Stream.</param> /// <param name="isBinary">Defines if the file will be saved as binary.</param> /// <returns>Return true if the stream has been successfully saved, false otherwise.</returns> /// <remarks> /// On Debug mode it will raise any exception that might occur during the whole process.<br /> /// The caller will be responsible of closing the stream. /// </remarks> public bool Save(Stream stream, bool isBinary) { DxfWriter dxfWriter = new DxfWriter(); #if DEBUG dxfWriter.Write(stream, this, isBinary); #else try { dxfWriter.Write(stream, this, isBinary); } catch { return false; } #endif return true; }
/// <summary> /// Saves the database of the actual DxfDocument to a dxf file. /// </summary> /// <param name="file">File name.</param> /// <param name="isBinary">Defines if the file will be saved as binary.</param> /// <returns>Return true if the file has been successfully save, false otherwise.</returns> /// <remarks> /// If the file already exists it will be overwritten.<br /> /// The Save method will still raise an exception if they are unable to create the FileStream.<br /> /// On Debug mode they will raise any exception that might occur during the whole process. /// </remarks> public bool Save(string file, bool isBinary) { FileInfo fileInfo = new FileInfo(file); this.name = Path.GetFileNameWithoutExtension(fileInfo.FullName); DxfWriter dxfWriter = new DxfWriter(); Stream stream = File.Create(file); #if DEBUG dxfWriter.Write(stream, this, isBinary); stream.Close(); #else try { dxfWriter.Write(stream, this, isBinary); } catch { return false; } finally { stream.Close(); } #endif return true; }