mirror of
https://github.com/rumata-ap/AcadToSMath.git
synced 2026-01-11 19:39:48 +03:00
Добавлены функции извлечения данных из dxf-файлов
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
using Autodesk.AutoCAD.Interop;
|
using Autodesk.AutoCAD.Interop;
|
||||||
using Autodesk.AutoCAD.Interop.Common;
|
using Autodesk.AutoCAD.Interop.Common;
|
||||||
|
|
||||||
|
using netDxf;
|
||||||
|
using netDxf.Entities;
|
||||||
|
|
||||||
using SMath.Manager;
|
using SMath.Manager;
|
||||||
using SMath.Math;
|
using SMath.Math;
|
||||||
using SMath.Math.Numeric;
|
using SMath.Math.Numeric;
|
||||||
@@ -12,6 +15,8 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ToolTip;
|
||||||
|
|
||||||
namespace AcadToSMath
|
namespace AcadToSMath
|
||||||
{
|
{
|
||||||
public class AcadToSMath : IPluginHandleEvaluation, IPluginLowLevelEvaluationFast
|
public class AcadToSMath : IPluginHandleEvaluation, IPluginLowLevelEvaluationFast
|
||||||
@@ -63,6 +68,47 @@ namespace AcadToSMath
|
|||||||
new ArgumentInfo(ArgumentSections.String, true),
|
new ArgumentInfo(ArgumentSections.String, true),
|
||||||
new ArgumentInfo(ArgumentSections.RealNumber, true)),
|
new ArgumentInfo(ArgumentSections.RealNumber, true)),
|
||||||
|
|
||||||
|
new TermInfo("GetDxfLines", TermType.Function,
|
||||||
|
"(1:путь к dxf-файлу, 2:слой, 3:масштаб единиц чертежа) - " +
|
||||||
|
"Получает координаты точек отрезков и их длину из dxf-файла, возвращает массив с данными отрезков.",
|
||||||
|
FunctionSections.Files, true,
|
||||||
|
new ArgumentInfo(ArgumentSections.String),
|
||||||
|
new ArgumentInfo(ArgumentSections.String, true),
|
||||||
|
new ArgumentInfo(ArgumentSections.RealNumber, true)),
|
||||||
|
|
||||||
|
new TermInfo("GetDxfPoints", TermType.Function,
|
||||||
|
"(1:путь к dxf-файлу, 2:слой, 3:масштаб единиц чертежа) - " +
|
||||||
|
"Получает координаты точек из dxf-файла, возвращает массив с координатами точек.",
|
||||||
|
FunctionSections.Files, true,
|
||||||
|
new ArgumentInfo(ArgumentSections.String),
|
||||||
|
new ArgumentInfo(ArgumentSections.String, true),
|
||||||
|
new ArgumentInfo(ArgumentSections.RealNumber, true)),
|
||||||
|
|
||||||
|
new TermInfo("GetDxfTextes", TermType.Function,
|
||||||
|
"(1:путь к dxf-файлу, 2:слой, 3:масштаб единиц чертежа) - " +
|
||||||
|
"Получает координаты точек вставки и содержимое однострочных текстов из dxf-файла, возвращает массив с данными текста.",
|
||||||
|
FunctionSections.Files, true,
|
||||||
|
new ArgumentInfo(ArgumentSections.String),
|
||||||
|
new ArgumentInfo(ArgumentSections.String, true),
|
||||||
|
new ArgumentInfo(ArgumentSections.RealNumber, true)),
|
||||||
|
|
||||||
|
new TermInfo("GetDxfCircles", TermType.Function,
|
||||||
|
"(1:путь к dxf-файлу, 2:слой, 3:масштаб единиц чертежа) - " +
|
||||||
|
"Получает координаты центров, площади и диамерты окружностей из dxf-файла, возвращает массив с данными окружностей.",
|
||||||
|
FunctionSections.Files, true,
|
||||||
|
new ArgumentInfo(ArgumentSections.String),
|
||||||
|
new ArgumentInfo(ArgumentSections.String, true),
|
||||||
|
new ArgumentInfo(ArgumentSections.RealNumber, true)),
|
||||||
|
|
||||||
|
new TermInfo("GetDxfPlines", TermType.Function,
|
||||||
|
"(1:путь к dxf-файлу, 2:слой, 3:масштаб единиц чертежа, 4:замкнуть полилинии) - " +
|
||||||
|
"Получает вершины полилиний из dxf-файла, возвращает массив с координатами вершин полилиний.",
|
||||||
|
FunctionSections.Files, true,
|
||||||
|
new ArgumentInfo(ArgumentSections.String),
|
||||||
|
new ArgumentInfo(ArgumentSections.String, true),
|
||||||
|
new ArgumentInfo(ArgumentSections.RealNumber, true),
|
||||||
|
new ArgumentInfo(ArgumentSections.RealNumber, true)),
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,9 +171,6 @@ namespace AcadToSMath
|
|||||||
{
|
{
|
||||||
ms = acApp.ActiveDocument.ModelSpace;
|
ms = acApp.ActiveDocument.ModelSpace;
|
||||||
List<AcadLWPolyline> polylines = new List<AcadLWPolyline>();
|
List<AcadLWPolyline> polylines = new List<AcadLWPolyline>();
|
||||||
List<AcadPoint> points = new List<AcadPoint>();
|
|
||||||
List<AcadCircle> circles = new List<AcadCircle>();
|
|
||||||
List<AcadText> textes = new List<AcadText>();
|
|
||||||
if (lay == "#")
|
if (lay == "#")
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ms.Count; i++)
|
for (int i = 0; i < ms.Count; i++)
|
||||||
@@ -537,10 +580,330 @@ namespace AcadToSMath
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//GetDxfLines
|
||||||
|
if (value.Type == TermType.Function && value.Text == "GetDxfLines")
|
||||||
|
{
|
||||||
|
List<Term> answer = new List<Term>();
|
||||||
|
|
||||||
|
Entry arg1 = Computation.Preprocessing(value.Items[0], context);
|
||||||
|
string filepath = TermsConverter.DecodeText(arg1.Text).Trim('"');
|
||||||
|
int indexOfChar = filepath.IndexOf(':');
|
||||||
|
if (indexOfChar == -1) filepath = Utilites.CurrentPath(context.FileName) + "\\" + filepath;
|
||||||
|
DxfDocument dxf = DxfDocument.Load(filepath);
|
||||||
|
|
||||||
|
string lay = "#";
|
||||||
|
double scale = 1;
|
||||||
|
if (TermsConverter.DecodeText(value.Items[1].Text).Trim('"') != "#") lay = TermsConverter.DecodeText(value.Items[1].Text).Trim('"');
|
||||||
|
if (TermsConverter.DecodeText(value.Items[2].Text).Trim('"') != "#") scale = Utilites.Entry2Double(value.Items[2], context);
|
||||||
|
|
||||||
|
if (dxf.Lines.Count() == 0)
|
||||||
|
{
|
||||||
|
answer.AddRange(TermsConverter.ToTerms("\"Документ не содержит ни одного отрезка на заданном слое\""));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<Line> lines = new List<Line>();
|
||||||
|
foreach (Line item in dxf.Lines)
|
||||||
|
{
|
||||||
|
if (lay != "#" && item.Layer.Name == lay) lines.Add(item);
|
||||||
|
else if (lay == "#") lines.Add(item);
|
||||||
|
else continue;
|
||||||
|
}
|
||||||
|
if (lines.Count == 0)
|
||||||
|
{
|
||||||
|
answer.AddRange(TermsConverter.ToTerms("\"Документ не содержит ни одного отрезка на заданном слое\""));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (Line item in lines)
|
||||||
|
{
|
||||||
|
answer.AddRange(new TNumber(item.StartPoint.X * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(new TNumber(item.StartPoint.Y * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(new TNumber(item.EndPoint.X * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(new TNumber(item.EndPoint.Y * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(new TNumber(Math.Sqrt(Math.Pow(item.EndPoint.X - item.StartPoint.X, 2) +
|
||||||
|
Math.Pow(item.EndPoint.Y - item.StartPoint.Y, 2)) * scale).obj.ToTerms());
|
||||||
|
}
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(lines.Count.ToString()));
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(5.ToString()));
|
||||||
|
answer.Add(new Term(Functions.Mat, TermType.Function, 2 + lines.Count * 5));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//GetDxfPoints
|
||||||
|
if (value.Type == TermType.Function && value.Text == "GetDxfPoints")
|
||||||
|
{
|
||||||
|
List<Term> answer = new List<Term>();
|
||||||
|
|
||||||
|
Entry arg1 = Computation.Preprocessing(value.Items[0], context);
|
||||||
|
string filepath = TermsConverter.DecodeText(arg1.Text).Trim('"');
|
||||||
|
int indexOfChar = filepath.IndexOf(':');
|
||||||
|
if (indexOfChar == -1) filepath = Utilites.CurrentPath(context.FileName) + "\\" + filepath;
|
||||||
|
DxfDocument dxf = DxfDocument.Load(filepath);
|
||||||
|
|
||||||
|
string lay = "#";
|
||||||
|
double scale = 1;
|
||||||
|
if (TermsConverter.DecodeText(value.Items[1].Text).Trim('"') != "#") lay = TermsConverter.DecodeText(value.Items[1].Text).Trim('"');
|
||||||
|
if (TermsConverter.DecodeText(value.Items[2].Text).Trim('"') != "#") scale = Utilites.Entry2Double(value.Items[2], context);
|
||||||
|
|
||||||
|
if (dxf.Lines.Count() == 0)
|
||||||
|
{
|
||||||
|
answer.AddRange(TermsConverter.ToTerms("\"Документ не содержит ни одного отрезка на заданном слое\""));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<Point> lines = new List<Point>();
|
||||||
|
foreach (Point item in dxf.Points)
|
||||||
|
{
|
||||||
|
if (lay != "#" && item.Layer.Name == lay) lines.Add(item);
|
||||||
|
else if (lay == "#") lines.Add(item);
|
||||||
|
else continue;
|
||||||
|
}
|
||||||
|
if (lines.Count == 0)
|
||||||
|
{
|
||||||
|
answer.AddRange(TermsConverter.ToTerms("\"Документ не содержит ни одного отрезка на заданном слое\""));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (Point item in lines)
|
||||||
|
{
|
||||||
|
answer.AddRange(new TNumber(item.Position.X * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(new TNumber(item.Position.Y * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(new TNumber(item.Position.Z * scale).obj.ToTerms());
|
||||||
|
}
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(lines.Count.ToString()));
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(3.ToString()));
|
||||||
|
answer.Add(new Term(Functions.Mat, TermType.Function, 2 + lines.Count * 3));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//GetDxfTextes
|
||||||
|
if (value.Type == TermType.Function && value.Text == "GetDxfTextes")
|
||||||
|
{
|
||||||
|
List<Term> answer = new List<Term>();
|
||||||
|
|
||||||
|
Entry arg1 = Computation.Preprocessing(value.Items[0], context);
|
||||||
|
string filepath = TermsConverter.DecodeText(arg1.Text).Trim('"');
|
||||||
|
int indexOfChar = filepath.IndexOf(':');
|
||||||
|
if (indexOfChar == -1) filepath = Utilites.CurrentPath(context.FileName) + "\\" + filepath;
|
||||||
|
DxfDocument dxf = DxfDocument.Load(filepath);
|
||||||
|
|
||||||
|
string lay = "#";
|
||||||
|
double scale = 1;
|
||||||
|
if (TermsConverter.DecodeText(value.Items[1].Text).Trim('"') != "#") lay = TermsConverter.DecodeText(value.Items[1].Text).Trim('"');
|
||||||
|
if (TermsConverter.DecodeText(value.Items[2].Text).Trim('"') != "#") scale = Utilites.Entry2Double(value.Items[2], context);
|
||||||
|
|
||||||
|
if (dxf.Lines.Count() == 0)
|
||||||
|
{
|
||||||
|
answer.AddRange(TermsConverter.ToTerms("\"Документ не содержит ни одного отрезка на заданном слое\""));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<Text> lines = new List<Text>();
|
||||||
|
foreach (Text item in dxf.Texts)
|
||||||
|
{
|
||||||
|
if (lay != "#" && item.Layer.Name == lay) lines.Add(item);
|
||||||
|
else if (lay == "#") lines.Add(item);
|
||||||
|
else continue;
|
||||||
|
}
|
||||||
|
if (lines.Count == 0)
|
||||||
|
{
|
||||||
|
answer.AddRange(TermsConverter.ToTerms("\"Документ не содержит ни одного отрезка на заданном слое\""));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (Text item in lines)
|
||||||
|
{
|
||||||
|
answer.AddRange(new TNumber(item.Position.X * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(new TNumber(item.Position.Y * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(TermsConverter.ToTerms("\"" + item.Value + "\""));
|
||||||
|
}
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(lines.Count.ToString()));
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(3.ToString()));
|
||||||
|
answer.Add(new Term(Functions.Mat, TermType.Function, 2 + lines.Count * 3));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//GetDxfCircles
|
||||||
|
if (value.Type == TermType.Function && value.Text == "GetDxfCircles")
|
||||||
|
{
|
||||||
|
List<Term> answer = new List<Term>();
|
||||||
|
|
||||||
|
Entry arg1 = Computation.Preprocessing(value.Items[0], context);
|
||||||
|
string filepath = TermsConverter.DecodeText(arg1.Text).Trim('"');
|
||||||
|
int indexOfChar = filepath.IndexOf(':');
|
||||||
|
if (indexOfChar == -1) filepath = Utilites.CurrentPath(context.FileName) + "\\" + filepath;
|
||||||
|
DxfDocument dxf = DxfDocument.Load(filepath);
|
||||||
|
|
||||||
|
string lay = "#";
|
||||||
|
double scale = 1;
|
||||||
|
if (TermsConverter.DecodeText(value.Items[1].Text).Trim('"') != "#") lay = TermsConverter.DecodeText(value.Items[1].Text).Trim('"');
|
||||||
|
if (TermsConverter.DecodeText(value.Items[2].Text).Trim('"') != "#") scale = Utilites.Entry2Double(value.Items[2], context);
|
||||||
|
|
||||||
|
if (dxf.Lines.Count() == 0)
|
||||||
|
{
|
||||||
|
answer.AddRange(TermsConverter.ToTerms("\"Документ не содержит ни одного отрезка на заданном слое\""));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<Text> lines = new List<Text>();
|
||||||
|
foreach (Text item in dxf.Texts)
|
||||||
|
{
|
||||||
|
if (lay != "#" && item.Layer.Name == lay) lines.Add(item);
|
||||||
|
else if (lay == "#") lines.Add(item);
|
||||||
|
else continue;
|
||||||
|
}
|
||||||
|
if (lines.Count == 0)
|
||||||
|
{
|
||||||
|
answer.AddRange(TermsConverter.ToTerms("\"Документ не содержит ни одного отрезка на заданном слое\""));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (Text item in lines)
|
||||||
|
{
|
||||||
|
answer.AddRange(new TNumber(item.Position.X * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(new TNumber(item.Position.Y * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(TermsConverter.ToTerms("\"" + item.Value + "\""));
|
||||||
|
}
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(lines.Count.ToString()));
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(3.ToString()));
|
||||||
|
answer.Add(new Term(Functions.Mat, TermType.Function, 2 + lines.Count * 3));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//GetDxfPlines
|
||||||
|
if (value.Type == TermType.Function && value.Text == "GetDxfPlines")
|
||||||
|
{
|
||||||
|
List<Term> answer = new List<Term>();
|
||||||
|
|
||||||
|
Entry arg1 = Computation.Preprocessing(value.Items[0], context);
|
||||||
|
string filepath = TermsConverter.DecodeText(arg1.Text).Trim('"');
|
||||||
|
int indexOfChar = filepath.IndexOf(':');
|
||||||
|
if (indexOfChar == -1) filepath = Utilites.CurrentPath(context.FileName) + "\\" + filepath;
|
||||||
|
DxfDocument dxf = DxfDocument.Load(filepath);
|
||||||
|
|
||||||
|
string lay = "#";
|
||||||
|
double scale = 1;
|
||||||
|
int isClose = 0;
|
||||||
|
if (TermsConverter.DecodeText(value.Items[1].Text).Trim('"') != "#")
|
||||||
|
{
|
||||||
|
Entry arg = Computation.Preprocessing(value.Items[1], context);
|
||||||
|
lay = TermsConverter.DecodeText(arg.Text).Trim('"');
|
||||||
|
}
|
||||||
|
if (TermsConverter.DecodeText(value.Items[2].Text).Trim('"') != "#") scale = Utilites.Entry2Double(value.Items[2], context);
|
||||||
|
if (TermsConverter.DecodeText(value.Items[3].Text).Trim('"') != "#") isClose = Utilites.Entry2Int(value.Items[3], context);
|
||||||
|
|
||||||
|
if (dxf.Lines.Count() == 0)
|
||||||
|
{
|
||||||
|
answer.AddRange(TermsConverter.ToTerms("\"Документ не содержит ни одной полилинии на заданном слое\""));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<LwPolyline> lines = new List<LwPolyline>();
|
||||||
|
foreach (LwPolyline item in dxf.LwPolylines)
|
||||||
|
{
|
||||||
|
if (lay != "#" && item.Layer.Name == lay) lines.Add(item);
|
||||||
|
else if (lay == "#") lines.Add(item);
|
||||||
|
else continue;
|
||||||
|
}
|
||||||
|
if (lines.Count == 0)
|
||||||
|
{
|
||||||
|
answer.AddRange(TermsConverter.ToTerms("\"Документ не содержит ни одной полилинии на заданном слое\""));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(lines.Count == 1)
|
||||||
|
{
|
||||||
|
LwPolyline item = lines[0];
|
||||||
|
List<LwPolylineVertex> vxs = item.Vertexes;
|
||||||
|
foreach (LwPolylineVertex vx in vxs)
|
||||||
|
{
|
||||||
|
answer.AddRange(new TNumber(vx.Position.X * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(new TNumber(vx.Position.Y * scale).obj.ToTerms());
|
||||||
|
}
|
||||||
|
if (isClose != 0)
|
||||||
|
{
|
||||||
|
answer.AddRange(new TNumber(vxs[0].Position.X * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(new TNumber(vxs[0].Position.Y * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(TermsConverter.ToTerms((vxs.Count + 1).ToString()));
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(2.ToString()));
|
||||||
|
answer.Add(new Term(Functions.Mat, TermType.Function, 4 + vxs.Count * 2));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(vxs.Count.ToString()));
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(2.ToString()));
|
||||||
|
answer.Add(new Term(Functions.Mat, TermType.Function, 2 + vxs.Count * 2));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (LwPolyline item in lines)
|
||||||
|
{
|
||||||
|
List<LwPolylineVertex> vxs = item.Vertexes;
|
||||||
|
foreach (LwPolylineVertex vx in vxs)
|
||||||
|
{
|
||||||
|
answer.AddRange(new TNumber(vx.Position.X * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(new TNumber(vx.Position.Y * scale).obj.ToTerms());
|
||||||
|
}
|
||||||
|
if (isClose != 0)
|
||||||
|
{
|
||||||
|
answer.AddRange(new TNumber(vxs[0].Position.X * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(new TNumber(vxs[0].Position.Y * scale).obj.ToTerms());
|
||||||
|
answer.AddRange(TermsConverter.ToTerms((vxs.Count + 1).ToString()));
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(2.ToString()));
|
||||||
|
answer.Add(new Term(Functions.Mat, TermType.Function, 4 + vxs.Count * 2));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(vxs.Count.ToString()));
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(2.ToString()));
|
||||||
|
answer.Add(new Term(Functions.Mat, TermType.Function, 2 + vxs.Count * 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(1.ToString()));
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(lines.Count.ToString()));
|
||||||
|
answer.Add(new Term(Functions.Mat, TermType.Function, 2 + lines.Count));
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
result = null;
|
result = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,16 +40,19 @@
|
|||||||
<SMathDir Condition=" '$(SMathDir)' == '' ">C:\Program Files (x86)\SMathStudio</SMathDir>
|
<SMathDir Condition=" '$(SMathDir)' == '' ">C:\Program Files (x86)\SMathStudio</SMathDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Autodesk.AutoCAD.Interop">
|
<Reference Include="Autodesk.AutoCAD.Interop, Version=23.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\..\..\..\..\Program Files\Autodesk\AutoCAD 2020\Autodesk.AutoCAD.Interop.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||||
|
<HintPath>bin\Debug\Autodesk.AutoCAD.Interop.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Autodesk.AutoCAD.Interop.Common">
|
<Reference Include="Autodesk.AutoCAD.Interop.Common, Version=23.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\..\..\..\..\Program Files\Autodesk\AutoCAD 2020\Autodesk.AutoCAD.Interop.Common.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||||
|
<HintPath>bin\Debug\Autodesk.AutoCAD.Interop.Common.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="netDxf">
|
<Reference Include="netDxf, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\..\Документы\C#\netDxf.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>bin\Debug\netDxf.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SMath.Controls">
|
<Reference Include="SMath.Controls">
|
||||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\SMath Studio\SMath.Controls.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\Program Files (x86)\SMath Studio\SMath.Controls.dll</HintPath>
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using SMath.Math;
|
using SMath.Math;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Runtime.Remoting.Contexts;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
||||||
|
|
||||||
namespace AcadToSMath
|
namespace AcadToSMath
|
||||||
{
|
{
|
||||||
@@ -46,7 +48,8 @@ namespace AcadToSMath
|
|||||||
|
|
||||||
internal static double[] EntryVec2Arr(Entry vector, Store store)
|
internal static double[] EntryVec2Arr(Entry vector, Store store)
|
||||||
{
|
{
|
||||||
TNumber num = Computation.NumericCalculation(vector, store);
|
Entry arg = Computation.Preprocessing(vector, store);
|
||||||
|
TNumber num = Computation.NumericCalculation(arg, store);
|
||||||
TMatrix matrix = (TMatrix)num.obj;
|
TMatrix matrix = (TMatrix)num.obj;
|
||||||
double[] res = new double[matrix.Length()];
|
double[] res = new double[matrix.Length()];
|
||||||
//for (int i = 0; i < matrix.unit.Length; i++)
|
//for (int i = 0; i < matrix.unit.Length; i++)
|
||||||
@@ -71,7 +74,8 @@ namespace AcadToSMath
|
|||||||
|
|
||||||
internal static double[,] EntryMat2Arr(Entry mat, Store store)
|
internal static double[,] EntryMat2Arr(Entry mat, Store store)
|
||||||
{
|
{
|
||||||
TNumber num = Computation.NumericCalculation(mat, store);
|
Entry arg = Computation.Preprocessing(mat, store);
|
||||||
|
TNumber num = Computation.NumericCalculation(arg, store);
|
||||||
TMatrix matrix = (TMatrix)num.obj;
|
TMatrix matrix = (TMatrix)num.obj;
|
||||||
double[,] res = new double[matrix.unit.GetLength(0), matrix.unit.GetLength(1)];
|
double[,] res = new double[matrix.unit.GetLength(0), matrix.unit.GetLength(1)];
|
||||||
for (int i = 0; i < matrix.unit.GetLength(0); i++)
|
for (int i = 0; i < matrix.unit.GetLength(0); i++)
|
||||||
@@ -86,13 +90,15 @@ namespace AcadToSMath
|
|||||||
|
|
||||||
internal static double Entry2Double(Entry prime, Store store)
|
internal static double Entry2Double(Entry prime, Store store)
|
||||||
{
|
{
|
||||||
TNumber num = Computation.NumericCalculation(prime, store);
|
Entry arg = Computation.Preprocessing(prime, store);
|
||||||
|
TNumber num = Computation.NumericCalculation(arg, store);
|
||||||
return num.obj.ToDouble();
|
return num.obj.ToDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static int Entry2Int(Entry prime, Store store)
|
internal static int Entry2Int(Entry prime, Store store)
|
||||||
{
|
{
|
||||||
TNumber num = Computation.NumericCalculation(prime, store);
|
Entry arg = Computation.Preprocessing(prime, store);
|
||||||
|
TNumber num = Computation.NumericCalculation(arg, store);
|
||||||
return (int)num.obj.ToDouble();
|
return (int)num.obj.ToDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user