private void Button1_Click(object sender, EventArgs e)
        {
            this.Hide();

            string message;

            if (checkBox1.Checked == true)
            {
                PublicValue.dimScale    = double.Parse(textBox1.Text);
                PublicValue.scaleFactor = double.Parse(textBox2.Text) / PublicValue.dimScale;
                string dimStyleName = "BF" + textBox1.Text + "-" + textBox2.Text;

                using (Transaction trans = PublicValue.acDb.TransactionManager.StartTransaction())
                {
                    DimStyleTable dst = (DimStyleTable)trans.GetObject(PublicValue.acDb.DimStyleTableId, OpenMode.ForRead);
                    if (!dst.Has(dimStyleName))
                    {
                        DimStyleTools.CreateModifyDimStyle(dimStyleName, out message);
                        DimStyleTools.SetCurrentDimStyle(dimStyleName);
                        StatusBars.UpdateAppPane();
                    }
                    else
                    {
                        DimStyleTools.SetCurrentDimStyle(dimStyleName);
                        StatusBars.UpdateAppPane();
                    }
                }
            }
            else
            {
                PublicValue.dimScale = double.Parse(textBox1.Text);
                string dimStyleName = "BF" + textBox1.Text;
                PublicValue.scaleFactor = 1.0;
                using (Transaction trans = PublicValue.acDb.TransactionManager.StartTransaction())
                {
                    DimStyleTable dst = (DimStyleTable)trans.GetObject(PublicValue.acDb.DimStyleTableId, OpenMode.ForRead);
                    if (!dst.Has(dimStyleName))
                    {
                        DimStyleTools.CreateModifyDimStyle(dimStyleName, out message);
                        DimStyleTools.SetCurrentDimStyle(dimStyleName);
                        StatusBars.UpdateAppPane();
                    }
                    else
                    {
                        DimStyleTools.SetCurrentDimStyle(dimStyleName);
                        StatusBars.UpdateAppPane();
                    }
                }
            }
            this.Close();
        }
Ejemplo n.º 2
0
        //[CommandMethod("SD")]
        public void SD()
        {
            Editor ed = acDoc.Editor;

            ed.WriteMessage("百福工具箱——设定图纸比例和缩放各标注");

            //int dimScale = System.Convert.ToInt32(Application.GetSystemVariable("DIMSCALE"));
            //String dimStyle = System.Convert.ToString(Application.GetSystemVariable("DIMSTYLE"));

            SetDwgScaleForm form1 = new SetDwgScaleForm();

            form1.ShowDialog();

            StatusBars.CreateAppPane();
        }