public frmMemberLoadCase(vdDocument thisDoc, vdDocument memberDoc, vdDocument memberLoadDoc, vdDocument memberJointLoad, ASTRADoc thisAstDoc, Form thisForm, Form memberForm, Form memberLoadForm, Form memberJointLoadForm) { InitializeComponent(); Maindoc = thisDoc; MemberDoc = memberDoc; MemberLoadDoc = memberLoadDoc; MemberJointLoadDoc = memberJointLoad; astDoc = thisAstDoc; SetMember(); memberLine = new vdLine(); cirMember = new vdCircle(); cirMember.SetUnRegisterDocument(Maindoc); cirMember.setDocumentDefaults(); memberLine.SetUnRegisterDocument(Maindoc); memberLine.setDocumentDefaults(); Maindoc.ActiveLayOut.Entities.AddItem(memberLine); Maindoc.ActiveLayOut.Entities.AddItem(cirMember); formText = thisForm.Text; frmMain = thisForm; frmMember = memberForm; frmMemberLoad = memberLoadForm; frmMemberJointLoad = memberJointLoadForm; }
public Axial(vdDocument vdoc, string loads) { //X = Y = Z = 0.0; vDoc = vdoc; Wheel1 = new vdCircle(); Wheel1.SetUnRegisterDocument(vdoc); Wheel1.setDocumentDefaults(); Wheel1.Radius = WheelRadius; vdoc.ActiveLayOut.Entities.AddItem(Wheel1); Wheel2 = new vdCircle(); Wheel2.SetUnRegisterDocument(vdoc); Wheel2.setDocumentDefaults(); Wheel2.Radius = WheelRadius; vdoc.ActiveLayOut.Entities.AddItem(Wheel2); Axis = new vdLine(); Axis.SetUnRegisterDocument(vdoc); Axis.setDocumentDefaults(); Axis.StartPoint = Wheel1.Center; Axis.EndPoint = Wheel2.Center; vdoc.ActiveLayOut.Entities.AddItem(Axis); WheelRadius = 0.3d; Load = (new MyList(loads, ' ')).StringList[0]; }
public PlanWheel(vdDocument vdoc) { //X = Y = Z = 0.0; WheelRadius = 0.3d; vDoc = vdoc; Wheel1 = new vdCircle(); Wheel1.SetUnRegisterDocument(vdoc); Wheel1.setDocumentDefaults(); Wheel1.Radius = WheelRadius; Wheel1.ExtrusionVector = new Vector(0, 1, 0); vdoc.ActiveLayOut.Entities.AddItem(Wheel1); Wheel2 = new vdCircle(); Wheel2.SetUnRegisterDocument(vdoc); Wheel2.setDocumentDefaults(); Wheel2.Radius = WheelRadius; Wheel2.ExtrusionVector = new Vector(0, 1, 0); vdoc.ActiveLayOut.Entities.AddItem(Wheel2); Axis = new vdLine(); Axis.SetUnRegisterDocument(vdoc); Axis.setDocumentDefaults(); Axis.StartPoint = Wheel1.Center; Axis.EndPoint = Wheel2.Center; vdoc.ActiveLayOut.Entities.AddItem(Axis); }
public override vdEntities Explode() { vdEntities Entities = new vdEntities(); Entities.SetUnRegisterDocument(Document); if (Document != null) { Document.UndoHistory.PushEnable(false); } vdLine line = new vdLine(); line.StartPoint = StartPoint; line.EndPoint = EndPoint; line.MatchProperties(this, Document); Entities.AddItem(line); vdPolyline pl = new vdPolyline(); pl.VertexList.AddRange(this.mArrowPoints); pl.Flag = VdConstPlineFlag.PlFlagCLOSE; pl.HatchProperties = new vdHatchProperties(); pl.HatchProperties.FillMode = VdConstFill.VdFillModeSolid; pl.HatchProperties.FillColor.ByBlock = true; pl.Transformby(ArrowEcsMatrix(new Vector(0, 0, 1))); pl.MatchProperties(this, Document); Entities.AddItem(pl); if (Document != null) { Document.UndoHistory.PopEnable(); } return(Entities); }
public Axial(vdDocument vdoc) { //X = Y = Z = 0.0; vDoc = vdoc; Wheel1 = new vdCircle(); Wheel1.SetUnRegisterDocument(vdoc); Wheel1.setDocumentDefaults(); Wheel1.Radius = WheelRadius; vdoc.ActiveLayOut.Entities.AddItem(Wheel1); Wheel2 = new vdCircle(); Wheel2.SetUnRegisterDocument(vdoc); Wheel2.setDocumentDefaults(); Wheel2.Radius = WheelRadius; vdoc.ActiveLayOut.Entities.AddItem(Wheel2); Axis = new vdLine(); Axis.SetUnRegisterDocument(vdoc); Axis.setDocumentDefaults(); Axis.StartPoint = Wheel1.Center; Axis.EndPoint = Wheel2.Center; vdoc.ActiveLayOut.Entities.AddItem(Axis); WheelRadius = (Width == 0.0) ? 0.2d : Width / 10.0; }
public int find_nearest_depth(List <vdText> depthList, vdLine line) { //public delegate int Comparison<in T>(T x, T y); Comparison <vdText> cmp = (vdText x, vdText y) => { if (x.InsertionPoint.y > y.InsertionPoint.y) { return(-1); } else if (x.InsertionPoint.y == y.InsertionPoint.y) { return(0); } else { return(1); } }; depthList.Sort(cmp); //将深度的文字从小到大排序 for (int i = 0; i < depthList.Count; i++) { /** * if(line.StartPoint.y<= depthList[i].InsertionPoint.y && line.StartPoint.y>= depthList[i+1].InsertionPoint.y ) * { * return int.Parse(depthList[i + 1].TextString); * }**/ if (Math.Abs(line.StartPoint.y - depthList[i].InsertionPoint.y) <= 5) { return(int.Parse(depthList[i].TextString)); } } return(-1); }
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 ShowMemberOnGrid(vdLine vLine) { //dgvMemberGrid.FirstDisplayedScrollingRowIndex = 6; //DataGridViewCell cell; //cell.ColumnIndex = 0; //cell.RowIndex = 2; for (int i = 0; i < astDoc.Members.Count; i++) { if (astDoc.Members[i].StartNode.Point == vLine.StartPoint && astDoc.Members[i].EndNode.Point == vLine.EndPoint) { for (int j = 0; j < dgvMemberGrid.Rows.Count; j++) { int memNo = (int)dgvMemberGrid[0, j].Value; if (memNo == astDoc.Members[i].MemberNo) { ClearSelect(); dgvMemberGrid.Rows[j].Selected = true; dgvMemberGrid.FirstDisplayedScrollingRowIndex = j; astDoc.Members.ShowMember(j, doc, 0.03d); return; } } } } }
private vdPolyface CreatePolyFaceFromCurve(vdPolyline curvePath, double diameter) { var pf = new vdPolyface(); pf.SetUnRegisterDocument(vDraw.ActiveDocument); pf.setDocumentDefaults(); var circle = new vdCircle { Radius = diameter / 2.0 }; vdCurve path = curvePath; if (curvePath.VertexList.Count == 2) { var line = new vdLine(); line.SetUnRegisterDocument(vDraw.ActiveDocument); line.setDocumentDefaults(); line.StartPoint = curvePath.getStartPoint(); line.EndPoint = curvePath.getEndPoint(); path = line; } pf.Generate3dPathSection(path, circle, new gPoint(0, 0, 0), 6, 1); pf.SmoothAngle = 45; pf.PenColor.ColorIndex = 2; vDraw.ActiveDocument.ActiveLayOut.Entities.Add(pf); return(pf); }
public override void FillShapeEntities(ref vdEntities entities) { vdCircle circle = new vdCircle(); entities.AddItem(circle); circle.MatchProperties(this, Document); circle.Radius = mRadius; circle.HatchProperties = mhatchprops; if (mShowLines) { gPoint cen = new gPoint(); vdLine line1; double angle = 0.0; for (int i = 0; i < 4; i++) { line1 = new vdLine(); line1.MatchProperties(this, Document); if (mhatchprops.FillMode == VdConstFill.VdFillModeNone) { line1.LineType = Document.LineTypes.Invisible; } line1.StartPoint = new gPoint(gPoint.Polar(cen, angle + mAngle, 3.0d * mRadius / 2.0d)); line1.EndPoint = new gPoint(gPoint.Polar(cen, angle + mAngle, 2.0d * mRadius)); angle += VectorDraw.Geometry.Globals.HALF_PI; entities.AddItem(line1); } } }
public void ShowMemberOnForm(vdLine vLine) { int mNo = MemberNo; for (int i = 0; i < astDoc.Members.Count; i++) { #region Switch Code //switch (cmbLoadCase.Text.Trim()) //{ // case "1": // if (ASTDoc_Load1.Members[i].StartNode.Point == vLine.StartPoint && // ASTDoc_Load1.Members[i].EndNode.Point == vLine.EndPoint) // { // cmbMemberNo.SelectedIndex = -1; // cmbMemberNo.SelectedIndex = cmbMemberNo.Items.IndexOf(ASTDoc_Load1.Members[i].MemberNo); // } // break; // case "2": // if (ASTDoc_Load2.Members[i].StartNode.Point == vLine.StartPoint && // ASTDoc_Load2.Members[i].EndNode.Point == vLine.EndPoint) // { // cmbMemberNo.SelectedIndex = -1; // cmbMemberNo.SelectedIndex = cmbMemberNo.Items.IndexOf(ASTDoc_Load2.Members[i].MemberNo); // } // break; // case "3": // if (ASTDoc_Load3.Members[i].StartNode.Point == vLine.StartPoint && // ASTDoc_Load3.Members[i].EndNode.Point == vLine.EndPoint) // { // cmbMemberNo.SelectedIndex = -1; // cmbMemberNo.SelectedIndex = cmbMemberNo.Items.IndexOf(ASTDoc_Load3.Members[i].MemberNo); // //cmbMemberNo.SelectedIndex = cmbMemberNo.Items.IndexOf(MemberNo); // } // break; //} #endregion //#region Switch Code if (astDoc.Members[i].StartNode.Point == vLine.StartPoint && astDoc.Members[i].EndNode.Point == vLine.EndPoint) { cmbMemberNo.SelectedIndex = -1; cmbMemberNo.SelectedIndex = cmbMemberNo.Items.IndexOf(astDoc.Members[i].MemberNo); } //if (astDoc.Members[i].StartNode.Point == vLine.StartPoint && // astDoc.Members[i].EndNode.Point == vLine.EndPoint) //{ // cmbMemberNo.SelectedIndex = cmbMemberNo.Items.IndexOf(MemberNo); //} } }
public ActionDisNetCommands(gPoint startPoint, vdLayout layout, gPoint endPoint) : base(startPoint, layout) { ValueTypeProp |= valueType.DISTANCE; figure = new vdLine(); figure.SetUnRegisterDocument(layout.Document); figure.setDocumentDefaults(); figure.StartPoint = startPoint; figure.EndPoint = startPoint; figure.ExtrusionVector = Vector.CreateExtrusion(startPoint, endPoint); figure.Thickness = startPoint.Distance3D(endPoint); }
public void ShowMember(vdLine ln) { for (int i = 0; i < astDoc.Members.Count; i++) { if (ln.StartPoint == astDoc.Members[i].StartNode.Point && ln.EndPoint == astDoc.Members[i].EndNode.Point) { astDoc.Members.ShowMember(i, Maindoc); cmbMembers.SelectedIndex = i; return; } } }
public void Draw_Floor_Layout(double flr_lvl) { MemberIncidenceCollection beams = new MemberIncidenceCollection(); for (int i = 0; i < AST_DOC.Members.Count; i++) { var item = AST_DOC.Members[i]; if (item.EndNode.Y == flr_lvl) { if (item.StartNode.Y == item.EndNode.Y) { beams.Add(item); } } } VDoc.ShowUCSAxis = false; VDoc.ActiveLayOut.Entities.RemoveAll(); double max_z = AST_DOC.Joints.Max_Z_Positive; vdLine ln = new vdLine(); foreach (var item in beams) { ln = new vdLine(); ln.SetUnRegisterDocument(VDoc); ln.setDocumentDefaults(); ln.StartPoint.x = item.StartNode.X; ln.StartPoint.y = max_z - item.StartNode.Z; ln.EndPoint.x = item.EndNode.X; ln.EndPoint.y = max_z - item.EndNode.Z; ln.ToolTip = "Member No : " + item.MemberNo; VDoc.ActiveLayOut.Entities.Add(ln); } //Get_Slabs(mic); Fill_All_Slab(); Load_Slab_Data(); VDoc.Palette.Background = Color.White; VDoc.Redraw(true); VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VTop(VDoc); }
public void find_depth() { vdEntities arr = this.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.Entities; List <vdLine> list = new List <vdLine>(); //arr[arr.Count - 2], arr[arr.Count - 1] vdLine line1 = (vdLine)arr[arr.Count - 2]; vdLine line2 = (vdLine)arr[arr.Count - 1]; if (line1.StartPoint.y >= line2.StartPoint.y) { //line1ÔÚÉÏÃæ list.Add(line1); list.Add(line2); } else { list.Add(line2); list.Add(line1); } // DrawCommonData.startDepth1 List <vdText> depthList = new List <vdText>(); foreach (vdFigure figure in arr) { if (figure is vdText) { vdText text = figure as vdText; try { int depth = int.Parse(text.TextString); if (depth >= DrawCommonData.upperdepth && depth <= DrawCommonData.lowerdepth) { depthList.Add(text); } } catch { continue; } } } int upper = this.find_nearest_depth(depthList, list[0]); //Éî¶ÈÉϽç int lower = this.find_nearest_depth(depthList, list[1]); //Éî¶ÈϽç MessageBox.Show("ÉϽç:" + upper.ToString()); MessageBox.Show("Ͻç:" + lower.ToString()); }
public frmMemberLoadCase(vdDocument thisDoc, ASTRADoc thisAstDoc) { InitializeComponent(); Maindoc = thisDoc; astDoc = thisAstDoc; SetMember(); memberLine = new vdLine(); cirMember = new vdCircle(); cirMember.SetUnRegisterDocument(Maindoc); cirMember.setDocumentDefaults(); memberLine.SetUnRegisterDocument(Maindoc); memberLine.setDocumentDefaults(); Maindoc.ActiveLayOut.Entities.AddItem(memberLine); Maindoc.ActiveLayOut.Entities.AddItem(cirMember); }
public int GetMemberNo(vdLine line) { //int mNo = -1; for (int i = 0; i < iACad.AstraDocument.Members.Count; i++) { if (iACad.AstraDocument.Members[i].StartNode.Point == line.StartPoint && iACad.AstraDocument.Members[i].EndNode.Point == line.EndPoint) { return(iACad.AstraDocument.Members[i].MemberNo); } else if (iACad.AstraDocument.Members[i].StartNode.Point == line.EndPoint && iACad.AstraDocument.Members[i].EndNode.Point == line.StartPoint) { return(iACad.AstraDocument.Members[i].MemberNo); } } return(-1); }
public int GetMemberNo(vdLine line) { //int mNo = -1; for (int i = 0; i < astDoc.Members.Count; i++) { if (astDoc.Members[i].StartNode.Point == line.StartPoint && astDoc.Members[i].EndNode.Point == line.EndPoint) { return(astDoc.Members[i].MemberNo); } else if (astDoc.Members[i].StartNode.Point == line.EndPoint && astDoc.Members[i].EndNode.Point == line.StartPoint) { return(astDoc.Members[i].MemberNo); } } return(-1); }
private void AddPipeToEntities(vdEntities entities, double diameter, gPoint ptStart, gPoint ptEnd, string layerName) { var pf = new vdPolyface(); pf.SetUnRegisterDocument(vDraw.ActiveDocument); pf.setDocumentDefaults(); var line = new vdLine(ptStart, ptEnd); var circle = new vdCircle { Radius = diameter / 2.0 }; pf.Generate3dPathSection(line, circle, new gPoint(0, 0, 0), 6, 1); pf.Layer = vDraw.ActiveDocument.Layers.FindName(layerName); pf.SmoothAngle = 45; entities.Add(pf); }
private void button1_Click(object sender, EventArgs e) { vdEntities arr = ((Childform)this.ActiveMdiChild).vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.Entities; vdLine beforelastline = arr[arr.Count - 2] as vdLine; vdLine lastline = arr[arr.Count - 1] as vdLine; if (beforelastline != null && lastline != null) { MessageBox.Show("无法画线"); return; } ((Childform)this.ActiveMdiChild).vdScrollableControl1.BaseControl.ActiveDocument.CommandAction.CmdLine(null); }
public static bool WriteLineCoordinates(string fileName, vdDocument doc) { bool success = false; using (StreamWriter sw = new StreamWriter(new FileStream(fileName, FileMode.Create))) { try { for (int i = 0; i < doc.ActiveLayOut.Entities.Count; i++) { vdLine ln = doc.ActiveLayOut.Entities[i] as vdLine; if (ln != null) { sw.WriteLine("VD_LINE"); sw.WriteLine("SP={0}", ln.StartPoint.ToString()); sw.WriteLine("EP={0}", ln.EndPoint.ToString()); } else { vdText txt = doc.ActiveLayOut.Entities[i] as vdText; if (txt != null) { sw.WriteLine("VD_TEXT"); sw.WriteLine("IP={0}", txt.InsertionPoint.ToString()); sw.WriteLine("TEXT={0}", txt.TextString); sw.WriteLine("HEIGHT={0}", txt.Height); } } } success = true; } catch (Exception ex) { success = false; } finally { sw.Flush(); sw.Close(); } } return(success); }
public override void FillShapeEntities(ref vdEntities entities) { vdCircle circle = new vdCircle(); entities.AddItem(circle); circle.MatchProperties(this, Document); circle.Radius = mRadius; if (mShowLines) { gPoint cen = new gPoint(); vdLine line1; vdPolyline pLine = new vdPolyline(); line1 = new vdLine(); line1.MatchProperties(this, Document); if (mhatchprops.FillMode == VdConstFill.VdFillModeNone) { line1.LineType = Document.LineTypes.Invisible; } line1.StartPoint = circle.Center; double ss = 0.5d; line1.EndPoint = new gPoint(line1.StartPoint.x - ss, line1.StartPoint.y - ss); pLine.MatchProperties(this, Document); pLine.VertexList.Add(line1.StartPoint); //pLine.VertexList.Add(new gPoint(line1.StartPoint.x,line1.StartPoint.y - circle.Radius)); pLine.VertexList.Add(line1.EndPoint); pLine.VertexList.Add(new gPoint(line1.StartPoint.x + ss, line1.StartPoint.y - ss)); pLine.VertexList.Add(pLine.VertexList[0]); //entities.AddItem(line1); entities.AddItem(pLine); } }
private void button1_Click(object sender, EventArgs e) { ln1 = new vdLine(); ln1 = new vdLine(); ln1.SetUnRegisterDocument(doc); ln1.setDocumentDefaults(); doc.ActiveLayOut.Entities.AddItem(ln1); ln1.StartPoint = new gPoint(10d, y, 0d); ln1.EndPoint = new gPoint(14d, y, 0d); y += 2.0d; ln2 = new vdLine(); ln2 = new vdLine(); ln2.SetUnRegisterDocument(doc); ln2.setDocumentDefaults(); doc.ActiveLayOut.Entities.AddItem(ln2); ln2.StartPoint = new gPoint(10d, y, 0d); ln2.EndPoint = new gPoint(14d, y, 0d); y += 2.0d; ln3 = new vdLine(); ln3 = new vdLine(); ln3.SetUnRegisterDocument(doc); ln3.setDocumentDefaults(); doc.ActiveLayOut.Entities.AddItem(ln3); ln3.StartPoint = new gPoint(10d, y, 0d); ln3.EndPoint = new gPoint(14d, y, 0d); y += 2.0d; doc.Redraw(true); }
public override void FillShapeEntities(ref vdEntities entities) { vdCircle circle = new vdCircle(); //entities.AddItem(circle); circle.MatchProperties(this, Document); circle.Radius = mRadius; circle.HatchProperties = mhatchprops; if (mShowLines) { gPoint cen = new gPoint(); vdLine line1; double dx = 0.0d, dy = 0.0d; dx = circle.Center.x - 0.5; dy = circle.Center.y; line1 = new vdLine(); line1.StartPoint = new gPoint(dx, dy, circle.Center.z); line1.EndPoint = new gPoint(circle.Center.x + 0.5d, circle.Center.y, circle.Center.z); line1.MatchProperties(this, Document); entities.AddItem(line1); for (int i = 0; i < 6; i++) { line1 = new vdLine(); line1.MatchProperties(this, Document); line1.StartPoint = new gPoint(dx, dy); line1.EndPoint = new gPoint(line1.StartPoint.x - 0.1d, line1.StartPoint.y - 0.3); dx += 0.2; //dy += 0.3; entities.AddItem(line1); } //line1 = new vdLine(); //line1.StartPoint = new gPoint(circle.Center.x - 1.0d, circle.Center.y, circle.Center.z); //line1.EndPoint = new gPoint(circle.Center.x + 1.0d, circle.Center.y, circle.Center.z); //line1.MatchProperties(this, Document); //entities.AddItem(line1); //line2 = new vdLine(); //line2.StartPoint = line1.StartPoint; //line2.EndPoint = new gPoint(line1.StartPoint.x-0.1d, line1.StartPoint.y - 0.5d); //line2.MatchProperties(this, Document); //entities.AddItem(line2); //line3 = new vdLine(); //line3.StartPoint = line1.EndPoint; //line3.EndPoint = new gPoint(line1.EndPoint.x - 0.1d, line1.EndPoint.y - 0.5d); //line3.MatchProperties(this, Document); //entities.AddItem(line3); //line4 = new vdLine(); //line4.StartPoint = new gPoint(line1.StartPoint.x + 0.3d, line1.StartPoint.y); //line4.EndPoint = new gPoint(line4.StartPoint.x - 0.1d, line4.EndPoint.y - 0.5d); //line4.MatchProperties(this, Document); //entities.AddItem(line4); //line5 = new vdLine(); //line5.StartPoint = new gPoint(line4.StartPoint.x + 0.3d, line4.StartPoint.y); //line5.EndPoint = new gPoint(line5.StartPoint.x - 0.1d, line5.EndPoint.y - 0.5d); //line5.MatchProperties(this, Document); //entities.AddItem(line5); //line6 = new vdLine(); //line6.StartPoint = new gPoint(line5.StartPoint.x + 0.3d, line5.StartPoint.y); //line6.EndPoint = new gPoint(line6.StartPoint.x - 0.1d, line6.EndPoint.y - 0.5d); //line6.MatchProperties(this, Document); //entities.AddItem(line6); //ASTRASupportPinned pinn = new ASTRASupportPinned(); //pinn.MatchProperties(this, Document); //pinn.Origin = circle.Center; //pinn.Radius = 0.2d; //entities.AddItem(pinn); } }
void Draw_Model() { List <double> lst_X = new List <double>(); List <double> lst_Y = new List <double>(); for (int i = 0; i < 10; i++) { lst_X.Add(i); if (i < 5) { lst_Y.Add(i); } } VDoc.ActiveLayOut.Entities.RemoveAll(); vdLine ln; //double Skew_Angle = 26; double skew_length = Math.Tan((Skew_Angle * (Math.PI / 180.0))); double x = 0.0; double y = 0.0; for (int r = 0; r < lst_Y.Count; r++) { for (int i = 1; i < lst_X.Count; i++) { ln = new vdLine(VDoc); ln.setDocumentDefaults(); //ln.StartPoint = new gPoint(lst_X[i - 1], lst_Y[i - 1]); //ln.EndPoint = new gPoint(lst_X[i], lst_Y[i]); //x = lst_X[i - 1] ; x = lst_X[i - 1] + lst_Y[r] * skew_length; ln.StartPoint = new gPoint(x, lst_Y[r]); x = lst_X[i] + lst_Y[r] * skew_length; ln.EndPoint = new gPoint(x, lst_Y[r]); VDoc.ActiveLayOut.Entities.Add(ln); } } for (int r = 0; r < lst_X.Count; r++) { for (int i = 1; i < lst_Y.Count; i++) { ln = new vdLine(VDoc); ln.setDocumentDefaults(); x = lst_X[r] + lst_Y[i - 1] * skew_length; ln.StartPoint = new gPoint(x, lst_Y[i - 1]); x = lst_X[r] + lst_Y[i] * skew_length; ln.EndPoint = new gPoint(x, lst_Y[i]); VDoc.ActiveLayOut.Entities.Add(ln); } } VDoc.Redraw(true); VDRAW.vdCommandAction.View3D_VTop(VDoc); VDRAW.vdCommandAction.ZoomOut_Ex(VDoc); VDRAW.vdCommandAction.ZoomOut_Ex(VDoc); }
public CVcadLine(vdLine vdline) { this.vdobj = vdline; }
public void Moving_Line() { #region ASTRA if (AST_DOC_ORG.IsMovingLoad) { AST_DOC.Members.DrawMember(doc); //Draw_ASTRA_Joint_Load(); vdLine ln = new vdLine(); ln.SetUnRegisterDocument(doc); ln.setDocumentDefaults(); //ln.StartPoint = new gPoint(0, max_y + 3); //ln.EndPoint = new gPoint(max_x, max_y + 3); ln.StartPoint.x = AST_DOC_ORG.Joints.BoundingBox.Left; ln.StartPoint.y = AST_DOC_ORG.Joints.BoundingBox.Top + 2; ln.EndPoint.x = AST_DOC_ORG.Joints.BoundingBox.Right; ln.EndPoint.y = AST_DOC_ORG.Joints.BoundingBox.Top + 2; doc.ActiveLayOut.Entities.AddItem(ln); double xinc = AST_DOC_ORG.Load_Geneartion[0].XINC; vdMText wheelPos = new vdMText(); wheelPos.SetUnRegisterDocument(doc); wheelPos.setDocumentDefaults(); //wheelPos.TextString = "WHEEL POSITION [ INCREMENT = " + xinc + " m. ], DECK SPAN LENGTH = " + max_x + " m."; wheelPos.TextString = "WHEEL POSITION [ INCREMENT = " + xinc + " m. ], DECK SPAN LENGTH = " + AST_DOC_ORG.Joints.BoundingBox.Width + " m."; wheelPos.InsertionPoint.x = AST_DOC_ORG.Joints.BoundingBox.MidPoint.x; wheelPos.InsertionPoint.y = AST_DOC_ORG.Joints.BoundingBox.Top + 2.5; wheelPos.HorJustify = VectorDraw.Professional.Constants.VdConstHorJust.VdTextHorCenter; wheelPos.VerJustify = VectorDraw.Professional.Constants.VdConstVerJust.VdTextVerCen; //wheelPos.InsertionPoint.x -= 2.4; //wheelPos.InsertionPoint.y -= 0.4; wheelPos.Height = 0.24; doc.ActiveLayOut.Entities.AddItem(wheelPos); vdMText nodalLoad = new vdMText(); nodalLoad.SetUnRegisterDocument(doc); nodalLoad.setDocumentDefaults(); nodalLoad.TextString = "NODAL LOADS"; nodalLoad.InsertionPoint.x = AST_DOC_ORG.Joints.BoundingBox.MidPoint.x; nodalLoad.InsertionPoint.y = AST_DOC.Joints.BoundingBox.Bottom - 2.0; nodalLoad.HorJustify = VectorDraw.Professional.Constants.VdConstHorJust.VdTextHorCenter; nodalLoad.VerJustify = VectorDraw.Professional.Constants.VdConstVerJust.VdTextVerCen; nodalLoad.Height = 0.25; nodalLoad.PenColor = new vdColor(Color.Red); doc.ActiveLayOut.Entities.AddItem(nodalLoad); ln = new vdLine(); ln.SetUnRegisterDocument(doc); ln.setDocumentDefaults(); ln.StartPoint.x = AST_DOC_ORG.Joints.BoundingBox.Left; ln.StartPoint.y = AST_DOC_ORG.Joints.BoundingBox.Top + 3.0; ln.EndPoint.x = AST_DOC_ORG.Joints.BoundingBox.Right; ln.EndPoint.y = AST_DOC_ORG.Joints.BoundingBox.Top + 3.0; doc.ActiveLayOut.Entities.AddItem(ln); double dx, dy, dz; int no = (int)(max_x / xinc); for (int n = 0; n < no; n++) { dx = AST_DOC_ORG.Joints.BoundingBox.Left + n * xinc; dy = AST_DOC_ORG.Joints.BoundingBox.Bottom; ln = new vdLine(); ln.SetUnRegisterDocument(doc); ln.setDocumentDefaults(); ln.StartPoint = new gPoint(dx, dy); ln.EndPoint = new gPoint(dx, dy - 0.05); doc.ActiveLayOut.Entities.AddItem(ln); } } #endregion }
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 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); }
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); }