コード例 #1
0
        //--------------------------------------------------------------------------------------------------

        void _ImportPolyline(DxfDomPolyline dxfPolyline)
        {
            if (dxfPolyline.Points.Length == 0)
            {
                return;
            }

            var startIndex = _AddPoint(dxfPolyline.Points[0]);

            for (int i = 1; i < dxfPolyline.Points.Length; i++)
            {
                var endIndex = _AddPoint(dxfPolyline.Points[i]);
                _Segments.Add(new SketchSegmentLine(startIndex, endIndex));
                startIndex = endIndex;
            }
        }
コード例 #2
0
        //--------------------------------------------------------------------------------------------------

        void _ReadEntities(DxfReader reader)
        {
            while (reader.GroupCode >= 0)
            {
                if (reader.GroupCode != 0)
                {
                    reader.Skip();
                    continue;
                }

                var type = reader.ReadString()?.ToUpper();
                if (type == null)
                {
                    continue;
                }

                DxfDomEntity entity = null;
                switch (type)
                {
                case "ENDSEC":
                    return;

                case "LINE":
                    entity = new DxfDomLine();
                    break;

                case "CIRCLE":
                case "ARC":
                    entity = new DxfDomCircle();
                    break;

                case "ELLIPSE":
                    entity = new DxfDomEllipse();
                    break;

                case "LWPOLYLINE":
                    entity = new DxfDomLwPolyline();
                    break;

                case "POLYLINE":
                    entity = new DxfDomPolyline();
                    break;

                case "SPLINE":
                    entity = new DxfDomSpline();
                    break;
                }

                if (entity == null)
                {
                    continue;
                }

                if (entity.Read(reader))
                {
                    Entities.Add(entity);
                }
                else
                {
                    Messages.Error($"DxfReader: Incomplete entity description at line {reader.Line}.");
                }
            }
        }