Exemple #1
0
        //--------------------------------------------------------------------------------------------------

        internal override void Write(DxfWriter writer)
        {
            writer.Write(0, "POINT");
            writer.WriteHandle();
            writer.WriteSubclass("AcDbEntity");
            writer.Write(8, LayerName);
            writer.WriteSubclass("AcDbPoint");

            writer.Write(10, Point.X);
            writer.Write(20, Point.Y);
            writer.Write(30, 0.0);
        }
Exemple #2
0
        //--------------------------------------------------------------------------------------------------

        internal override void Write(DxfWriter writer)
        {
            writer.Write(0, "LINE");
            writer.WriteHandle();
            writer.WriteSubclass("AcDbEntity");
            writer.Write(8, LayerName);
            writer.WriteSubclass("AcDbLine");

            writer.Write(10, StartPoint.X);
            writer.Write(20, StartPoint.Y);
            writer.Write(30, 0.0);

            writer.Write(11, EndPoint.X);
            writer.Write(21, EndPoint.Y);
            writer.Write(31, 0.0);
        }
Exemple #3
0
        //--------------------------------------------------------------------------------------------------

        internal override void Write(DxfWriter writer)
        {
            if (writer.Version < DxfVersion.AC1012)
            {
                return;
            }

            writer.Write(0, "SPLINE");
            writer.WriteHandle();
            writer.WriteSubclass("AcDbEntity");
            writer.Write(8, LayerName);
            writer.WriteSubclass("AcDbSpline");

            writer.Write(210, 0.0); // Plane normal vector
            writer.Write(220, 0.0);
            writer.Write(230, 1.0);

            writer.Write(70, (int)Flags.Added(SplineFlags.IsPlanar));
            writer.Write(71, Degree);
            writer.Write(72, Knots.Length);
            writer.Write(73, ControlPoints.Length);
            writer.Write(74, 0); // Number of fit points

            foreach (var knot in Knots)
            {
                writer.Write(40, knot);
            }

            foreach (var point in ControlPoints)
            {
                writer.Write(10, point.X);
                writer.Write(20, point.Y);
                writer.Write(30, 0.0);
            }

            bool saveWeights = Weights?.Any(w => w.IsEqual(1.0, 0.0001)) ?? false;

            if (saveWeights)
            {
                foreach (var weight in Weights)
                {
                    writer.Write(41, weight);
                }
            }
        }
Exemple #4
0
        //--------------------------------------------------------------------------------------------------

        internal override void Write(DxfWriter writer)
        {
            // LWPOLYLINE supported by AC1012 or later
            if (writer.Version >= DxfVersion.AC1012)
            {
                writer.Write(0, "LWPOLYLINE");
                writer.WriteHandle();
                writer.WriteSubclass("AcDbEntity");
                writer.Write(8, LayerName);
                writer.WriteSubclass("AcDbPolyline");

                writer.Write(90, Points.Length);
                writer.Write(70, IsClosed ? 1 : 0);

                foreach (var point in Points)
                {
                    writer.Write(10, point.X);
                    writer.Write(20, point.Y);
                    writer.Write(30, 0.0);
                }
            }
            else
            {
                // Version only for AC1009
                writer.Write(0, "POLYLINE");
                writer.WriteHandle();
                writer.Write(8, LayerName);
                writer.Write(66, 1);
                writer.Write(10, 0.0);
                writer.Write(20, 0.0);
                writer.Write(30, 0.0);
                writer.Write(70, IsClosed ? 1 : 0);
                foreach (var point in Points)
                {
                    writer.Write(0, "VERTEX");
                    writer.WriteHandle();
                    writer.Write(8, LayerName);
                    writer.Write(10, point.X);
                    writer.Write(20, point.Y);
                    writer.Write(30, 0.0);
                }
                writer.Write(0, "SEQEND");
            }
        }
Exemple #5
0
        //--------------------------------------------------------------------------------------------------

        internal override void Write(DxfWriter writer)
        {
            writer.Write(0, IsArc ? "ARC" : "CIRCLE");
            writer.WriteHandle();
            writer.WriteSubclass("AcDbEntity");
            writer.Write(8, LayerName);
            writer.WriteSubclass("AcDbCircle");

            writer.Write(10, CenterPoint.X);
            writer.Write(20, CenterPoint.Y);
            writer.Write(30, 0.0);

            writer.Write(40, Radius);

            if (IsArc)
            {
                writer.WriteSubclass("AcDbArc");
                writer.Write(50, StartAngle);
                writer.Write(51, EndAngle);
            }
        }
