CADPolyLine CADVertex
Posted: 17 May 2020, 12:40
Hello, in a CADPolyLine figure with Vertex close, how can I identify the CADVertex that is selected by the user
CADSoftTools - AutoCAD DWG DXF HPGL (PLT) SVG CGM STEP IGES STL SAT viewers, converters and developer tools. Delphi and C# source code.
https://cadsofttools.com/forum/
Code: Select all
cadEditorControl1.EditorCADPictureBox.MouseDown += EditorCADPictureBox_MouseDown;
...
void EditorCADPictureBox_MouseDown(object sender, MouseEventArgs e)
{
CADVertex result = new CADVertex();
result.Point = new DPoint(0, 0, 0);
DPoint point = cadEditorControl1.GetRealPoint(e.X, e.Y, false, true);
cadEditorControl1.Image.Selector.UseShiftToAddSelected = true;
CADEntity entity = cadEditorControl1.Image.Selector.SelectExt(e.X, e.Y, false, true);
if (entity.EntType == EntityType.Polyline)
{
CADPolyLine polyline = entity as CADPolyLine;
foreach (CADVertex vx in polyline.Vertexes)
{
DPoint vxPoint = vx.Point;
vxPoint.X = Math.Round(vx.Point.X, 4);
vxPoint.Y = Math.Round(vx.Point.Y, 4);
if (vxPoint.Equals(point))
{
result = vx;
break;
}
}
}
}