Message 1 of 3
Draw rectangle with c#
Not applicable
01-28-2016
02:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys, i'm searching haw to draw a rectangle with this code but can't find anithing.
After the definition of the points of the polyline i don't know how to send the command to draw the rectangle.
public void Trace(int Puissance, string Orientation, string Layer)
{
try
{
object[] objArray = new object[2];
this.acDoc.ActiveLayer = this.acDoc.Layers.Item((object) Layer);
new GetPointCoord.GetPointCoord().GetPoint(this.acDoc, ref objArray[0], ref objArray[1]);
double num1 = this.RecupEchelle(this.acDoc);
double num2;
double num3;
switch (Orientation)
{
case "Verticale":
num2 = num1 * (Math.Log((double) Puissance) / (Math.Log(10.0) * 6.58));
num3 = num1 * (Math.Log((double) Puissance) / (Math.Log(10.0) * 3.15));
break;
case "Horizontale":
num3 = num1 * (Math.Log((double) Puissance) / (Math.Log(10.0) * 6.58));
num2 = num1 * (Math.Log((double) Puissance) / (Math.Log(10.0) * 3.15));
break;
default:
num3 = num1 * (Math.Log((double) Puissance) / (Math.Log(10.0) * 6.58));
num2 = num1 * (Math.Log((double) Puissance) / (Math.Log(10.0) * 3.15));
break;
}
this.acDoc.ModelSpace.AddLightWeightPolyline((object) new double[10]
{
(double) objArray[0] - num2 / 2.0,
(double) objArray[1] + num3 / 2.0,
(double) objArray[0] + num2 / 2.0,
(double) objArray[1] + num3 / 2.0,
(double) objArray[0] + num2 / 2.0,
(double) objArray[1] - num3 / 2.0,
(double) objArray[0] - num2 / 2.0,
(double) objArray[1] - num3 / 2.0,
(double) objArray[0] - num2 / 2.0,
(double) objArray[1] + num3 / 2.0
}).Closed = true;
acDoc.Application.Update();
}
catch (System.Exception ex)
{
int num = (int) MessageBox.Show(ex.Message);
}
}