Evgeniytti, пример построения ЛСК из документа источник в документ назначения:
Код |
---|
using TFlex.Model;
using TFlex.Model.Model3D;
namespace Test
{
public class MigrateLCS
{
public static void Run()
{
Document document_1 = TFlex.Application.OpenDocument(@"E:\net\Documents\T-FLEX\tf16_test\test_lcs_1.grb", false);
Document document_2 = TFlex.Application.OpenDocument(@"E:\net\Documents\T-FLEX\tf16_test\test_lcs_2.grb", false);
ProcessingDocument(document_1, document_2);
document_1.Close();
document_2.Close();
}
private static void ProcessingDocument(Document source, Document destination)
{
if (source == null || destination == null)
return;
foreach (var i in Document3D.GetLCSs(source)) // получаем ЛСК исходного документа
{
foreach (var j in i.Parents)
{
if (j.Object is Node3D node3D) // получаем 3D-узел для построения ЛСК
{
destination.BeginChanges("перенос ЛСК");
// создаем новый 3D-узел
CoordinateNode3D node = new CoordinateNode3D(destination)
{
Name = node3D.Name,
X = node3D.Geometry.Point.X,
Y = node3D.Geometry.Point.Y,
Z = node3D.Geometry.Point.Z,
};
// создаем новую ЛСК
PointsLCS lcs = new PointsLCS(destination)
{
Name = i.Name,
PointToOrigin = node.Geometry.Point
};
destination.EndChanges();
destination.Save();
}
}
}
}
}
}
|