//-------------------------------------------------------------------------------------------------- void _AddLineSegment(SketchSegmentLine lineSegment) { var p1 = _Sketch.Points[lineSegment.StartPoint]; var p2 = _Sketch.Points[lineSegment.EndPoint]; var entity = new DxfDomLine("0", p1, p2); _Document.Entities.Add(entity); }
//-------------------------------------------------------------------------------------------------- void _AddLine(Geom2d_Line line, double first, double last) { var start = line.Value(first); var end = line.Value(last); var entity = new DxfDomLine(_CurrentLayer, start, end); _Document.Entities.Add(entity); }
//-------------------------------------------------------------------------------------------------- void _ImportLine(DxfDomLine dxfLine) { var startIndex = _AddPoint(dxfLine.StartPoint); var endIndex = _AddPoint(dxfLine.EndPoint); if (startIndex != endIndex) { _Segments.Add(new SketchSegmentLine(startIndex, endIndex)); } }
//-------------------------------------------------------------------------------------------------- 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}."); } } }