48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using WW.Cad.Model;
|
|
using WW.Cad.Model.Entities;
|
|
using WW.Cad.IO;
|
|
using MathNet.Numerics.LinearAlgebra;
|
|
|
|
namespace TransmissionGraphic.Graphic
|
|
{
|
|
class Canvas
|
|
{
|
|
private DxfModel _model;
|
|
public Canvas()
|
|
{
|
|
this._model = null;
|
|
}
|
|
|
|
public void init_canvas()
|
|
{
|
|
DxfModel model = new DxfModel(DxfVersion.Dxf13);
|
|
this._model = model;
|
|
}
|
|
|
|
public void draw(Matrix<double> points)
|
|
{
|
|
DxfModel model=this._model;
|
|
DxfPolyline3D polyline = new DxfPolyline3D();
|
|
DxfVertex3D[] vertex = new DxfVertex3D[points.RowCount];
|
|
for (int foo = 0; foo < points.RowCount; foo++)
|
|
{
|
|
vertex[foo] = new DxfVertex3D(points.At(foo, 0), points.At(foo, 1), points.At(foo, 2));
|
|
}
|
|
polyline.Closed = false;
|
|
polyline.Vertices.AddRange(vertex);
|
|
model.Entities.Add(polyline);
|
|
}
|
|
|
|
public void save(string filePath)
|
|
{
|
|
DxfModel model = this._model;
|
|
DxfWriter.Write(filePath, model);
|
|
|
|
}
|
|
}
|
|
}
|