private vdPolyline CreatePolylineFromPoints(List <PointData> points) { vdPolyline pl = new vdPolyline(); pl.SetUnRegisterDocument(vDraw.ActiveDocument); pl.setDocumentDefaults(); pl.VertexList = Tools.GetVertexesFromPoints(points); vDraw.ActiveDocument.ActiveLayOut.Entities.Add(pl); return(pl); }
private void AddGridPolyline() { if (Grids == null) { return; } foreach (var grid in Grids) { vdPolyline pl = new vdPolyline(); pl.SetUnRegisterDocument(vDraw.ActiveDocument); pl.setDocumentDefaults(); pl.VertexList = Tools.GetVertexesFromCurves(grid.Curves); vDraw.ActiveDocument.ActiveLayOut.Entities.Add(pl); SetEntityLayer(pl, _gGridLayerName); AddXPropertiesToEntity(grid.Properties, pl); AddGridText(pl.getStartPoint(), grid.Name, grid); AddGridText(pl.getEndPoint(), grid.Name, grid); } }
public static void CmdPipe3DFromText(vdDocument doc, string txtFileName) { Color pipeColor = Color.Green; double pipeSize = 100.0d; vdLayer pipeLay = new vdLayer(); pipeLay.Name = "Pipes"; pipeLay.SetUnRegisterDocument(doc); pipeLay.setDocumentDefaults(); doc.Layers.AddItem(pipeLay); doc.ActiveLayer = pipeLay; vdLayer nodeBallLay = new vdLayer(); nodeBallLay.Name = "NodalData"; nodeBallLay.SetUnRegisterDocument(doc); nodeBallLay.setDocumentDefaults(); doc.Layers.AddItem(nodeBallLay); nodeBallLay.PenColor = new vdColor(Color.Red); string fName = txtFileName; ReadPipes(fName); HEADSNeed.DisNet.frmDrawPipe fdp = new HEADSNeed.DisNet.frmDrawPipe(); if (fdp.ShowDialog() == DialogResult.OK) { pipeColor = fdp.PipeColor; pipeSize = fdp.PipeSize; //doc.ActiveLayer.PenColor = new vdColor(pipeColor); pipeLay.PenColor = new vdColor(pipeColor); } else { return; } for (int i = 0; i < lstPipe.Count; i++) { try { DisNetPipe dnPipe = lstPipe[i]; vdCircle cir = new vdCircle(); cir.Center = dnPipe.StartPoint; cir.Radius = dnPipe.Diameter * pipeSize; //cir.Radius = dnPipe.Diameter; cir.ExtrusionVector = Vector.CreateExtrusion(dnPipe.StartPoint, dnPipe.EndPoint); cir.SetUnRegisterDocument(doc); cir.setDocumentDefaults(); cir.Layer = pipeLay; doc.ActionLayout.Entities.AddItem(cir); cir.Thickness = dnPipe.Length; //cir.PenColor = new vdColor(cl); doc.CommandAction.CmdSphere(dnPipe.EndPoint, cir.Radius, 10, 10); doc.ActiveLayer = nodeBallLay; doc.CommandAction.CmdSphere(dnPipe.EndPoint, cir.Radius + 5.0d, 15, 10); doc.ActiveLayer = pipeLay; doc.CommandAction.Zoom("E", 100, 100); if (i == 0) { vdPolyline pline = new vdPolyline(); pline.VertexList.Add(new gPoint(cir.Center.x - 35.0d, cir.Center.y + 25.0d, cir.Center.z)); pline.VertexList.Add(new gPoint(cir.Center.x - 35.0d, cir.Center.y, cir.Center.z)); pline.VertexList.Add(new gPoint(cir.Center.x + 35.0d, cir.Center.y, cir.Center.z)); pline.VertexList.Add(new gPoint(cir.Center.x + 35.0d, cir.Center.y + 25.0d, cir.Center.z)); pline.SetUnRegisterDocument(doc); pline.setDocumentDefaults(); pline.PenColor = new vdColor(Color.LightPink); pline.PenWidth = 2.0d; doc.ActionLayout.Entities.AddItem(pline); vdLine ln = new vdLine(); ln.SetUnRegisterDocument(doc); ln.setDocumentDefaults(); ln.StartPoint = (pline.VertexList[0] + pline.VertexList[1]) / 2; ln.EndPoint = (pline.VertexList[2] + pline.VertexList[3]) / 2; ln.PenColor = new vdColor(Color.LightPink); ln.PenWidth = 2.0d; doc.ActionLayout.Entities.AddItem(ln); vdText tx = new vdText(); tx.SetUnRegisterDocument(doc); tx.setDocumentDefaults(); tx.InsertionPoint = new gPoint(ln.StartPoint.x + 2.0d, ln.StartPoint.y + 3.0d, ln.StartPoint.z); tx.TextString = "SOURCE"; tx.PenColor = new vdColor(Color.LightPink); tx.Height = 10.0d; doc.ActionLayout.Entities.AddItem(tx); } //doc.Redraw(true); } catch (Exception exx) { } } doc.RenderMode = vdRender.Mode.Wire2dGdiPlus; doc.CommandAction.RegenAll(); doc.Redraw(true); }
public void DrawEnvelop(vdDocument doc) { if (Members == null) { Set_Members(); } vdLayer elementLay = new vdLayer(); elementLay.Name = "ENVELOPE"; elementLay.SetUnRegisterDocument(doc); elementLay.setDocumentDefaults(); elementLay.PenColor = new vdColor(Color.DarkGreen); doc.Layers.AddItem(elementLay); doc.Palette.Background = Color.White; VectorDraw.Professional.vdFigures.vdPolyline one3dface = new vdPolyline(); vdLine ln = null; vdMText mtxt = null; one3dface.SetUnRegisterDocument(doc); one3dface.setDocumentDefaults(); VectorDraw.Geometry.gPoint gp = new VectorDraw.Geometry.gPoint(); for (var item = 0; item < Members.Count; item++) { ln = new vdLine(); ln.SetUnRegisterDocument(doc); ln.setDocumentDefaults(); mtxt = new vdMText(); mtxt.SetUnRegisterDocument(doc); mtxt.setDocumentDefaults(); mtxt.HorJustify = VdConstHorJust.VdTextHorCenter; mtxt.Height = 0.3; mtxt.TextString = Forces[item].ToString("f3"); mtxt.Layer = elementLay; gp = new gPoint(); gp.x = (Members[item].StartNode.Point.x + Members[item].EndNode.Point.x) / 2; gp.y = Members[item].StartNode.Point.y; gp.z = Members[item].StartNode.Point.z; ln.StartPoint = gp; gp = new gPoint(); gp.x = (Members[item].StartNode.Point.x + Members[item].EndNode.Point.x) / 2; gp.y = Members[item].EndNode.Point.y + Forces[item] * factor; gp.z = Members[item].StartNode.Point.z; ln.EndPoint = gp; mtxt.InsertionPoint = gp; doc.ActiveLayOut.Entities.AddItem(mtxt); ln.Layer = elementLay; doc.ActiveLayOut.Entities.AddItem(ln); one3dface.VertexList.Add(gp); Members.DrawMember(Members[item], doc); } one3dface.SPlineFlag = VdConstSplineFlag.SFlagFITTING; one3dface.Layer = elementLay; doc.ActiveLayOut.Entities.AddItem(one3dface); //VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_ShadeOn(doc); }
static bool Poly_JoinLinesToPolyline(vdDocument vdoc) { vdoc.Prompt("Select Lines or Polylines to Join:"); vdSelection sel = vdoc.ActionUtility.getUserSelection(); vdFigure vfig; vdPolyline pline = new vdPolyline(); vdLine ln = null; vdPolyline pln = null; double d1, d2; d1 = d2 = 0.0; foreach (vdFigure fig in sel) { if (fig is vdLine) { ln = fig as vdLine; if (pline.VertexList.Count > 0) { d1 = pline.VertexList[pline.VertexList.Count - 1].Distance3D(ln.StartPoint); d2 = pline.VertexList[pline.VertexList.Count - 1].Distance3D(ln.EndPoint); } if (d2 >= d1) { if (pline.VertexList.FindVertexPoint(ln.StartPoint) == -1) { pline.VertexList.Add(ln.StartPoint); } if (pline.VertexList.FindVertexPoint(ln.EndPoint) == -1) { pline.VertexList.Add(ln.EndPoint); } } else { if (pline.VertexList.FindVertexPoint(ln.EndPoint) == -1) { pline.VertexList.Add(ln.EndPoint); } if (pline.VertexList.FindVertexPoint(ln.StartPoint) == -1) { pline.VertexList.Add(ln.StartPoint); } } ln.Deleted = true; //vdoc.ActiveLayOut.Entities.RemoveItem(ln); } else if (fig is vdPolyline) { pln = fig as vdPolyline; if (pline.VertexList.Count > 0) { d1 = pline.VertexList[pline.VertexList.Count - 1].Distance3D(pln.VertexList[0]); d2 = pline.VertexList[pline.VertexList.Count - 1].Distance3D(pln.VertexList[pln.VertexList.Count - 1]); if (d1 > d2) { pln.VertexList.Reverse(); } } pline.VertexList.AddRange(pln.VertexList); pln.Deleted = true; //vdoc.ActiveLayOut.Entities.RemoveItem(pln); } } if (pline.VertexList.Count > 1) { pline.SetUnRegisterDocument(vdoc); pline.setDocumentDefaults(); vdoc.ActiveLayOut.Entities.AddItem(pline); } vdoc.Redraw(true); return(true); }
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); }
/**/ public bool CalculateProgram(string fileName) { bool bSuccess = false; filePath = Path.GetDirectoryName(fileName); StreamWriter sw = new StreamWriter(new FileStream(fileName, FileMode.Create)); StreamWriter filFile = new StreamWriter(new FileStream(Path.Combine(Path.GetDirectoryName(fileName), "DESIGN.FIL"), FileMode.Create)); try { // Step 1 //eH.depth = totalLength = l * 1000 + b1 + b2; double d = (l * 1000 + ((b1 + b2) / 2)) / (20 * 1.5); // eH_depth sw.WriteLine("****************************************************************"); //sw.WriteLine("DESIGN OF SINGLE SPAN ONE WAY RCC SLAB BY WORKING STRESS METHOD"); sw.WriteLine("----------------------------------------------------------------------------------------------"); sw.WriteLine("----------------------------------------------------------------------------------------------"); sw.WriteLine("\t\t\t**********************************************"); sw.WriteLine("\t\t\t* ASTRA Pro Release 2009 *"); sw.WriteLine("\t\t\t* TechSOFT Engineering Services (I) Pvt. Ltd.*"); sw.WriteLine("\t\t\t* *"); sw.WriteLine("\t\t\t* DESIGN OF SINGLE SPAN *"); sw.WriteLine("\t\t\t* ONE WAY RCC SLAB BY WORKING STRESS METHOD *"); sw.WriteLine("\t\t\t**********************************************"); sw.WriteLine("\t\t\t----------------------------------------------"); sw.WriteLine("\t\t\tTHIS RESULT CREATED ON " + System.DateTime.Now.ToString("dd.MM.yyyy AT HH:mm:ss") + " "); sw.WriteLine("\t\t\t----------------------------------------------"); sw.WriteLine(); sw.WriteLine(); sw.WriteLine(); sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("■ Step 1:"); sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine(""); sw.WriteLine("Eff_Depth = (({0} + {1})/20 * 1.5) = {2} mm.", (l * 1000.0d).ToString("0.0"), ((b1 + b2) / 2).ToString("0.0"), d.ToString("0.00")); d = d / 10.0d; d = (double)((int)d) * 10; //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("Let us Provide eff. depth = {0} mm.", d); //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("Using {0}Ø rod and providing a clear cover of {1} mm.", d1, h1); D = d + h1 + (d1 / 2.0d); //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("Provide overall depth = {0} + {1} = {2} mm.", d, (h1 + (d1 / 2)).ToString("0.00"), D); //Step 2 // EH_Span should be the less of the followings l = l * 1000; double EH_Span = l + (b1 / 2.0d) + (b2 / 2.0d); sw.WriteLine(""); sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("■ Step 2:"); sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine(""); sw.WriteLine("Eff Span should be the less of the following :"); double l1 = EH_Span; double l2 = l + d; //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("(i) c/c distance between the support = {0} mm.", l1); //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("(ii) Clear Span + eff. depth of slab = {0} + {1} = {2} mm.", l, d, l2); //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("▲ Provide effective span l = {0} mm.", ((l1 > l2) ? l2 : l1)); //sw.WriteLine("--------------------------------------------------------------------"); // Step 3 // Load calculation Considering 1 m width of the Slab. // Dead Load of the Slab dl = (D / 1000.0d) * gamma_c; sw.WriteLine(""); sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("■ Step 3:"); sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine(""); sw.WriteLine("Load Calculation Considering 1 m width of the slab."); //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("Dead Load of the Slab = {0} * {1} = {2} N/m.", (D / 1000.0).ToString("0.00"), gamma_c, dl); sw.WriteLine("Floor Finish + Ceiling plaster = {0} N/m.", w1); sw.WriteLine("Live Load = {0} N/m.", w2); double w = dl + w1 + w2; //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine(" Total Load w = {0} N/m.", w); // Step 4 //Design Moment M = w*l*l/8 l = l / 1000.0d; double M = w * l * l / 8; double eff_depth_reqd = Math.Sqrt((M * 1000.0d) / (0.848 * 1000.0d)); sw.WriteLine(""); sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("■ Step 4:"); sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine(""); sw.WriteLine("Design moment M = (w*l*l/8) = {0} N-m.", M.ToString("0.00")); //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("Now eff depth reqd. = √(M/Qb) = √({0}/({1}) = {2} mm. ", (M * 1000.0d).ToString("0.00"), (0.848 * 1000.0d).ToString("0.000"), eff_depth_reqd.ToString("0.00")); if (eff_depth_reqd < 90) { sw.WriteLine("So, the eff depth provided is OK.({0} mm < 90 mm)", eff_depth_reqd.ToString("0.00")); } else { sw.WriteLine("So, the eff depth provided is not OK. ({0} mm > 90 mm)", eff_depth_reqd.ToString("0.00")); } // Step 5 // Required Ast double Ast = ((M * 1000.0d) / (sigma_st * 0.87 * d)); double a_st = (Math.PI * (d1 * d1) / 4.0d); double no_rod = Ast / a_st; s1 = (1000.0 * a_st) / Ast; // Spacing int iS1 = (int)(s1 / 10); sw.WriteLine(""); sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("■ Step 5:"); sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine(""); sw.WriteLine("Required Ast = {0} sq.mm.", eff_depth_reqd); //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("No of rod = ({0} / {1} = (Providing {2}Ø rod, c/s area of rod = {1} sq.mm.", Ast, a_st.ToString("0.00"), d1); //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("Spacing = ({0} * {1}) / {2} = {3} mm.", 1000, a_st.ToString("0.00"), Ast.ToString("0.00"), s1.ToString("0.00")); s1 = iS1 * 10.0d; //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("So we shall provide {0}Ø rod @ {1} mm c/c.", d1, s1); if (s1 < 450 && s1 < 3 * d) { //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("So, the eff depth provided is OK.({0} mm < 90 mm)", eff_depth_reqd.ToString("0.00")); } else { //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("So, the eff depth provided is not OK. ({0} mm > 90 mm)", eff_depth_reqd.ToString("0.00")); } //Step 6 dst = (dst * 1000.0 * D / 100.0); sw.WriteLine(""); sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("■ Step 6:"); sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine(""); sw.WriteLine("Area of distribution steal = {0} sq.mm.", dst.ToString("0.00")); double rod_Spacing = ((Math.PI * (d2 * d2) / 4)); rod_Spacing = rod_Spacing * 1000 / Dst; //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("Using {0}Ø rod spacing = {1} c/c", d2, rod_Spacing.ToString("0.00")); iS1 = (int)rod_Spacing / 10; rod_Spacing = iS1 * 10.0d; s2 = rod_Spacing; //sw.WriteLine("--------------------------------------------------------------------"); sw.WriteLine("So we provide distribution steal @ {0} mm c/c.", rod_Spacing.ToString("0.00")); sw.WriteLine(); sw.WriteLine(); sw.WriteLine("****************************************************************"); sw.WriteLine(" ***************** END OF REPORT *************"); sw.WriteLine("****************************************************************"); bSuccess = true; //DrawSlab01((,1000,D,180,170)); //DrawSlab01(totalLength, 1000.0d, D, 180, 170); filFile.WriteLine("SLAB DESIGN"); filFile.WriteLine("100 L = {0} mm; B = {1} m; D = {2} mm", (l * 1000 + b1 + b2).ToString("0.00"), 1000, D.ToString("0.00")); filFile.WriteLine("101 h1 = {0} mm; h2 = {1} mm", h1.ToString("0.00"), h1.ToString("0.00")); filFile.WriteLine("102 d1 = {0} mm; d2 = {1} mm", d1.ToString("0.00"), d2.ToString("0.00")); filFile.WriteLine("103 Gamma_C = {0} mm; Sigma_St = {1} mm", d1.ToString("0.00"), d2.ToString("0.00")); filFile.WriteLine("104 Gc = {0} mm; l = {1} mm", Gc.ToString("0.00"), l.ToString("0.00")); filFile.WriteLine("105 b1 = {0} mm; b2 = {1} mm", b1.ToString("0.00"), l.ToString("0.00")); filFile.WriteLine("ENFORCEMENT BAR"); filFile.WriteLine("B1 = {0} mm; MAIN SPACING = {1} mm; DIST SPACING = {2}", b1.ToString("0.00"), s1.ToString("0.00"), s2.ToString("0.00")); filFile.WriteLine("END"); filFile.Flush(); filFile.Close(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); bSuccess = false; } sw.Flush(); sw.Close(); return(bSuccess); } /**/ public void DrawSlab01(double length, double w, double mainReinforcement, double distReinforcement, double _h1, double _h2) { //length = length - 2 * h1; mainReinforcement = 180; distReinforcement = 170; h1 = _h1; h2 = _h2; length = totalLength - _h1 - _h2; document.ActiveLayOut.Entities.RemoveAll(); int distLineCount = (int)(1000 / distReinforcement); int mainLineCount = (int)(length / mainReinforcement); vdPolyline lenLineBottom = new vdPolyline(); lenLineBottom.SetUnRegisterDocument(document); lenLineBottom.setDocumentDefaults(); lenLineBottom.VertexList.Add(new VectorDraw.Geometry.gPoint(0, 0, 0)); lenLineBottom.VertexList.Add(new VectorDraw.Geometry.gPoint(0, 0, length)); lenLineBottom.VertexList.Add(new VectorDraw.Geometry.gPoint(w, 0, length)); lenLineBottom.VertexList.Add(new VectorDraw.Geometry.gPoint(w, 0, 0)); lenLineBottom.VertexList.Add(new VectorDraw.Geometry.gPoint(0, 0, 0)); document.ActiveLayOut.Entities.AddItem(lenLineBottom); vdPolyline lenLineUp = new vdPolyline(); lenLineUp.SetUnRegisterDocument(document); lenLineUp.setDocumentDefaults(); lenLineUp.VertexList.Add(new VectorDraw.Geometry.gPoint(0, D, 0)); lenLineUp.VertexList.Add(new VectorDraw.Geometry.gPoint(0, D, length)); lenLineUp.VertexList.Add(new VectorDraw.Geometry.gPoint(w, D, length)); lenLineUp.VertexList.Add(new VectorDraw.Geometry.gPoint(w, D, 0)); lenLineUp.VertexList.Add(new VectorDraw.Geometry.gPoint(0, D, 0)); document.ActiveLayOut.Entities.AddItem(lenLineUp); gPoint sPnt, ePnt; // Main Reinforcement sPnt = new gPoint(lenLineBottom.VertexList[0]); ePnt = new gPoint(lenLineBottom.VertexList[1]); //sPnt.z -= h; //ePnt.z -= h; //ePnt.y += h; //sPnt.y += h; for (int i = 0; i <= distLineCount; i++) { vdLine ln = new vdLine(); ln.SetUnRegisterDocument(document); ln.setDocumentDefaults(); //ln.StartPoint = new gPoint(sPnt); //ln.EndPoint = new gPoint(ePnt); ln.StartPoint = new gPoint(sPnt.x + h1, sPnt.y + h1, sPnt.z); ln.EndPoint = new gPoint(ePnt.x + h1, ePnt.y + h1, ePnt.z - h1); document.ActiveLayOut.Entities.AddItem(ln); sPnt.x += mainReinforcement; ePnt.x += mainReinforcement; } //Distribution Reinforcement sPnt = new gPoint(lenLineBottom.VertexList[1]); ePnt = new gPoint(lenLineBottom.VertexList[2]); for (int i = 0; i < mainLineCount; i++) { vdLine ln = new vdLine(); ln.SetUnRegisterDocument(document); ln.setDocumentDefaults(); sPnt.z -= distReinforcement; ePnt.z -= distReinforcement; ln.StartPoint = new gPoint(sPnt.x + h1, sPnt.y + h1, sPnt.z - h1); ln.EndPoint = new gPoint(ePnt.x - h1, ePnt.y + h1, ePnt.z - h1); document.ActiveLayOut.Entities.AddItem(ln); } for (int i = 1; i < lenLineBottom.VertexList.Count; i++) { vdLine ln = new vdLine(); ln.SetUnRegisterDocument(document); ln.setDocumentDefaults(); ln.StartPoint = new gPoint(lenLineBottom.VertexList[i]); ln.EndPoint = new gPoint(lenLineUp.VertexList[i]); document.ActiveLayOut.Entities.AddItem(ln); } //document.SaveAs(Path.Combine(FilePath,"SLAB01_View.dxf")); VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VTop(document); document.Redraw(true); }
private void Fill_Slab(string beam_nos, bool isOk) { MyStrings mlist = new MyStrings(beam_nos.Trim(), ' '); MemberIncidenceCollection mic = new MemberIncidenceCollection(); for (int i = 0; i < mlist.Count; i++) { mic.Add(AST_DOC.Members.Get_Member(mlist.GetInt(i))); } JointCoordinateCollection jntc = new JointCoordinateCollection(); vdPolyline vdpl = new vdPolyline(); vdpl.SetUnRegisterDocument(VDoc); vdpl.setDocumentDefaults(); for (int i = 1; i < mic.Count; i++) { if (mic[i - 1].StartNode == mic[i].StartNode) { if (!jntc.Contains(mic[i].StartNode)) { jntc.Add(mic[i].StartNode); } } else if (mic[i - 1].EndNode == mic[i].StartNode) { if (!jntc.Contains(mic[i].StartNode)) { jntc.Add(mic[i].StartNode); } } else if (mic[i - 1].StartNode == mic[i].EndNode) { if (!jntc.Contains(mic[i].EndNode)) { jntc.Add(mic[i].EndNode); } } else if (mic[i - 1].EndNode == mic[i].EndNode) { if (!jntc.Contains(mic[i].EndNode)) { jntc.Add(mic[i].EndNode); } } else { //string ss = Slab_Data[beam_nos] as string; //if (ss != null) // Slab_Data.Remove(beam_nos); //Save_Data(); MessageBox.Show("Beam " + mic[i].MemberNo + " and Beam " + mic[i - 1].MemberNo + " Joints are mismatch..", "ASTRA", MessageBoxButtons.OK); return; } } if (!jntc.Contains(mic[0].StartNode)) { jntc.Add(mic[0].StartNode); } if (!jntc.Contains(mic[0].EndNode)) { jntc.Add(mic[0].EndNode); } jntc.Add(jntc[0]); double max_z = AST_DOC.Joints.Max_Z_Positive; foreach (var item in jntc) { //vdpl.VertexList.Add(item.Point); vdpl.VertexList.Add(new gPoint(item.X, max_z - item.Z)); } //if (File.Exists(Slab_des.Get_Report_File(beam_nos, cmb_flr_lvl.Text))) //{ // vdpl.ToolTip = File.ReadAllText(Slab_des.Get_Report_File(beam_nos, cmb_flr_lvl.Text)); // vdpl.ToolTip = " //} vdpl.ToolTip = "Member surrounded : " + beam_nos; vdLayer vlay = VDoc.Layers.FindName("slab"); if (vlay == null) { vlay = new vdLayer(VDoc, "slab"); vlay.SetUnRegisterDocument(VDoc); vlay.setDocumentDefaults(); VDoc.Layers.Add(vlay); } //vlay.Frozen = false; //vlay.Lock = true; vdpl.Layer = vlay; //vdpl.PenColor = new vdColor(Color.DarkGray); if (isOk) { vdpl.PenColor = new vdColor(Color.Green); } else { vdpl.PenColor = new vdColor(Color.Red); } vdpl.HatchProperties = new vdHatchProperties(VectorDraw.Professional.Constants.VdConstFill.VdFillModeHatchFDiagonal); //vdpl.ExtrusionVector = new Vector(0.0, 1.0, 0.0); VDoc.ActiveLayOut.Entities.Add(vdpl); VDoc.ActiveLayOut.Entities.ChangeOrder(vdpl, true); VDoc.Redraw(true); }