public void DrawMember(MemberIncidence mi, vdDocument doc, double txtSize) { double length, factor; doc.Palette.Background = Color.White; vdLine line = new vdLine(); vdText vtxtMemberNo = new vdText(); line.SetUnRegisterDocument(doc); line.setDocumentDefaults(); vtxtMemberNo.SetUnRegisterDocument(doc); vtxtMemberNo.setDocumentDefaults(); line.PenColor = new vdColor(Color.Black); line.Layer = doc.Layers[0]; doc.Layers[0].Frozen = false; line.StartPoint = mi.StartNode.Point; line.EndPoint = mi.EndNode.Point; line.ToolTip = string.Format("Member No : {0} [Nodes ({1}, {2})]", mi.MemberNo, mi.StartNode.NodeNo, mi.EndNode.NodeNo); doc.ActionLayout.Entities.AddItem(line); length = line.Length(); //factor = 22.2222d; //factor = length / 0.9d; //txtSize = length / factor; //txtSize = GetTextSize(); vtxtMemberNo.TextString = mi.MemberNo.ToString(); vtxtMemberNo.Layer = membersLay; vtxtMemberNo.Height = txtSize; vtxtMemberNo.PenColor = new vdColor(Color.Blue); vtxtMemberNo.InsertionPoint = (mi.StartNode.Point + mi.EndNode.Point) / 2; vtxtMemberNo.Layer = membersLay; vtxtMemberNo.ToolTip = string.Format("Member No : {0} [Nodes ({1}, {2})]", mi.MemberNo, mi.StartNode.NodeNo, mi.EndNode.NodeNo); doc.ActionLayout.Entities.AddItem(vtxtMemberNo); //doc.ZoomAll(); //doc.Redraw(true); }
public void DrawPipeDetails(vdDocument doc, DisNetPipeDetails pipeDetails) { //Pipe = 1 //Length = 195.185 m. //Diameter = 0.15 m. //Discharge = 0.0228 m3/s. //POINTS = 54020.713,50675.57,99.228 string txtStr = ""; txtStr = "Pipe = " + pipeDetails.PipeNo.ToString() + "\n\r" + "Length = " + pipeDetails.Length.ToString("0.000") + " m." + "\n\r" + "Diameter = " + pipeDetails.Diameter.ToString("0.00") + " m3/s." + "\n\r" + "Discharge = " + pipeDetails.Discharge.ToString("0.0000") + " m." + "\n\r"; txtStr = "Pipe No: " + pipeDetails.PipeNo.ToString(); vdText txt = new vdText(); txt.Style = new vdTextstyle(); txt.TextString = "Pipe No: " + pipeDetails.PipeNo.ToString(); txt.SetUnRegisterDocument(doc); txt.setDocumentDefaults(); txt.Height = 5.0d; txt.InsertionPoint = new gPoint(pipeDetails.Point.x, pipeDetails.Point.y, pipeDetails.Point.z + 15.0d); //txt.PenColor = new vdColor(Color.Red); txt.Layer = doc.Layers.FindName("PipeData"); doc.ActiveLayOut.Entities.AddItem(txt); }
public void DrawJointsText(vdDocument doc, double txtSize) { nodalLay = doc.Layers.FindName("Nodes"); if (nodalLay == null) { nodalLay = new vdLayer(); nodalLay.Name = "Nodes"; nodalLay.SetUnRegisterDocument(doc); nodalLay.setDocumentDefaults(); doc.Layers.AddItem(nodalLay); } nodalLay.PenColor = new vdColor(Color.Magenta); //nodalLay.PenColor = new vdColor(Color.Green); nodalLay.Update(); for (int i = 0; i < list.Count; i++) { //vdMText vTxt = new vdMText(); //vTxt.SetUnRegisterDocument(doc); //vTxt.setDocumentDefaults(); //vTxt.InsertionPoint = list[i].Point; //vTxt.Height = txtSize; //vTxt.HorJustify = VdConstHorJust.VdTextHorCenter; //vTxt.VerJustify = VdConstVerJust.VdTextVerCen; //vTxt.TextString = list[i].NodeNo.ToString(); //vTxt.Layer = nodalLay; //doc.ActiveLayOut.Entities.AddItem(vTxt); vdText vTxt = new vdText(); vTxt.SetUnRegisterDocument(doc); vTxt.setDocumentDefaults(); vTxt.InsertionPoint = list[i].Point; vTxt.Height = txtSize; //vTxt.HorJustify = VdConstHorJust.VdTextHorCenter; //vTxt.VerJustify = VdConstVerJust.VdTextVerCen; vTxt.TextString = list[i].NodeNo.ToString(); vTxt.ToolTip = string.Format("Joint No : {0} [X:{1:f4}, Y:{2:f4}, Z:{3:f4}", list[i].NodeNo, list[i].Point.x, list[i].Point.y, list[i].Point.z); vTxt.Layer = nodalLay; doc.ActiveLayOut.Entities.AddItem(vTxt); //vdCircle vcir = new vdCircle(); //vcir.SetUnRegisterDocument(doc); //vcir.setDocumentDefaults(); //vcir.Center = list[i].Point; //vcir.Radius = txtSize; //vcir.Layer = nodalLay; //doc.ActiveLayOut.Entities.AddItem(vcir); } doc.Update(); doc.Redraw(true); }
private void AddGridText(gPoint position, string name, GridData grid) { vdText txt = new vdText(); txt.SetUnRegisterDocument(vDraw.ActiveDocument); txt.setDocumentDefaults(); txt.InsertionPoint = position; txt.TextString = name; txt.Height = 500; txt.AlignToView = true; txt.PenColor.ColorIndex = 2; vDraw.ActiveDocument.ActiveLayOut.Entities.Add(txt); SetEntityLayer(txt, _gGridLayerName); AddXPropertiesToEntity(grid.Properties, txt); }
public void DrawNodes(vdDocument doc, DisNetNode nd) { //Node = 1 //Elevation = 99.228 m. //Head = 21.000 m. //POINTS = 54005.587,50772.821,100.228 string txtStr = ""; txtStr = "Node = " + nd.NodeNo.ToString() + "\n\r" + "Elevation = " + nd.Elevation.ToString("0.000") + " m." + "\n\r" + "Head = " + nd.Head.ToString("0.000") + " m." + "\n\r"; txtStr = "Node No: " + nd.NodeNo.ToString(); if (nd.IsPump) { txtStr += " [ PUMP INPUT ]"; } vdText txt = new vdText(); txt.TextString = txtStr; txt.SetUnRegisterDocument(doc); txt.setDocumentDefaults(); txt.Height = 9.0d; txt.InsertionPoint = new gPoint(nd.Point.x, nd.Point.y, nd.Point.z + 15.0d); txt.PenColor = new vdColor(Color.White); txt.Layer = doc.Layers.FindName("NodalData"); doc.ActiveLayOut.Entities.AddItem(txt); //if (nd.IsPump) //{ // vdText pump = new vdText(); // pump.TextString = " [ PUMP INPUT ]"; // pump.SetUnRegisterDocument(doc); // pump.setDocumentDefaults(); // pump.Height = 4.0d; // //pump.InsertionPoint = new gPoint(nd.Point.x + txt.WidthFactor, nd.Point.y, nd.Point.z + 15.0d); // pump.InsertionPoint = new gPoint(nd.Point.x + txt.WidthFactor, nd.Point.y - txt.Height + 5.0d , nd.Point.z + 15.0d); // pump.PenColor = new vdColor(Color.LightSkyBlue); // pump.Layer = doc.Layers.FindName("NodalData"); // doc.ActiveLayOut.Entities.AddItem(pump); //} }
public void DrawLoops(vdDocument doc, DisNetLoop loop) { //Loop = 1 //POINTS = 54098.236595,50363.406415,54098.236595 string txtStr = "Loop No: " + loop.LoopNo.ToString(); vdText txt = new vdText(); txt.TextString = txtStr; txt.SetUnRegisterDocument(doc); txt.setDocumentDefaults(); txt.Height = 15.0d; txt.InsertionPoint = loop.Point; //txt.PenColor = new vdColor(Color.Red); txt.Layer = loopLay; doc.ActiveLayOut.Entities.AddItem(txt); }
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 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 bool ReadLineCoordinates(string fileName, vdDocument doc) { //vdArray<vdLine> line_arr = new vdArray<vdLine>(); List <string> lstStr = new List <string>(File.ReadAllLines(fileName)); string kStr = ""; string option = ""; string SP, EP, TEXT, IP, Height; SP = EP = IP = TEXT = Height = ""; MyStrings mList = null; for (int i = 0; i < lstStr.Count; i++) { kStr = lstStr[i].Trim().TrimEnd().TrimStart(); if (kStr == "VD_LINE") { option = "VD_LINE"; i++; SP = lstStr[i].Replace("SP=", ""); i++; EP = lstStr[i].Replace("EP=", ""); } else if (kStr == "VD_TEXT") { option = "VD_TEXT"; i++; IP = lstStr[i].Replace("IP=", ""); i++; TEXT = lstStr[i].Replace("TEXT=", ""); i++; Height = lstStr[i].Replace("HEIGHT=", ""); } switch (option) { case "VD_LINE": mList = new MyStrings(MyStrings.RemoveAllSpaces(SP), ','); vdLine ln = new vdLine(); ln.SetUnRegisterDocument(doc); ln.setDocumentDefaults(); ln.StartPoint.x = mList.GetDouble(0); ln.StartPoint.y = mList.GetDouble(1); ln.StartPoint.z = mList.GetDouble(2); mList = new MyStrings(MyStrings.RemoveAllSpaces(EP), ','); ln.EndPoint.x = mList.GetDouble(0); ln.EndPoint.y = mList.GetDouble(1); ln.EndPoint.z = mList.GetDouble(2); doc.ActiveLayOut.Entities.AddItem(ln); break; case "VD_TEXT": mList = new MyStrings(MyStrings.RemoveAllSpaces(IP), ','); vdText txt = new vdText(); txt.SetUnRegisterDocument(doc); txt.setDocumentDefaults(); txt.InsertionPoint.x = mList.GetDouble(0); txt.InsertionPoint.y = mList.GetDouble(1); txt.InsertionPoint.z = mList.GetDouble(2); txt.TextString = TEXT; txt.Height = MyStrings.StringToDouble(Height, 0.01); doc.ActiveLayOut.Entities.AddItem(txt); break; } } lstStr.Clear(); //doc.ShowUCSAxis = false; //VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VTop(doc); //doc.Redraw(true); return(true); }
public void DrawMember(MemberIncidence mi, vdDocument doc) { double length, factor, txtSize; doc.Palette.Background = Color.White; vdLine line = new vdLine(); vdText vtxtStartNode = new vdText(); vdText vtxtEndNode = new vdText(); vdText vtxtMemberNo = new vdText(); line.SetUnRegisterDocument(doc); line.setDocumentDefaults(); vtxtStartNode.SetUnRegisterDocument(doc); vtxtStartNode.setDocumentDefaults(); vtxtEndNode.SetUnRegisterDocument(doc); vtxtEndNode.setDocumentDefaults(); vtxtMemberNo.SetUnRegisterDocument(doc); vtxtMemberNo.setDocumentDefaults(); line.PenColor = new vdColor(Color.Black); line.StartPoint = mi.StartNode.Point; line.EndPoint = mi.EndNode.Point; //line.ToolTip = string.Format("Member No : {0} \nStart Node = {1} [X={2}, Y={3}, Z={4}]\nEnd Node = {5} [X={6}, Y={7}, Z={8}]", // mi.MemberNo, // mi.StartNode.NodeNo, // mi.StartNode.Point.x, // mi.StartNode.Point.y, // mi.StartNode.Point.z, // mi.EndNode.NodeNo, // mi.EndNode.Point.x, // mi.EndNode.Point.y, // mi.EndNode.Point.z); line.ToolTip = string.Format("Member No : {0} [Nodes ({1}, {2})]", mi.MemberNo, mi.StartNode.NodeNo, mi.EndNode.NodeNo); doc.ActionLayout.Entities.AddItem(line); // Chiranjit Modified [2010 04 16], Kolkata, TechSOFT object jc_no = hash_joint_no[mi.StartNode.NodeNo]; if (jc_no == null) { hash_joint_no.Add(mi.StartNode.NodeNo, mi.StartNode.NodeNo); vtxtEndNode.ToolTip = string.Format("Node No : {0} [X={1}, Y={2}, Z={3}]", mi.StartNode.NodeNo, mi.StartNode.Point.x, mi.StartNode.Point.y, mi.StartNode.Point.z); doc.ActionLayout.Entities.AddItem(vtxtStartNode); } jc_no = hash_joint_no[mi.EndNode.NodeNo]; if (jc_no == null) { hash_joint_no.Add(mi.EndNode.NodeNo, mi.EndNode.NodeNo); vtxtEndNode.ToolTip = string.Format("Node No : {0} [X={1}, Y={2}, Z={3}]", mi.EndNode.NodeNo, mi.EndNode.Point.x, mi.EndNode.Point.y, mi.EndNode.Point.z); doc.ActionLayout.Entities.AddItem(vtxtEndNode); } //doc.ActionLayout.Entities.AddItem(vtxtStartNode); //doc.ActionLayout.Entities.AddItem(vtxtEndNode); doc.ActionLayout.Entities.AddItem(vtxtMemberNo); length = line.Length(); //factor = 22.2222d; //factor = length / 0.9d; //txtSize = length / factor; txtSize = GetTextSize(); vtxtStartNode.TextString = mi.StartNode.NodeNo.ToString(); vtxtStartNode.Height = txtSize; //vtxtStartNode.Height = 0.9d; //vtxtStartNode.PenColor = new vdColor(Color.Green); vtxtStartNode.InsertionPoint = mi.StartNode.Point; vtxtStartNode.Layer = nodesLay; vtxtEndNode.TextString = mi.EndNode.NodeNo.ToString(); vtxtEndNode.Height = txtSize; //vtxtEndNode.Height = 0.9d; //vtxtEndNode.PenColor = new vdColor(Color.Green); vtxtEndNode.InsertionPoint = mi.EndNode.Point; vtxtEndNode.Layer = nodesLay; vtxtMemberNo.TextString = mi.MemberNo.ToString(); //vtxtMemberNo.Height = 0.9d; vtxtMemberNo.Height = txtSize; vtxtMemberNo.PenColor = new vdColor(Color.Blue); vtxtMemberNo.InsertionPoint = (mi.StartNode.Point + mi.EndNode.Point) / 2; vtxtMemberNo.Layer = membersLay; vtxtMemberNo.ToolTip = string.Format("Member No : {0} [Nodes ({1}, {2})]", mi.MemberNo, mi.StartNode.NodeNo, mi.EndNode.NodeNo); //doc.ZoomAll(); //doc.Redraw(true); }