Exemple #6
0
        //--------------------------------------------------------------------------------------------------

        internal override void Write(DxfWriter writer)
        {
            writer.Write(0, "POLYLINE");
            writer.WriteHandle();
            writer.Write(8, LayerName);
            writer.Write(66, 1);
            writer.Write(10, 0.0);
            writer.Write(20, 0.0);
            writer.Write(30, 0.0);
            writer.Write(70, IsClosed ? 1 : 0);
            foreach (var point in Points)
            {
                writer.Write(0, "VERTEX");
                writer.WriteHandle();
                writer.Write(8, LayerName);
                writer.Write(10, point.X);
                writer.Write(20, point.Y);
                writer.Write(30, 0.0);
            }
            writer.Write(0, "SEQEND");
        }
Exemple #7
0
        //--------------------------------------------------------------------------------------------------

        internal override void Write(DxfWriter writer)
        {
            writer.Write(0, "TEXT");
            writer.WriteHandle();
            writer.WriteSubclass("AcDbEntity");
            writer.Write(8, LayerName);
            writer.WriteSubclass("AcDbText");

            writer.Write(10, Position.X);
            writer.Write(20, Position.Y);
            writer.Write(30, 0.0);

            writer.Write(40, TextHeight);
            writer.Write(1, Text);

            if (TextRotation != 0.0)
            {
                writer.Write(50, Maths.NormalizeAngleRad(TextRotation).ToDeg());
            }

            writer.WriteSubclass("AcDbText");
        }
Exemple #8
0
        //--------------------------------------------------------------------------------------------------

        internal override void Write(DxfWriter writer)
        {
            if (writer.Version < DxfVersion.AC1012)
            {
                return;
            }

            writer.Write(0, "ELLIPSE");
            writer.WriteHandle();
            writer.WriteSubclass("AcDbEntity");
            writer.Write(8, LayerName);
            writer.WriteSubclass("AcDbEllipse");

            writer.Write(10, CenterPoint.X);
            writer.Write(20, CenterPoint.Y);
            writer.Write(30, 0.0);
            writer.Write(11, MajorAxisPointOffset.X);
            writer.Write(21, MajorAxisPointOffset.Y);
            writer.Write(31, 0.0);

            writer.Write(40, Ratio);
            writer.Write(41, StartParameter);
            writer.Write(42, EndParameter);
        }
Exemple #9
0
 internal abstract void Write(DxfWriter writer);
Exemple #10
0
        //--------------------------------------------------------------------------------------------------

        internal override void Write(DxfWriter writer)
        {
            writer.Write(0, "DIMENSION");
            writer.WriteHandle();
            writer.WriteSubclass("AcDbEntity");
            writer.Write(8, LayerName);
            writer.WriteSubclass("AcDbDimension");

            writer.Write(2, BlockName);

            writer.Write(10, RefPoint0.X);
            writer.Write(20, RefPoint0.Y);
            writer.Write(30, 0.0);

            writer.Write(11, RefPoint1E.X);
            writer.Write(21, RefPoint1E.Y);
            writer.Write(31, 0.0);

            writer.Write(70, (int)DimensionType + 32);
            writer.Write(53, Rotation);

            if (!Text.IsNullOrEmpty())
            {
                writer.Write(1, Text);
            }

            writer.Write(3, "Standard");

            if (writer.Version >= DxfVersion.AC1012)
            {
                writer.Write(71, 5); // Attachment point: Middle center
            }

            if (DimensionType is Type.Linear or Type.Aligned)
            {
                writer.WriteSubclass("AcDbAlignedDimension");

                writer.Write(13, RefPoint3.X);
                writer.Write(23, RefPoint3.Y);
                writer.Write(33, 0.0);

                writer.Write(14, RefPoint4.X);
                writer.Write(24, RefPoint4.Y);
                writer.Write(34, 0.0);
            }

            if (DimensionType is Type.Angular3Point)
            {
                writer.WriteSubclass("AcDb3PointAngularDimension");

                writer.Write(13, RefPoint3.X);
                writer.Write(23, RefPoint3.Y);
                writer.Write(33, 0.0);

                writer.Write(14, RefPoint4.X);
                writer.Write(24, RefPoint4.Y);
                writer.Write(34, 0.0);

                writer.Write(15, RefPoint5.X);
                writer.Write(25, RefPoint5.Y);
                writer.Write(35, 0.0);

                writer.Write(16, RefPoint6.X);
                writer.Write(26, RefPoint6.Y);
                writer.Write(36, 0.0);
            }
        }