Message 1 of 13
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello friends,
I want to make an addition to this code. In that :
From the first point I clicked, it continues to draw the Polyline without leaving the point...
how can I do that?
Thanks in advance to the helpful friend.
[CommandMethod("HesArea")]
public void AreaCalc()
{
// Prompt the user for 5 points
Document acDoc = Application.DocumentManager.MdiActiveDocument;
PromptPointResult pPtRes;
Point2dCollection colPt = new Point2dCollection();
PromptPointOptions pPtOpts = new PromptPointOptions("");
Application.SetSystemVariable("OSMODE", 32 | 1);
BirimCeviri();
// Prompt for the first point
pPtOpts.Message = "\nİlk nokta > ";
pPtRes = acDoc.Editor.GetPoint(pPtOpts);
colPt.Add(new Point2d(pPtRes.Value.X, pPtRes.Value.Y));
// Exit if the user presses ESC or cancels the command
if (pPtRes.Status == PromptStatus.Cancel) return;
pPtOpts.Message = "\ndiğer nokta >";
pPtOpts.UseBasePoint = true;
pPtOpts.AllowNone = true;
while (true)
{
// Use the previous point as the base point
pPtOpts.BasePoint = pPtRes.Value;
pPtRes = acDoc.Editor.GetPoint(pPtOpts);
// Break the loop if the user does not specify a point
if (pPtRes.Status != PromptStatus.OK)
break;
colPt.Add(new Point2d(pPtRes.Value.X, pPtRes.Value.Y));
}
using (Polyline acPoly = new Polyline())
{
int i = 0;
foreach (Point2d point in colPt)
{
acPoly.AddVertexAt(i, point, 0, 0, 0);
}
// Close the polyline
acPoly.Closed = true;
double al1 = acPoly.Area / Durum.BolenA;
double cv1 = acPoly.Length / Durum.Bolen;
string aLNSonuc = string.Format("\nAlan : {1} Uzunluk : {2}",
Environment.NewLine, al1.ToString("F3") + " m²", cv1.ToString("F3") + " m");
System.Windows.Forms.MessageBox.Show(aLNSonuc, "Sonuç");
YaziOlustur("Alan : " + al1.ToString("F2") + " m² Uzunluk : " + cv1.ToString("F2") + " m");
}
}
Solved! Go to Solution.