Untitled
unknown
plain_text
a year ago
2.5 kB
9
Indexable
for (int i = 0; i < Sel.Value.Count; i++)
{
Polyline PL = (Polyline)TransCAD.GetObject(Sel.Value[i].ObjectId, OpenMode.ForWrite);
List<GF_Ponto> ListaPontos = new List<GF_Ponto>();
for (int j = 0; j < PL.NumberOfVertices; j++)
{
Point3d PT = PL.GetPoint3dAt(j);
double Estaca = double.MaxValue;
double Offset = double.MaxValue;
try
{
AL.StationOffset(PT.X, PT.Y, ref Estaca, ref Offset);
}
catch
{
}
if (Estaca != double.MaxValue && Offset != double.MaxValue)
{
double X = 0;
double Y = 0;
AL.PointLocation(Estaca, 0, ref X, ref Y);
if (X > 0 && Y > 0)
{
Point3d PTAlinhamento = new Point3d(X, Y, 0);
double DistVerificar = PTAlinhamento.Convert2d(new Plane()).GetDistanceTo(PT.Convert2d(new Plane()));
if (DistVerificar <= 10)
{
GF_Ponto NovoPonto = new GF_Ponto(PT, Offset, Estaca, PTAlinhamento);
ListaPontos.Add(NovoPonto);
}
}
}
}
ListaPontos.Sort((P1, P2) => P1.Estaca.CompareTo(P2.Estaca));
GF_Ponto PrimeiroPontoLista = ListaPontos.First();
GF_Ponto UltimoPontoLista = ListaPontos.Last();
var PesquisaEstacaInicial = ListaPontos.FindAll((P) => P.Estaca == PrimeiroPontoLista.Estaca);
var PesquisaEstacaFinal = ListaPontos.FindAll((P) => P.Estaca == UltimoPontoLista.Estaca);
if (PesquisaEstacaInicial != null && PesquisaEstacaInicial.Count > 0)
{
PesquisaEstacaInicial.Sort((P1, P2) => P1.DistanciaAlinhamento.CompareTo(P2.DistanciaAlinhamento));
Line L = new Line(PesquisaEstacaInicial[0].PontoNoAlinhamento, PesquisaEstacaInicial[0].Ponto);
Model.AppendEntity(L);
TransCAD.AddNewlyCreatedDBObject(L, true);
}
if (PesquisaEstacaFinal != null && PesquisaEstacaFinal.Count > 0)
{
PesquisaEstacaFinal.Sort((P1, P2) => P1.DistanciaAlinhamento.CompareTo(P2.DistanciaAlinhamento));
Line L = new Line(PesquisaEstacaFinal[0].PontoNoAlinhamento, PesquisaEstacaFinal[0].Ponto);
Model.AppendEntity(L);
TransCAD.AddNewlyCreatedDBObject(L, true);
}
}Editor is loading...
Leave a Comment