工具箱相关
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Conn.cs 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using GrxCAD.DatabaseServices;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace HCTools
  12. {
  13. public partial class Conn : Form
  14. {
  15. public Conn()
  16. {
  17. InitializeComponent();
  18. }
  19. private void Conn_Load(object sender, EventArgs e)
  20. {
  21. if (MainClass.Flag == "SelfIntersect")
  22. {
  23. this.Text = "线自相交";
  24. }
  25. if (MainClass.Flag == "EachIntersect")
  26. {
  27. this.Text = "线相交";
  28. }
  29. this.comboBox_jqx.DropDownStyle = ComboBoxStyle.DropDownList;
  30. this.comboBox_sqx.DropDownStyle = ComboBoxStyle.DropDownList;
  31. //自动填充下拉框
  32. Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
  33. using (Transaction traction = database.TransactionManager.StartTransaction())
  34. {
  35. //存放所有图层名
  36. List<string> alllayername = new List<string>();
  37. LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
  38. foreach (ObjectId objid in layertable)
  39. {
  40. LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
  41. alllayername.Add(layertablerecord.Name);
  42. }
  43. alllayername.Sort();
  44. for (int i = 0; i < alllayername.Count; i++)
  45. {
  46. this.comboBox_jqx.Items.Add(alllayername[i]);
  47. this.comboBox_sqx.Items.Add(alllayername[i]);
  48. }
  49. if (alllayername.Contains("8110"))
  50. {
  51. int index = alllayername.IndexOf("8110");
  52. this.comboBox_sqx.SelectedIndex = index;
  53. }
  54. if (alllayername.Contains("8120"))
  55. {
  56. int index = alllayername.IndexOf("8120");
  57. this.comboBox_jqx.SelectedIndex = index;
  58. }
  59. traction.Commit();
  60. }
  61. }
  62. private void btn_OK_Click(object sender, EventArgs e)
  63. {
  64. if (MainClass.Flag == "SelfIntersect")
  65. {
  66. if (comboBox_blc.Text == "")
  67. {
  68. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择比例尺");
  69. return;
  70. }
  71. //比例尺
  72. string blctext = comboBox_blc.Text;
  73. int blcindex = blctext.LastIndexOf(':');
  74. string strblc = blctext.Substring(blcindex + 1);
  75. Inters.blc = Convert.ToInt32(strblc);
  76. Inters.jqx = comboBox_jqx.Text;
  77. Inters.sqx = comboBox_sqx.Text;
  78. this.Close();
  79. Inters selfints = new Inters();
  80. selfints.SelfInts();
  81. }
  82. if (MainClass.Flag == "EachIntersect")
  83. {
  84. if (comboBox_blc.Text == "")
  85. {
  86. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择比例尺");
  87. return;
  88. }
  89. //比例尺
  90. string blctext = comboBox_blc.Text;
  91. int blcindex = blctext.LastIndexOf(':');
  92. string strblc = blctext.Substring(blcindex + 1);
  93. Inters.blc = Convert.ToInt32(strblc);
  94. this.Close();
  95. Inters eachints = new Inters();
  96. eachints.Ints();
  97. }
  98. }
  99. }
  100. }