private bool CheckPosCount() { string str = txtPosCount.Text; str = str.Replace('x', '*'); str = str.Replace('X', '*'); if (!str.Contains("<>")) { boundDimensions.Clear(); } if (str.Contains("<>") && boundDimensions.Count == 0) { errorProvider.SetError(txtPosCount, "Bağlı ölçü seçilmedi."); errorProvider.SetIconAlignment(txtPosCount, ErrorIconAlignment.MiddleLeft); return(false); } else if (string.IsNullOrEmpty(str) || PosUtility.ValidateFormula(str.Replace("<>", "1"))) { errorProvider.SetError(txtPosCount, ""); return(true); } else { errorProvider.SetError(txtPosCount, "Poz adedi yalnız rakam ve aritmetik işlemler içerebilir."); errorProvider.SetIconAlignment(txtPosCount, ErrorIconAlignment.MiddleLeft); return(false); } }
private bool CheckPosLength(TextBox source) { bool haserror = false; // Split var lengths if (!string.IsNullOrEmpty(source.Text)) { source.Text = source.Text.Replace('-', '~'); string[] strparts = source.Text.Split(new char[] { '~' }, StringSplitOptions.RemoveEmptyEntries); foreach (string str in strparts) { string oldstr = str; oldstr = oldstr.Replace('d', '0'); oldstr = oldstr.Replace('r', '0'); oldstr = oldstr.Replace('x', '*'); oldstr = oldstr.Replace('X', '*'); if (string.IsNullOrEmpty(oldstr)) { haserror = true; break; } else if (!PosUtility.ValidateFormula(oldstr)) { haserror = true; break; } } } if (haserror) { errorProvider.SetError(source, "Parça boyu yalnız rakam ve aritmetik işlemler içerebilir."); errorProvider.SetIconAlignment(source, ErrorIconAlignment.MiddleLeft); return(false); } else { errorProvider.SetError(source, ""); return(true); } }
private bool CheckPosCount() { string str = txtReplaceCount.Text; str = str.Replace('x', '*'); str = str.Replace('X', '*'); if (string.IsNullOrEmpty(str) || PosUtility.ValidateFormula(str)) { errorProvider.SetError(txtReplaceCount, ""); return(true); } else { errorProvider.SetError(txtReplaceCount, "Poz adedi yalnız rakam ve aritmetik işlemler içerebilir."); errorProvider.SetIconAlignment(txtReplaceCount, ErrorIconAlignment.MiddleLeft); return(false); } }
private bool CheckPosLength(TextBox source) { bool isempty = false; bool haserror = false; // Split var lengths if (string.IsNullOrEmpty(source.Text)) { isempty = true; } else { source.Text = source.Text.Replace('-', '~'); string[] strparts = source.Text.Split(new char[] { '~' }, StringSplitOptions.RemoveEmptyEntries); foreach (string str in strparts) { string oldstr = str; oldstr = oldstr.Replace('d', '0'); oldstr = oldstr.Replace('r', '0'); oldstr = oldstr.Replace('D', '0'); oldstr = oldstr.Replace('R', '0'); oldstr = oldstr.Replace('x', '*'); oldstr = oldstr.Replace('X', '*'); if (string.IsNullOrEmpty(oldstr)) { isempty = true; break; } else if (!PosUtility.ValidateFormula(oldstr)) { haserror = true; break; } } } if (isempty) { errorProvider.SetError(source, "Lütfen parça boyunu girin."); errorProvider.SetIconAlignment(source, ErrorIconAlignment.MiddleLeft); return(false); } else if (haserror) { errorProvider.SetError(source, "Parça boyu yalnız rakam ve aritmetik işlemler içerebilir."); errorProvider.SetIconAlignment(source, ErrorIconAlignment.MiddleLeft); return(false); } UpdateLengthResult check = UpdateLength(); if (check == UpdateLengthResult.OK) { errorProvider.SetError(source, ""); SetShape(); return(true); } else { if (check == UpdateLengthResult.ExceedsMaximum) { errorProvider.SetError(source, "Toplam boy maximum demir boyundan büyük olamaz."); } else if (check == UpdateLengthResult.InvalidLength) { errorProvider.SetError(source, "Geçersiz parça boyu."); } else { errorProvider.SetError(source, "Geçersiz boy."); } errorProvider.SetIconAlignment(source, ErrorIconAlignment.MiddleLeft); return(false); } }
public static void DrawShape(PosShape shape, Point3d inspt, double height) { Extents3d?bounds = shape.Bounds; if (!bounds.HasValue) { return; } Point3d p1 = bounds.Value.MinPoint; Point3d p2 = bounds.Value.MaxPoint; double scale = height / (p2.Y - p1.Y); Matrix3d trans = Matrix3d.AlignCoordinateSystem(p1, Vector3d.XAxis, Vector3d.YAxis, Vector3d.ZAxis, inspt, Vector3d.XAxis * scale, Vector3d.YAxis * scale, Vector3d.ZAxis * scale); Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { try { BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite); Point3dCollection vertices = new Point3dCollection(new Point3d[] { new Point3d(p1.X, p1.Y, 0), new Point3d(p2.X, p1.Y, 0), new Point3d(p2.X, p2.Y, 0), new Point3d(p1.X, p2.Y, 0), }); Polyline2d rec = new Polyline2d(Poly2dType.SimplePoly, vertices, 0, true, 0, 0, null); rec.TransformBy(trans); btr.AppendEntity(rec); tr.AddNewlyCreatedDBObject(rec, true); ObjectId hiddenLayer = PosUtility.DefpointsLayer; foreach (PosShape.Shape item in shape.Items) { Entity en = null; if (item is PosShape.ShapeLine) { PosShape.ShapeLine line = (PosShape.ShapeLine)item; en = new Line(new Point3d(line.X1, line.Y1, 0), new Point3d(line.X2, line.Y2, 0)); } else if (item is PosShape.ShapeArc) { PosShape.ShapeArc arc = (PosShape.ShapeArc)item; en = new Arc(new Point3d(arc.X, arc.Y, 0), arc.R, arc.StartAngle, arc.EndAngle); } else if (item is PosShape.ShapeCircle) { PosShape.ShapeCircle circle = (PosShape.ShapeCircle)item; en = new Circle(new Point3d(circle.X, circle.Y, 0), Vector3d.ZAxis, circle.R); } else if (item is PosShape.ShapeText) { PosShape.ShapeText text = (PosShape.ShapeText)item; DBText dbobj = new DBText(); dbobj.TextString = text.Text; dbobj.Position = new Point3d(text.X, text.Y, 0); dbobj.TextStyleId = PosUtility.CreateTextStyle("ShapeDump_" + shape.Name, text.Font, text.Width); dbobj.Height = text.Height; dbobj.WidthFactor = text.Width; dbobj.HorizontalMode = text.HorizontalAlignment; if (text.VerticalAlignment == TextVerticalMode.TextBottom) { dbobj.VerticalMode = TextVerticalMode.TextBase; } else { dbobj.VerticalMode = text.VerticalAlignment; } if (dbobj.HorizontalMode != TextHorizontalMode.TextLeft || dbobj.VerticalMode != TextVerticalMode.TextBase) { dbobj.AlignmentPoint = new Point3d(text.X, text.Y, 0); } en = dbobj; } if (en != null) { en.Color = item.Color; if (!item.Visible) { en.LayerId = hiddenLayer; } en.TransformBy(trans); btr.AppendEntity(en); tr.AddNewlyCreatedDBObject(en, true); } } tr.Commit(); } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show("Error: " + ex.Message, "RebarPos", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } }