private void Delete_Rects(vdDocument doc) { for (int i = 0; i < doc.ActiveLayOut.Entities.Count; i++) { vdRect rec = doc.ActiveLayOut.Entities[i] as vdRect; if (rec != null) { //rec.Deleted = true; //doc.ActiveLayOut.Entities[i].Deleted = true; doc.ActiveLayOut.Entities.RemoveAt(i); i = -1; } } VectorDraw.Professional.Memory.vdMemory.Collect(); }
private vdRect AppendRect(vdDocument document, Box boundingBox, vdLayer layer = null) { var rect = new vdRect { InsertionPoint = new gPoint(boundingBox.Left, boundingBox.Bottom), Width = boundingBox.Width, Height = boundingBox.Height, Layer = layer ?? document.ActiveLayer, LineType = document.LineTypes.DPIDash, PenColor = new vdColor(System.Drawing.Color.Green) }; document.ActiveLayOut.Entities.AddItem(rect); return(rect); }
private void timer1_Tick(object sender, EventArgs e) { if (r1 == null) { return; } timer1.Interval = (int)(MyList.StringToDouble(txt_time) * 1000); r1 = wheels[0]; //if (r1.InsertionPoint.x > 12) //{ // //r1.InsertionPoint.x = 0.0; // //r2.InsertionPoint.x = 0.0; // foreach (var item in wheels) // { // item.InsertionPoint.x = 0.0; // } //} foreach (var item in wheels) { item.InsertionPoint.x = item.InsertionPoint.x + 0.5; item.Update(); if (item.InsertionPoint.x > 11) { item.InsertionPoint.x = 0.0; } } //r1.InsertionPoint.x = r1.InsertionPoint.x + 0.5; //r2.InsertionPoint.x = r2.InsertionPoint.x + 0.5; //r1.Update(); //r2.Update(); VDoc.Redraw(true); }
void Run_MovingLoad() { if (r1 == null) { r1 = new vdRect(VDoc); r1.setDocumentDefaults(); VDoc.ActiveLayOut.Entities.Add(r1); r2 = new vdRect(VDoc); r2.setDocumentDefaults(); VDoc.ActiveLayOut.Entities.Add(r2); wheels = new List <vdRect>(); wheels.Add(r1); wheels.Add(r2); r1 = new vdRect(VDoc); r1.setDocumentDefaults(); VDoc.ActiveLayOut.Entities.Add(r1); r2 = new vdRect(VDoc); r2.setDocumentDefaults(); VDoc.ActiveLayOut.Entities.Add(r2); wheels.Add(r1); wheels.Add(r2); r1 = new vdRect(VDoc); r1.setDocumentDefaults(); VDoc.ActiveLayOut.Entities.Add(r1); r2 = new vdRect(VDoc); r2.setDocumentDefaults(); VDoc.ActiveLayOut.Entities.Add(r2); wheels.Add(r1); wheels.Add(r2); timer1.Interval = 500; } r1 = wheels[0]; r1.InsertionPoint = new gPoint(0, 4 - 0.5); r1.Width = 0.3; r1.Height = 0.1; r2 = wheels[1]; r2.InsertionPoint = new gPoint(0, 4 - 0.5 - 0.3); r2.Width = 0.3; r2.Height = 0.1; r1 = wheels[2]; r1.InsertionPoint = new gPoint(0 - 0.5, 4 - 0.5); r1.Width = 0.3; r1.Height = 0.1; r2 = wheels[3]; r2.InsertionPoint = new gPoint(0 - 0.5, 4 - 0.5 - 0.3); r2.Width = 0.3; r2.Height = 0.1; r1 = wheels[4]; r1.InsertionPoint = new gPoint(0 - 0.5 - 0.5, 4 - 0.5); r1.Width = 0.3; r1.Height = 0.1; r2 = wheels[5]; r2.InsertionPoint = new gPoint(0 - 0.5 - 0.5, 4 - 0.5 - 0.3); r2.Width = 0.3; r2.Height = 0.1; timer1.Start(); }
public void Draw_Plan_Moving_Wheel(vdDocument doc, double height, int load_case, double max_x) { Delete_Rects(doc); double x = (double)(load_case * 0.2); double y = 2.0d + height; vdRect rect = new vdRect(); vdHatchProperties hp = new vdHatchProperties(); hp.SetUnRegisterDocument(doc); hp.FillMode = VectorDraw.Professional.Constants.VdConstFill.VdFillModeSolid; hp.FillColor = new vdColor(Color.Black); #region for loop for (int i = 0; i < list[0].Moving_Wheel[0].List_Distance.Count; i++) { if (x > 0 && x < max_x) { for (int z = 0; z < list.Count; z++) { rect = new vdRect(); rect.SetUnRegisterDocument(doc); rect.setDocumentDefaults(); rect.InsertionPoint = new VectorDraw.Geometry.gPoint(x, y, list[z].Z); rect.Height = height; rect.Width = height + 0.2; rect.HatchProperties = hp; rect.ExtrusionVector = new Vector(0, 1, 0); doc.ActiveLayOut.Entities.AddItem(rect); rect = new vdRect(); rect.SetUnRegisterDocument(doc); rect.setDocumentDefaults(); rect.InsertionPoint = new VectorDraw.Geometry.gPoint(x, y, list[z].Z + list[z].Moving_Wheel[0].Width); rect.Height = height; rect.Width = height + 0.2; rect.HatchProperties = hp; rect.ExtrusionVector = new Vector(0, 1, 0); doc.ActiveLayOut.Entities.AddItem(rect); } } x -= list[0].Moving_Wheel[0].List_Distance.GetDouble(i); } #endregion /* * if (x > 0 && x < max_x) * { * * rect.SetUnRegisterDocument(doc); * rect.setDocumentDefaults(); * rect.InsertionPoint = new VectorDraw.Geometry.gPoint(x, y, list[0].Z); * rect.Height = height; * rect.Width = height; * rect.ExtrusionVector = new Vector(0, 1, 0); * doc.ActiveLayOut.Entities.AddItem(rect); * } * * x -= 3.0; * if (x > 0 && x < max_x) * { * rect = new vdRect(); * rect.SetUnRegisterDocument(doc); * rect.setDocumentDefaults(); * rect.InsertionPoint = new VectorDraw.Geometry.gPoint(x, y, list[0].Z); * rect.Height = height; * rect.Width = height; * rect.ExtrusionVector = new Vector(0, 1, 0); * doc.ActiveLayOut.Entities.AddItem(rect); * } * * x -= 3.0; * * if (x > 0 && x < max_x) * { * rect = new vdRect(); * rect.SetUnRegisterDocument(doc); * rect.setDocumentDefaults(); * rect.InsertionPoint = new VectorDraw.Geometry.gPoint(x, y, list[0].Z); * rect.Height = height; * rect.Width = height; * rect.ExtrusionVector = new Vector(0, 1, 0); * doc.ActiveLayOut.Entities.AddItem(rect); * } * * x -= 4.30; * if (x > 0 && x < max_x) * { * * rect = new vdRect(); * rect.SetUnRegisterDocument(doc); * rect.setDocumentDefaults(); * rect.InsertionPoint = new VectorDraw.Geometry.gPoint(x, y, list[0].Z); * rect.Height = height; * rect.Width = height; * rect.ExtrusionVector = new Vector(0, 1, 0); * doc.ActiveLayOut.Entities.AddItem(rect); * } * * x -= 1.2; * * if (x > 0 && x < max_x) * { * * rect = new vdRect(); * rect.SetUnRegisterDocument(doc); * rect.setDocumentDefaults(); * rect.InsertionPoint = new VectorDraw.Geometry.gPoint(x, y, list[0].Z); * rect.Height = height; * rect.Width = height; * rect.ExtrusionVector = new Vector(0, 1, 0); * doc.ActiveLayOut.Entities.AddItem(rect); * } * x -= 3.2; * if (x > 0 && x < max_x) * { * * rect = new vdRect(); * rect.SetUnRegisterDocument(doc); * rect.setDocumentDefaults(); * rect.InsertionPoint = new VectorDraw.Geometry.gPoint(x, y, list[0].Z); * rect.Height = height; * rect.Width = height; * rect.ExtrusionVector = new Vector(0, 1, 0); * doc.ActiveLayOut.Entities.AddItem(rect); * } * x -= 1.1; * if (x > 0 && x < max_x) * { * * rect = new vdRect(); * rect.SetUnRegisterDocument(doc); * rect.setDocumentDefaults(); * rect.InsertionPoint = new VectorDraw.Geometry.gPoint(x, y, list[0].Z); * rect.Height = height; * rect.Width = height; * rect.ExtrusionVector = new Vector(0, 1, 0); * doc.ActiveLayOut.Entities.AddItem(rect); * } * //for (int i = 0; i < list[0].Moving_Wheel[0].List_Distance; i++) * //{ * // cir = new vdCircle(); * // cir.SetUnRegisterDocument(doc); * // cir.setDocumentDefaults(); * // cir.Center = new VectorDraw.Geometry.gPoint(((double)(load_case * 0.2)) - 3.0, 3, list[0].Z); * // cir.Radius = radius; * // doc.ActiveLayOut.Entities.AddItem(cir); * ////} * * /**/ }
public void Draw_StructureGraph(vdDocument document, int SpanNo, int LoadCase, bool IsShear) { //Jay Shree Krishna //Jay Shree Ganesh document.ActiveLayOut.Entities.RemoveAll(); #region MainLIne vdLine mainLine = new vdLine(); mainLine.SetUnRegisterDocument(document); mainLine.setDocumentDefaults(); mainLine.StartPoint = new gPoint(10.0d, 10.0d); mainLine.EndPoint = new gPoint(30.0d, 10.0d); document.ActiveLayOut.Entities.AddItem(mainLine); #endregion #region Side Line 1 vdLine sideLine1 = new vdLine(); sideLine1.SetUnRegisterDocument(document); sideLine1.setDocumentDefaults(); sideLine1.StartPoint = new gPoint(10, 5); sideLine1.EndPoint = new gPoint(10, 15); document.ActiveLayOut.Entities.AddItem(sideLine1); #endregion #region Side Line 2 vdLine sideLine2 = new vdLine(); sideLine2.SetUnRegisterDocument(document); sideLine2.setDocumentDefaults(); sideLine2.StartPoint = new gPoint(30, 5); sideLine2.EndPoint = new gPoint(30, 15); document.ActiveLayOut.Entities.AddItem(sideLine2); #endregion #region Draw PolyLine vdPolyline pLine = new vdPolyline(); pLine.SetUnRegisterDocument(document); pLine.setDocumentDefaults(); //pLine.VertexList.Add(mainLine.StartPoint); double st, en, highest; st = en = highest = 0.0d; if (IsShear) { highest = MaxShear(SpanNo); } else { highest = MaxMoment(SpanNo); } double xIncr = 0.0d; for (int i = 0; i < list.Count; i++) { if (list[i].SpanNo == SpanNo) { if (IsShear) { st = list[i].Shear; } else { st = list[i].Moment; } gPoint gp = new gPoint(); gp.x = mainLine.StartPoint.x + xIncr; xIncr += 2.0d; st = -st; if (st > 0) { gp.y = mainLine.StartPoint.y + (sideLine1.EndPoint.y - mainLine.StartPoint.y) * (st / highest); } else { gp.y = mainLine.StartPoint.y - (sideLine1.StartPoint.y - mainLine.StartPoint.y) * (st / highest); } pLine.VertexList.Add(gp); vdLine vLine = new vdLine(); vLine.SetUnRegisterDocument(document); vLine.setDocumentDefaults(); vLine.StartPoint = gp; vLine.EndPoint = new gPoint(gp.x, mainLine.StartPoint.y); document.ActiveLayOut.Entities.AddItem(vLine); vdText yValue = new vdText(); yValue.SetUnRegisterDocument(document); yValue.setDocumentDefaults(); yValue.InsertionPoint = vLine.EndPoint; yValue.TextString = st.ToString(); if (st > 0) { yValue.Rotation = 270.0d * Math.PI / 180.0d; yValue.InsertionPoint.x -= 0.25d; yValue.InsertionPoint.y -= 0.5d; } else { yValue.Rotation = 90.0d * Math.PI / 180.0d; yValue.InsertionPoint.x += 0.25d; yValue.InsertionPoint.y += 0.5d; } yValue.Height = 1.0d; document.ActiveLayOut.Entities.AddItem(yValue); } } document.ShowUCSAxis = false; document.ActiveLayOut.Entities.AddItem(pLine); //if (st > 0) //{ // beamLine.StartPoint.x = midLine.StartPoint.x + (line1.EndPoint.x - midLine.StartPoint.x) * (st / highest); // beamLine.StartPoint.y = midLine.StartPoint.y + (line1.EndPoint.y - midLine.StartPoint.y) * (st / highest); // beamLine.StartPoint.z = midLine.StartPoint.z + (line1.EndPoint.z - midLine.StartPoint.z) * (st / highest); //} //else //{ // beamLine.StartPoint.x = midLine.StartPoint.x - (line1.StartPoint.x - midLine.StartPoint.x) * (st / highest); // beamLine.StartPoint.y = midLine.StartPoint.y - (line1.StartPoint.y - midLine.StartPoint.y) * (st / highest); // beamLine.StartPoint.z = midLine.StartPoint.z - (line1.StartPoint.z - midLine.StartPoint.z) * (st / highest); //} //if (en > 0) //{ // beamLine.EndPoint.x = midLine.EndPoint.x + (line2.EndPoint.x - midLine.EndPoint.x) * (en / highest); // beamLine.EndPoint.y = midLine.EndPoint.y + (line2.EndPoint.y - midLine.EndPoint.y) * (en / highest); // beamLine.EndPoint.z = midLine.EndPoint.z + (line2.EndPoint.z - midLine.EndPoint.z) * (en / highest); //} //else //{ // beamLine.EndPoint.x = midLine.EndPoint.x - (line2.StartPoint.x - midLine.EndPoint.x) * (en / highest); // beamLine.EndPoint.y = midLine.EndPoint.y - (line2.StartPoint.y - midLine.EndPoint.y) * (en / highest); // beamLine.EndPoint.z = midLine.EndPoint.z - (line2.StartPoint.z - midLine.EndPoint.z) * (en / highest); //} #endregion #region Draw Rectangle vdRect rect = new vdRect(); rect.SetUnRegisterDocument(document); rect.setDocumentDefaults(); rect.InsertionPoint = new gPoint(sideLine1.StartPoint.x - 2, sideLine1.StartPoint.y - 2); rect.Width = 23.0d; rect.Height = 13.0d; document.ActiveLayOut.Entities.AddItem(rect); #endregion document.Redraw(true); VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VTop(document); }
public static void DrawHrdrographFromDataFile(string data_file, vdDocument vdDoc) { List <HydroData> list_hydro_coll = new List <HydroData>(); MyStrings mlist = null; List <string> file_content = new List <string>(File.ReadAllLines(data_file)); string kStr = ""; HydroData hdr = null; vdMText mtext = null; vdPolyline pl = null; vdCircle cir = null; vdRect rect = null; double min_x, min_y; double max_x, max_y; min_x = double.MaxValue; min_y = min_x; max_x = double.MinValue; max_y = max_x; bool flag = false; double min_foundation_Level = 0.0, Max_Scour_Depth = 0.0; foreach (var item in file_content) { kStr = item.Replace(",", " "); kStr = item.Replace("=", " "); kStr = MyStrings.RemoveAllSpaces(kStr.ToUpper()); mlist = new MyStrings(kStr, ' '); if (kStr.ToUpper().Contains("DISTANCE")) { flag = true; } if (mlist.StringList[0] == "MIN_FOUNDATION_LEVEL") { min_foundation_Level = mlist.GetDouble(1); } if (mlist.StringList[0] == "MAXIMUM_SCOUR_DEPTH") { Max_Scour_Depth = mlist.GetDouble(1); } //sw.WriteLine("MIN_FOUNDATION_LEVEL = {0}", min_foundation_Level); //sw.WriteLine("MAXIMUM_SCOUR_DEPTH = {0}", Max_Scour_Depth); if (flag == false) { continue; } try { hdr = new HydroData(); hdr.SerialNo = list_hydro_coll.Count + 1; hdr.Distance = mlist.GetDouble(0, -999.0); if (hdr.Distance == -999.0) { throw (new Exception()); } hdr.WaterLevel = mlist.GetDouble(1); list_hydro_coll.Add(hdr); if (min_x > hdr.Distance) { min_x = hdr.Distance; } if (min_y > hdr.WaterLevel) { min_y = hdr.WaterLevel; } if (max_x < hdr.Distance) { max_x = hdr.Distance; } if (max_y < hdr.WaterLevel) { max_y = hdr.WaterLevel; } } catch (Exception ex) { } } pl = new vdPolyline(); pl.SetUnRegisterDocument(vdDoc); pl.setDocumentDefaults(); foreach (var item in list_hydro_coll) { cir = new vdCircle(); cir.SetUnRegisterDocument(vdDoc); cir.setDocumentDefaults(); cir.Center = new VectorDraw.Geometry.gPoint(item.Distance, item.WaterLevel); cir.Radius = 0.09; cir.PenColor = new vdColor(Color.GreenYellow); vdDoc.ActiveLayOut.Entities.AddItem(cir); pl.VertexList.Add(cir.Center); } pl.PenColor = new vdColor(Color.Red); vdDoc.ActiveLayOut.Entities.AddItem(pl); vdLine ln_min_found = new vdLine(); ln_min_found.SetUnRegisterDocument(vdDoc); ln_min_found.setDocumentDefaults(); ln_min_found.StartPoint.x = pl.BoundingBox.Left; ln_min_found.StartPoint.y = pl.BoundingBox.Bottom - min_foundation_Level; ln_min_found.EndPoint.x = pl.BoundingBox.Right; ln_min_found.EndPoint.y = pl.BoundingBox.Bottom - min_foundation_Level; vdDoc.ActiveLayOut.Entities.AddItem(ln_min_found); mtext = new vdMText(); mtext.SetUnRegisterDocument(vdDoc); mtext.setDocumentDefaults(); mtext.InsertionPoint.x = ln_min_found.StartPoint.x; mtext.InsertionPoint.y = ln_min_found.StartPoint.y - 0.2; mtext.Height = 0.3; //mtext.Rotation = 90 * Math.PI / 180.0; mtext.TextString = "Depth from LBL to minimum Foundation Level = " + min_foundation_Level.ToString("0.0000"); mtext.PenColor = new vdColor(Color.Cyan); vdDoc.ActiveLayOut.Entities.AddItem(mtext); vdLine ln_max_scour = new vdLine(); ln_max_scour.SetUnRegisterDocument(vdDoc); ln_max_scour.setDocumentDefaults(); ln_max_scour.StartPoint.x = pl.BoundingBox.Left; ln_max_scour.StartPoint.y = pl.BoundingBox.Bottom - Max_Scour_Depth; ln_max_scour.EndPoint.x = pl.BoundingBox.Right; ln_max_scour.EndPoint.y = pl.BoundingBox.Bottom - Max_Scour_Depth; vdDoc.ActiveLayOut.Entities.AddItem(ln_max_scour); mtext = new vdMText(); mtext.SetUnRegisterDocument(vdDoc); mtext.setDocumentDefaults(); mtext.InsertionPoint = ln_max_scour.StartPoint; mtext.InsertionPoint.y -= 0.2; mtext.Height = 0.3; //mtext.Rotation = 90 * Math.PI / 180.0; mtext.TextString = "Maximum Scour Depth obtained = " + Max_Scour_Depth.ToString("0.0000"); mtext.PenColor = new vdColor(Color.Cyan); vdDoc.ActiveLayOut.Entities.AddItem(mtext); //Maximum Scour Depth adopted = //Depth from LBL to minimum Foundation Level //vdRect rect = null; rect = new vdRect(); rect.SetUnRegisterDocument(vdDoc); rect.setDocumentDefaults(); rect.InsertionPoint.x = pl.BoundingBox.Left - 2; if (min_foundation_Level > Max_Scour_Depth) { rect.InsertionPoint.y = pl.BoundingBox.Bottom - 2 - min_foundation_Level; } else { rect.InsertionPoint.y = pl.BoundingBox.Bottom - 2 - Max_Scour_Depth; } rect.Width = pl.BoundingBox.Width + 4; //rect.Height = -pl.BoundingBox.Height; rect.Height = -2; vdDoc.ActiveLayOut.Entities.AddItem(rect); vdLine ln = new vdLine(); ln.SetUnRegisterDocument(vdDoc); ln.setDocumentDefaults(); ln.StartPoint.x = rect.BoundingBox.Left; ln.StartPoint.y = rect.BoundingBox.Bottom + 1; ln.EndPoint.x = rect.BoundingBox.Right; ln.EndPoint.y = rect.BoundingBox.Bottom + 1; vdDoc.ActiveLayOut.Entities.AddItem(ln); foreach (var item in list_hydro_coll) { mtext = new vdMText(); mtext.SetUnRegisterDocument(vdDoc); mtext.setDocumentDefaults(); mtext.InsertionPoint.x = item.Distance; mtext.InsertionPoint.y = ln.BoundingBox.Bottom + 0.2; mtext.Height = 0.1; mtext.Rotation = 90 * Math.PI / 180.0; mtext.TextString = item.WaterLevel.ToString("0.0000"); mtext.PenColor = new vdColor(Color.Cyan); vdDoc.ActiveLayOut.Entities.AddItem(mtext); mtext = new vdMText(); mtext.SetUnRegisterDocument(vdDoc); mtext.setDocumentDefaults(); mtext.InsertionPoint.x = item.Distance; mtext.InsertionPoint.y = rect.BoundingBox.Bottom + 0.2; mtext.Height = 0.1; mtext.Rotation = 90 * Math.PI / 180.0; mtext.TextString = item.Distance.ToString("0.0000"); mtext.PenColor = new vdColor(Color.LightGreen); vdDoc.ActiveLayOut.Entities.AddItem(mtext); } mtext = new vdMText(); mtext.SetUnRegisterDocument(vdDoc); mtext.setDocumentDefaults(); mtext.InsertionPoint.x = rect.BoundingBox.Left + 0.2; mtext.InsertionPoint.y = rect.BoundingBox.Top + 0.2; mtext.Height = 0.11; //mtext.Rotation = 90 * Math.PI / 180.0; mtext.TextString = "DATUM = " + rect.BoundingBox.Top.ToString("0.00"); vdDoc.ActiveLayOut.Entities.AddItem(mtext); mtext = new vdMText(); mtext.SetUnRegisterDocument(vdDoc); mtext.setDocumentDefaults(); mtext.InsertionPoint.x = rect.BoundingBox.Left + 0.2; mtext.InsertionPoint.y = ln.BoundingBox.Bottom + 0.5; mtext.Height = 0.1; //mtext.Rotation = 90 * Math.PI / 180.0; mtext.TextString = "RIVER BED LEVEL (m)"; mtext.PenColor = new vdColor(Color.Cyan); vdDoc.ActiveLayOut.Entities.AddItem(mtext); mtext = new vdMText(); mtext.SetUnRegisterDocument(vdDoc); mtext.setDocumentDefaults(); mtext.InsertionPoint.x = rect.BoundingBox.Left + 0.2; mtext.InsertionPoint.y = rect.BoundingBox.Bottom + 0.5; mtext.Height = 0.1; //mtext.Rotation = 90 * Math.PI / 180.0; mtext.TextString = "DISTANCE (m)"; mtext.PenColor = new vdColor(Color.LightGreen); vdDoc.ActiveLayOut.Entities.AddItem(mtext); ln = new vdLine(); ln.SetUnRegisterDocument(vdDoc); ln.setDocumentDefaults(); ln.StartPoint.x = rect.BoundingBox.Left + 1.8; ln.StartPoint.y = rect.BoundingBox.Bottom; ln.EndPoint.x = rect.BoundingBox.Left + 1.8; ln.EndPoint.y = rect.BoundingBox.Top; vdDoc.ActiveLayOut.Entities.AddItem(ln); vdRect over_box = new vdRect(); over_box.SetUnRegisterDocument(vdDoc); over_box.setDocumentDefaults(); over_box.InsertionPoint.x = rect.BoundingBox.Left - 2; over_box.InsertionPoint.y = rect.BoundingBox.Bottom - 1; over_box.Width = rect.BoundingBox.Width + 4; over_box.Height = (pl.BoundingBox.Top - rect.BoundingBox.Bottom) + 2; vdDoc.ActiveLayOut.Entities.AddItem(over_box); VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VTop(vdDoc); vdDoc.Redraw(true); }