/// <summary> /// /// </summary> private void UpdateGridData() { //���߽��߱� dgvUserCenterLine.Rows.Clear(); try { BeamBoxBlock block = new BeamBoxBlock(); beamBoxData.GetBlock(ref block, 0); dgvBoarderLine.RowCount = beamBoxData.BlockCount + 4; dgvBoarderLine.Rows[0].Cells[0].Value = (block.User_curveZX == null) ? "" : AcadAssist.ConvertToTxPolyline(block.User_curveZX).GetDataString(); dgvBoarderLine.Rows[0].Cells[1].Value = "������"; dgvBoarderLine.Rows[1].Cells[0].Value = (block.User_cvBoardUp == null) ? "" : AcadAssist.ConvertToTxPolyline(block.User_cvBoardUp).GetDataString(); dgvBoarderLine.Rows[1].Cells[1].Value = "�ϱ�Ե"; dgvBoarderLine.Rows[2].Cells[0].Value = (block.User_cvBoardDn == null) ? "" : AcadAssist.ConvertToTxPolyline(block.User_cvBoardDn).GetDataString(); dgvBoarderLine.Rows[2].Cells[1].Value = "�±�Ե"; dgvBoarderLine.Rows[3].Cells[0].Value = (block.User_pierline1 == null) ? "" : AcadAssist.ConvertToTxPolyline(block.User_pierline1).GetDataString(); dgvBoarderLine.Rows[3].Cells[1].Value = "��λ��"; for (int i = 0; i < beamBoxData.BlockCount; i++) { BeamBoxBlock tempBlock = new BeamBoxBlock(); beamBoxData.GetBlock(ref tempBlock, i); dgvBoarderLine.Rows[i + 4].Cells[0].Value = (block.User_pierline2 == null) ? "" : AcadAssist.ConvertToTxPolyline(tempBlock.User_pierline2).GetDataString(); dgvBoarderLine.Rows[i + 4].Cells[1].Value = "��λ��"; } } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } //����û������߱� dgvUserCenterLine.Rows.Clear(); for (int i = 0; i < beamBoxData.BlockCount; i++) { BeamBoxBlock block = new BeamBoxBlock(); beamBoxData.GetBlock(ref block, i); //�������û�����ģʽ�ż�¼�û������� if (block.DrawMode != BeamBoxBlock.DrawingMode.USER_CENTER) continue; for (int j = 0; j < block.User_storedCLines.Count; j++) { string[] contents = new string[2] { AcadAssist.ConvertToTxPolyline(block.User_storedCLines[j]).GetDataString(), (i + 1).ToString() };//ע����ʾ���Ǵ�1��ʼ��� dgvUserCenterLine.Rows.Add(contents); } } }
internal FormBeamBox() { InitializeComponent(); if (FormBeamBox.beamBoxData == null) return; //----------ͼ����ʾ--------------------------- M_Illustrator = new Illustrator(); Size size = groupBoxPic.ClientSize; M_Illustrator.Size = size; groupBoxPic.Controls.Add(M_Illustrator); IllustratorTool.LoadPic(M_Illustrator, "����ͼ-С����"); //----------ͼ����ʾ--------------------------- comboBox1.SelectedIndex = 0; BeamBoxBlock beamBoxBlock = new BeamBoxBlock(); beamBoxData.GetBlock(ref beamBoxBlock, 0); textBox1.Text = beamBoxBlock.M_glWidth1.ToString(); textBox2.Text = beamBoxBlock.M_glWidth2.ToString(); textBox3.Text = beamBoxBlock.DimSideOffset.ToString(); textBox27.Text = beamBoxBlock.DimUpOffset.ToString(); textBox28.Text = beamBoxBlock.DimDownOffset.ToString(); textBox4.Text = beamBoxBlock.M_initWone.ToString(); textBox16.Text = beamBoxBlock.M_initWsjf.ToString(); textBox6.Text = beamBoxBlock.WidthOffsetL.ToString(); textBox7.Text = beamBoxBlock.WidthOffsetR.ToString(); textBox8.Text = beamBoxBlock.WidthOffsetSjfL.ToString(); textBox9.Text = beamBoxBlock.WidthOffsetSjfR.ToString(); checkBox1.Checked = beamBoxBlock.IsDrawHorizon; checkBox2.Checked = beamBoxBlock.UseTextOffset; textBoxScale.Text = beamBoxBlock.DimScale.ToString(); comboBox2.SelectedIndex = (int)beamBoxBlock.StructType; checkBox4.Checked = beamBoxBlock.IsUserhgbCount; checkBox5.Checked = beamBoxBlock.IsDrawDimension; checkBox6.Checked = beamBoxBlock.IsDrawBeam; checkBox7.Checked = beamBoxBlock.IsDimItalia; checkBox3.Checked = beamBoxBlock.IsAdjustSJFW; checkBox8.Checked = beamBoxBlock.IsDrawSupport; checkBox9.Checked = beamBoxBlock.IsSupportRound; checkBox10.Checked = beamBoxBlock.IsDimXb_ByBeamCenter; checkBox11.Checked = beamBoxBlock.IsDimZZDistOnBeam; textBox10.Text = beamBoxBlock.M_hgbCount.ToString(); //�������۶��� textBox17.Text = beamBoxBlock.M_initWsideLS.ToString(); textBox18.Text = beamBoxBlock.M_initWsideLX.ToString(); textBox19.Text = beamBoxBlock.M_initWsideRS.ToString(); textBox20.Text = beamBoxBlock.M_initWsideRX.ToString(); //---֧����Ϣ textBox21.Text = beamBoxBlock.SupportOffsetL.ToString(); textBox22.Text = beamBoxBlock.SupportOffsetR.ToString(); textBox23.Text = beamBoxBlock.SupportDistOnBeam.ToString(); textBox24.Text = beamBoxBlock.SupportDiameter.ToString(); textBox25.Text = beamBoxBlock.GailiangInSide.ToString(); textBox26.Text = beamBoxBlock.GailiangOutSide.ToString(); comboBox1.SelectedIndex = 0; if (beamBoxBlock.M_drawScale == 1000) comboBox1.SelectedIndex = 0; else if (beamBoxBlock.M_drawScale == 1) comboBox1.SelectedIndex = 1; //this.ShowDataOnGrid(); UpdateGridData(); this.checkBox2_CheckedChanged(null, null); this.checkBox6_CheckedChanged(null, null); this.checkBox8_CheckedChanged(null, null); MouseEventHandler curEvent = new System.Windows.Forms.MouseEventHandler(this.textBox_MouseClick); AcadAssist.AttrachFormEvent(this, curEvent); }
/// <summary> /// ȫ����´����������� /// </summary> private void UpdateBeamBoxData() { for (int i = 0; i < beamBoxData.BlockCount; i++) { BeamBoxBlock beamBoxBlock = new BeamBoxBlock(); beamBoxBlock.M_glWidth1 = Convert.ToDouble(textBox1.Text); beamBoxBlock.M_glWidth2 = Convert.ToDouble(textBox2.Text); beamBoxBlock.DimSideOffset = Convert.ToDouble(textBox3.Text); beamBoxBlock.DimUpOffset = Convert.ToDouble(textBox27.Text); beamBoxBlock.DimDownOffset = Convert.ToDouble(textBox28.Text); beamBoxBlock.M_initWone = Convert.ToDouble(textBox4.Text); beamBoxBlock.M_initWsjf = Convert.ToDouble(textBox16.Text); beamBoxBlock.IsDrawHorizon = checkBox1.Checked; beamBoxBlock.UseTextOffset = checkBox2.Checked; beamBoxBlock.StructType = (BeamBoxBlock.BeamType)comboBox2.SelectedIndex; beamBoxBlock.IsUserhgbCount = checkBox4.Checked; beamBoxBlock.M_hgbCount = Convert.ToInt32(textBox10.Text); beamBoxBlock.IsDrawDimension = checkBox5.Checked; beamBoxBlock.IsDrawBeam = checkBox6.Checked; beamBoxBlock.IsDimItalia = checkBox7.Checked; beamBoxBlock.IsAdjustSJFW = checkBox3.Checked; beamBoxBlock.IsDrawSupport = checkBox8.Checked; beamBoxBlock.IsSupportRound = checkBox9.Checked; beamBoxBlock.IsDimXb_ByBeamCenter = checkBox10.Checked; beamBoxBlock.IsDimZZDistOnBeam = checkBox11.Checked; //�������۶��� beamBoxBlock.M_initWsideLS = Convert.ToDouble(textBox17.Text); beamBoxBlock.M_initWsideLX = Convert.ToDouble(textBox18.Text); beamBoxBlock.M_initWsideRS = Convert.ToDouble(textBox19.Text); beamBoxBlock.M_initWsideRX = Convert.ToDouble(textBox20.Text); //---֧����Ϣ beamBoxBlock.SupportOffsetL = Convert.ToDouble(textBox21.Text); beamBoxBlock.SupportOffsetR = Convert.ToDouble(textBox22.Text); beamBoxBlock.SupportDistOnBeam = Convert.ToDouble(textBox23.Text); beamBoxBlock.SupportDiameter = Convert.ToDouble(textBox24.Text); beamBoxBlock.GailiangInSide = Convert.ToDouble(textBox25.Text); beamBoxBlock.GailiangOutSide = Convert.ToDouble(textBox26.Text); if (checkBox2.Checked) { beamBoxBlock.WidthOffsetL = textBox6.Text; beamBoxBlock.WidthOffsetR = textBox7.Text; beamBoxBlock.WidthOffsetSjfL = textBox8.Text; beamBoxBlock.WidthOffsetSjfR = textBox9.Text; } beamBoxBlock.M_drawScale = 1; if (comboBox1.SelectedIndex == 0) beamBoxBlock.M_drawScale = 1000; else if (comboBox1.SelectedIndex == 1) beamBoxBlock.M_drawScale = 1; TxPolyline pline1 = new TxPolyline(); TxPolyline pline2 = new TxPolyline(); TxPolyline pline3 = new TxPolyline(); TxPolyline pline4 = new TxPolyline(); TxPolyline pline5 = new TxPolyline(); if (dgvBoarderLine.Rows[0].Cells[0].Value != null && dgvBoarderLine.Rows[0].Cells[0].Value.ToString() != "") pline1.SetDataByString(dgvBoarderLine.Rows[0].Cells[0].Value.ToString()); if (dgvBoarderLine.Rows[1].Cells[0].Value != null && dgvBoarderLine.Rows[1].Cells[0].Value.ToString() != "") pline2.SetDataByString(dgvBoarderLine.Rows[1].Cells[0].Value.ToString()); if (dgvBoarderLine.Rows[2].Cells[0].Value != null && dgvBoarderLine.Rows[2].Cells[0].Value.ToString() != "") pline3.SetDataByString(dgvBoarderLine.Rows[2].Cells[0].Value.ToString()); if (dgvBoarderLine.Rows[i + 3].Cells[0].Value != null && dgvBoarderLine.Rows[i + 3].Cells[0].Value.ToString() != "") pline4.SetDataByString(dgvBoarderLine.Rows[i + 3].Cells[0].Value.ToString()); if (dgvBoarderLine.Rows[i + 4].Cells[0].Value != null && dgvBoarderLine.Rows[i + 4].Cells[0].Value.ToString() != "") pline5.SetDataByString(dgvBoarderLine.Rows[i + 4].Cells[0].Value.ToString()); if (pline1.NumberOfVertices > 0) beamBoxBlock.User_curveZX = AcadAssist.ConvertToTxPolyline(pline1); if (pline2.NumberOfVertices > 0) beamBoxBlock.User_cvBoardUp = AcadAssist.ConvertToTxPolyline(pline2); if (pline3.NumberOfVertices > 0) beamBoxBlock.User_cvBoardDn = AcadAssist.ConvertToTxPolyline(pline3); if (pline4.NumberOfVertices > 0) beamBoxBlock.User_pierline1 = new TxLine(pline4.StartPoint, pline4.EndPoint); if (pline5.NumberOfVertices > 0) beamBoxBlock.User_pierline2 = new TxLine(pline5.StartPoint, pline5.EndPoint); beamBoxBlock.PierLabel1 = "P" + (i + 1).ToString(); beamBoxBlock.PierLabel2 = "P" + (i + 2).ToString(); beamBoxBlock.User_storedCLines.Clear(); //dataGridView2.RowCount = beamBoxBlock.User_storedCLines.Count; for (int j = 0; j < dgvUserCenterLine.RowCount; j++) { TxPolyline plineTemp = new TxPolyline(); if (dgvUserCenterLine.Rows[j].Cells[0].Value != null && dgvUserCenterLine.Rows[j].Cells[0].Value.ToString() != "") plineTemp.SetDataByString(dgvUserCenterLine.Rows[j].Cells[0].Value.ToString()); if (dgvUserCenterLine.Rows[j].Cells[1].Value.ToString() == (i + 1).ToString()) beamBoxBlock.User_storedCLines.Add(new TxLine(plineTemp.StartPoint, plineTemp.EndPoint)); } if (beamBoxBlock.User_pierline1 == null || beamBoxBlock.User_pierline2 == null || beamBoxBlock.User_curveZX == null || beamBoxBlock.User_cvBoardUp == null || beamBoxBlock.User_cvBoardDn == null) { return; } beamBoxBlock.DimScale = Convert.ToDouble(textBoxScale.Text); beamBoxData.UpdateBlock(beamBoxBlock, i); } }
private void buttonSelectBorder_Click(object sender, EventArgs e) { if (FormBeamBox.beamBoxData == null) return; if (StyleInit.StyleInitMethod() == false) return; UpdateBeamBoxData(); List<string> message1 = new List<string>(); List<string> message2 = new List<string>(); message1.Add("��·�����"); message2.Add("ѡ������"); message1.Add("�ṹ�ϱ�Ե��"); message2.Add("ѡ������"); message1.Add("�ṹ�±�Ե��"); message2.Add("ѡ������"); List<TxCurve> selectCurve = AcadAction.GetTxCurveOneByOne(this, message1, message2); List<TxCurve> selectPierCurve = AcadAction.GetTxCurveListFormAcad(this, false, false, "ѡ���λ��", "ѡ���λ��");//ʵ����Ҳ�����Ƕ�������������ʾ��ֱ�� if (selectPierCurve.Count < 2) return; beamBoxData.ClearData(); for (int i = 0; i < selectPierCurve.Count - 1; i++) { BeamBoxBlock beamBoxBlock = new BeamBoxBlock(); FormBeamBox.beamBoxData.AddBlock(beamBoxBlock); TxCurve curve0 = selectCurve[0]; TxCurve curve1 = selectCurve[1]; TxCurve curve2 = selectCurve[2]; TxCurve line1 = selectPierCurve[i]; TxCurve line2 = selectPierCurve[i + 1]; TxLine temp_line1 = new TxLine(line1.StartPoint, line1.EndPoint); TxLine temp_line2 = new TxLine(line2.StartPoint, line2.EndPoint); beamBoxBlock.User_curveZX = AcadAssist.CloneTxCurve(curve0); beamBoxBlock.User_cvBoardUp = AcadAssist.CloneTxCurve(curve1); beamBoxBlock.User_cvBoardDn = AcadAssist.CloneTxCurve(curve2); beamBoxBlock.User_pierline1 = AcadAssist.ExtendLineBoth(temp_line1, temp_line1.Length); beamBoxBlock.User_pierline2 = AcadAssist.ExtendLineBoth(temp_line2, temp_line2.Length); //ע������Ҫ���¶��� //beamBoxData.User_startLine = null; beamBoxBlock.User_storedCLines.Clear(); beamBoxBlock.User_hgbLines.Clear(); } //this.ShowDataOnGrid(); UpdateGridData(); }
private void buttonSelectHGB_Click(object sender, EventArgs e) { if (FormBeamBox.beamBoxData == null) return; if (StyleInit.StyleInitMethod() == false) return; List<TxCurve> selectLines = AcadAction.GetTxCurveListFormAcad(this, true, false, "���붨���(��·�ߺ���ʼ�ֿ��߽���)", "ѡ�����ֱ��"); for (int j = 0; j < beamBoxData.BlockCount; j++) { BeamBoxBlock kDataBlock = new BeamBoxBlock(); beamBoxData.GetBlock(ref kDataBlock, j); kDataBlock.User_hgbLines.Clear(); for (int i = 0; i < selectLines.Count; i++) { TxLine line = new TxLine(selectLines[i].StartPoint, selectLines[i].EndPoint); kDataBlock.User_hgbLines.Add(line); } beamBoxData.UpdateBlock(kDataBlock, j); } //this.ShowDataOnGrid(); UpdateGridData(); #region OLD_CODE //////this.Hide(); //////Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; //////Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; //save some space //////DocumentLock lock1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();// ////// //////PromptSelectionOptions prSelectOp = new PromptSelectionOptions(); //////prSelectOp.MessageForAdding = "ѡ�����ֱ��"; //////TypedValue typedValue1 = new TypedValue((int)DxfCode.Start, "LINE"); //////SelectionFilter filter1 = new SelectionFilter(new TypedValue[] { typedValue1 }); //////PromptSelectionResult prSelectRs = ed.GetSelection(prSelectOp, filter1); //////if (prSelectRs.Status != PromptStatus.OK) ////// return; ////// ////// //////using (Transaction trans = db.TransactionManager.StartTransaction()) //////{ ////// ////// BeamBoxBlock kDataBlock = FormBeamBox.beamBoxData.boxBlock; ////// ////// ////// kDataBlock.User_hgbLines.Clear(); ////// ////// ObjectId[] objIds = prSelectRs.Value.GetObjectIds(); ////// for (int i = 0; i < objIds.Length; i++) ////// { ////// Line ln = (Line)trans.GetObject(objIds[i], OpenMode.ForRead); ////// kDataBlock.User_hgbLines.Add((TxLine)ln.Clone()); ////// } ////// trans.Commit(); //////} //////lock1.Dispose(); //////this.Show(); #endregion }
private void buttonSelectBeamLine_Click(object sender, EventArgs e) { if (FormBeamBox.beamBoxData == null) return; if (StyleInit.StyleInitMethod() == false) return; UpdateBeamBoxData(); for (int n = 0; n < beamBoxData.BlockCount; n++) { BeamBoxBlock block = new BeamBoxBlock(); beamBoxData.GetBlock(ref block, n); List<Point3d> orgPoints = AcadAssist.GetIntersectionPoints(block.User_curveZX, block.User_pierline1); if (orgPoints.Count == 0) { System.Windows.Forms.MessageBox.Show(""); return; } List<TxCurve> selectLines = AcadAction.GetTxCurveListFormAcad2(this, true, orgPoints[0], false, "�����" + (n + 1).ToString() + "����鶨���(��·�ߺ���ʼ�ֿ��߽���)", "ѡ����������(��������)���ո����"); block.User_storedCLines.Clear(); for (int i = 0; i < selectLines.Count; i++) { TxLine line = new TxLine(selectLines[i].StartPoint, selectLines[i].EndPoint); block.User_storedCLines.Add(line); } //�����û����������� block.DrawMode = BeamBoxBlock.DrawingMode.USER_CENTER; beamBoxData.UpdateBlock(block, n); } this.UpdateGridData(); }
/// <summary> /// 更新板块 /// </summary> /// <param name="block">用以替换的板块</param> /// <param name="index">板块的位置</param> /// <returns></returns> internal bool UpdateBlock(BeamBoxBlock block, int index) { try { this.blocks[index] = block; return true; } catch { return false; } }
/// <summary> /// 获取板块数据 /// </summary> /// <param name="block">获取的板块</param> /// <param name="index">板块编号</param> /// <returns></returns> internal bool GetBlock(ref BeamBoxBlock block, int index) { try { block = blocks[index].Clone() as BeamBoxBlock; return true; } catch { return false; } }
/// <summary> /// 加入板块 /// </summary> /// <param name="block">要加入的板块</param> /// <returns></returns> internal bool AddBlock(BeamBoxBlock block) { if (block == null) return false; blocks.Add(block); return true; }
public bool AddBlock(BeamBoxBlock block) { blocks.Add(block); return true; }