public void DrawPolygon() { int sides; Point3d basePt, endPt; Double apo; if (Selector.Point("Selecciona el centro del poligono", out basePt) && Selector.Point("Selecciona el punto final del apotema", out endPt, basePt) && Selector.Integer("Dame el número de lados", out sides, 3)) { double angle = 2 * Math.PI; double x, y, z = 0; angle = angle / sides; apo = basePt.DistanceTo(endPt); Point3dCollection pts = new Point3dCollection(); for (int i = 0; i < sides; i++) { x = basePt.X + apo * Math.Cos(angle * i); y = basePt.Y + apo * Math.Sin(angle * i); pts.Add(new Point3d(x, y, z)); } TransactionWrapper t = new TransactionWrapper(); t.Run(DrawPolygon, new Object[] { pts }); } }
public void DrawCircle() { Point3d center, endPt; Double radio; if (Selector.Point("Selecciona el centro del punto", out center) && Selector.Point("Selecciona el punto final del radio", out endPt, center)) { radio = center.DistanceTo(endPt); TransactionWrapper t = new TransactionWrapper(); t.Run(DrawCircleTask, new Object[] { center, radio }); } }
public void InsertBlock() { System.Windows.Forms.OpenFileDialog dia = new System.Windows.Forms.OpenFileDialog(); dia.Multiselect = false; dia.Filter = "Blocks (*.dwg)|*.dwg"; if (dia.ShowDialog() == System.Windows.Forms.DialogResult.OK && dia.FileName != null && dia.FileName.Length > 0) { string pth = dia.FileName; Point3d insPt; if (Selector.Point("Selecciona el punto de inserción del bloque", out insPt)) { TransactionWrapper tr = new TransactionWrapper(); tr.Run(InsertarBloqueTask, new Object[] { pth, insPt }); } } }
public void DrawPyramid() { Point3d o; Double n, h; if (Selector.Point("Selecciona el centro de la piramide", out o) && Selector.Double("Dame el tamaño de la base", out n) && Selector.Double("Dame el tamaño de la altura", out h)) { Point3d[] pts = new Point3d[] { o + new Vector3d(-n / 2, -n / 2, 0), o + new Vector3d(n / 2, -n / 2, 0), o + new Vector3d(n / 2, n / 2, 0), o + new Vector3d(-n / 2, n / 2, 0), o + new Vector3d(0, 0, h) }; TransactionWrapper tr = new TransactionWrapper(); tr.Run(DrawPyramidTask, new Object[] { pts }); } }
public void DrawPyramid() { Point3d o; Double n, h; if (Selector.Point("Seleciona el centro de la base", out o) && Selector.Double("Dame las dimensiones del lado de la base", out n) && Selector.Double("Dame la altura de la piramide", out h)) { Point3d[] pts = new Point3d[] { o + new Vector3d(-n / 2, -n / 2, 0), o + new Vector3d(n / 2, -n / 2, 0), o + new Vector3d(n / 2, n / 2, 0), o + new Vector3d(-n / 2, n / 2, 0), o + new Vector3d(0, 0, h) }; TransactionWrapper t = new TransactionWrapper(); t.Run(DrawPyramid, new Object[] { pts }); } }