(изменено: Ирина, 5 июня 2014г. 11:28:14)

Тема: DimStyleTableRecord

Добрый день.
Подскажите, где найти описание свойствам объекта DimStyleTableRecord.  :(
В частности не могу найти в свойствах: Символы и стрелки - Размер разрыва.
Нашла вот эту ссылку http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html?url=WS1a9193826455f5ff2566ffd511ff6f8c7ca-4042.htm,topicNumber=d0e18665 . Но свойство "размер разрыва" найти не могу.

Re: DimStyleTableRecord

В файле arxmgd.chm (Документация ObjectARX).

Re: DimStyleTableRecord

Здесь подробный пример по программной настройке размерных стилей.

Re: DimStyleTableRecord

Ирина пишет:

Подскажите, где найти описание свойствам объекта DimStyleTableRecord.

Посмотри рабочие примеры (А2014)

       /// <summary>
        /// Settings For STD1 DimStyle
        /// </summary>
        /// <param name="doc"></param>
        public static void SettingsForSTD1DimStyle(Document doc)
        {
            try
            {
                using (Transaction tr = doc.TransactionManager.StartTransaction())
                {
                    Database db = doc.Database;

                    DimStyleTable dst = (DimStyleTable)tr.GetObject(db.DimStyleTableId, OpenMode.ForWrite, true);

                    // Initialise a DimStyleTableRecord
                    DimStyleTableRecord dstr = null;
                    // If the required dimension style exists
                    if (dst.Has("STD1"))
                    {
                        // get the dimension style table record open for writing
                        dstr = (DimStyleTableRecord)tr.GetObject(dst["STD1"], OpenMode.ForWrite);
                    }
                    else
                        // Initialise as a new dimension style table record
                        dstr = new DimStyleTableRecord();
                    dstr.Name = "STD1";
                    // dstr.Annotative = AnnotativeStates.True;
                    dstr.Dimadec = 2;
                    dstr.Dimalt = false;
                    dstr.Dimaltd = 2;
                    dstr.Dimaltf = 25.4;
                    dstr.Dimaltrnd = 0;
                    dstr.Dimalttd = 2;
                    dstr.Dimalttz = 0;
                    dstr.Dimaltu = 2;
                    dstr.Dimaltz = 0;
                    dstr.Dimapost = "";
                    dstr.Dimarcsym = 0;
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMASSOC", 2);
                    dstr.Dimasz = 0.1;
                    dstr.Dimatfit = 3;
                    dstr.Dimaunit = 0;
                    dstr.Dimazin = 0;
                    dstr.Dimblk = ObjectId.Null;
                    dstr.Dimblk1 = ObjectId.Null;
                    dstr.Dimblk2 = ObjectId.Null;
                    dstr.Dimcen = 0.09;
                    dstr.Dimclrd = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 1);
                    dstr.Dimclre = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 1);
                    dstr.Dimclrt = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 3);
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMCONSTRAINTICON", 3);
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMCONTINUEMODE", 1);
                    dstr.Dimdec = 4;
                    dstr.Dimdle = 0;
                    dstr.Dimdli = 0.5;
                    dstr.Dimdsep = Convert.ToChar(".");
                    dstr.Dimexe = 0.1;
                    dstr.Dimexo = 0.0625;
                    dstr.Dimfrac = 2;
                    dstr.Dimfxlen = 1.0;
                    dstr.DimfxlenOn = false;
                    dstr.Dimgap = 0.03;
                    dstr.Dimjogang = 0.7854;
                    dstr.Dimjust = 0;
                    dstr.Dimldrblk = ObjectId.Null;
                    dstr.Dimlfac = 1;
                    dstr.Dimlim = false;
                    dstr.Dimlunit = 5;
                    dstr.Dimlwd = LineWeight.ByLineWeightDefault;//-2;
                    dstr.Dimlwe = LineWeight.ByLineWeightDefault;//-2
                    dstr.Dimpost = "";
                    dstr.Dimrnd = 0;
                    dstr.Dimsah = false;
                    dstr.Dimscale = 24.0;
                    dstr.Dimsd1 = false;
                    dstr.Dimsd2 = false;
                    dstr.Dimse1 = false;
                    dstr.Dimse2 = false;
                    dstr.Dimsoxd = false;
                    dstr.Dimtad = 1;
                    dstr.Dimtdec = 5;
                    dstr.Dimtfac = 1;
                    dstr.Dimtfill = 0;
                    dstr.Dimtfillclr = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 0);
                    dstr.Dimtih = false;
                    dstr.Dimtix = false;
                    dstr.Dimtm = 0;
                    dstr.Dimtmove = 0;
                    dstr.Dimtofl = true;
                    dstr.Dimtoh = false;
                    dstr.Dimtol = false;
                    dstr.Dimtolj = 1;
                    dstr.Dimtp = 0;
                    dstr.Dimtsz = 0;
                    dstr.Dimtvp = 0;
                    dstr.Dimtxsty = db.Dimtxsty;
                    dstr.Dimtxt = 0.125;
                    dstr.Dimtxtdirection = false;
                    dstr.Dimtzin = 0;
                    dstr.Dimupt = false;
                    dstr.Dimzin = 4;

                    // If the dimension style doesn't exist
                    if (!dst.Has("STD1"))
                    {
                        // Add it to the dimension style table and collect its Id
                        Object dsId = dst.Add(dstr);
                        // Add the new dimension style table record to the document
                        tr.AddNewlyCreatedDBObject(dstr, true);
                    }
                    if (dstr.ObjectId != db.Dimstyle)
                    {

                        db.Dimstyle = dstr.ObjectId;

                        db.SetDimstyleData(dstr);

                    }
                    // Commit the changes.
                    tr.Commit();
                }
            }
            catch (Autodesk.AutoCAD.Runtime.Exception e)
            {
                doc.Editor.WriteMessage(e.Message + "\n" + e.StackTrace);
            }
        }

        /// <summary>
        /// Settings For 24 Standard
        /// </summary>
        /// <param name="doc"></param>
        public static void SettingsFor24Standard(Document doc)
        {
            try
            {
                using (Transaction tr = doc.TransactionManager.StartTransaction())
                {
                    Database db = doc.Database;

                    DimStyleTable dst = (DimStyleTable)tr.GetObject(db.DimStyleTableId, OpenMode.ForWrite, true);

                    // Initialise a DimStyleTableRecord
                    DimStyleTableRecord dstr = null;
                    // If the required dimension style exists
                    if (dst.Has("24 standard"))
                    {
                        // get the dimension style table record open for writing
                        dstr = (DimStyleTableRecord)tr.GetObject(dst["24 standard"], OpenMode.ForWrite);
                    }
                    else
                        // Initialise as a new dimension style table record
                        dstr = new DimStyleTableRecord();
                    dstr.Name = "24 standard";
                    dstr.Dimadec = 2;
                    dstr.Dimalt = false;
                    dstr.Dimaltd = 2;
                    dstr.Dimaltf = 25.4;
                    dstr.Dimaltrnd = 0;
                    dstr.Dimalttd = 2;
                    dstr.Dimalttz = 0;
                    dstr.Dimaltu = 2;
                    dstr.Dimaltz = 0;
                    dstr.Dimapost = "";
                    dstr.Dimarcsym = 0;
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMASSOC", 2);
                    dstr.Dimasz = 0.1175;
                    dstr.Dimatfit = 3;
                    dstr.Dimaunit = 0;
                    dstr.Dimazin = 0;
                    dstr.Dimblk = ObjectId.Null;
                    dstr.Dimblk1 = ObjectId.Null;
                    dstr.Dimblk2 = ObjectId.Null;
                    dstr.Dimcen = 0.09;
                    dstr.Dimclrd = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 0);
                    dstr.Dimclre = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 0);
                    dstr.Dimclrt = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 3);
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMCONSTRAINTICON", 3);
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMCONTINUEMODE", 1);
                    dstr.Dimdec = 5;
                    dstr.Dimdle = 0;
                    dstr.Dimdli = 0.38;
                    dstr.Dimdsep = Convert.ToChar(".");
                    dstr.Dimexe = 0.0863;
                    dstr.Dimexo = 0.0625;
                    dstr.Dimfrac = 0;
                    //dstr.Dimfxl = 1.0;
                    dstr.DimfxlenOn = false;
                    dstr.Dimgap = 0.09;
                    dstr.Dimjogang = 0.7854;
                    dstr.Dimjust = 0;
                    dstr.Dimldrblk = ObjectId.Null;
                    dstr.Dimlfac = 1;
                    dstr.Dimlim = false;
                    dstr.Dimlunit = 4;
                    dstr.Dimlwd = LineWeight.LineWeight025;//-2;
                    dstr.Dimlwe = LineWeight.LineWeight025;//-2
                    dstr.Dimpost = "";
                    dstr.Dimrnd = 0.0625;
                    dstr.Dimsah = false;
                    dstr.Dimscale = 24.0;
                    dstr.Dimsd1 = false;
                    dstr.Dimsd2 = false;
                    dstr.Dimse1 = false;
                    dstr.Dimse2 = false;
                    dstr.Dimsoxd = false;
                    dstr.Dimtad = 1;
                    dstr.Dimtdec = 4;
                    dstr.Dimtfac = 1;
                    dstr.Dimtfill = 0;
                    dstr.Dimtfillclr = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 0);
                    dstr.Dimtih = false;
                    dstr.Dimtix = true;
                    dstr.Dimtm = 0;
                    dstr.Dimtmove = 2;
                    dstr.Dimtofl = true;
                    dstr.Dimtoh = false;
                    dstr.Dimtol = false;
                    dstr.Dimtolj = 1;
                    dstr.Dimtp = 0;
                    dstr.Dimtsz = 0;
                    dstr.Dimtvp = 0;
                    dstr.Dimtxsty = db.Dimtxsty;
                    dstr.Dimtxt = 0.18;
                    dstr.Dimtxtdirection = false;
                    dstr.Dimtzin = 0;

                    // If the dimension style doesn't exist
                    if (!dst.Has("roughopening"))
                    {
                        // Add it to the dimension style table and collect its Id
                        Object dsId = dst.Add(dstr);
                        // Add the new dimension style table record to the document
                        tr.AddNewlyCreatedDBObject(dstr, true);
                    }
                    if (dstr.ObjectId != db.Dimstyle)
                    {

                        db.Dimstyle = dstr.ObjectId;

                        db.SetDimstyleData(dstr);

                    }
                    // Commit the changes.
                    tr.Commit();
                }
            }
            catch (Autodesk.AutoCAD.Runtime.Exception e)
            {
                doc.Editor.WriteMessage(e.Message + "\n" + e.StackTrace);
            }
        }

        /// <summary>
        /// Settings For RoughOpening
        /// </summary>
        /// <param name="doc"></param>
        public static void SettingsForRoughOpening(Document doc)
        {
            try
            {
                using (Transaction tr = doc.TransactionManager.StartTransaction())
                {
                    Database db = doc.Database;

                    DimStyleTable dst = (DimStyleTable)tr.GetObject(db.DimStyleTableId, OpenMode.ForWrite, true);

                    // Initialise a DimStyleTableRecord
                    DimStyleTableRecord dstr = null;
                    // If the required dimension style exists
                    if (dst.Has("ROUGHOPENING"))
                    {
                        // get the dimension style table record open for writing
                        dstr = (DimStyleTableRecord)tr.GetObject(dst["ROUGHOPENING"], OpenMode.ForWrite);
                    }
                    else
                        // Initialise as a new dimension style table record
                        dstr = new DimStyleTableRecord();
                    dstr.Name = "ROUGHOPENING";
                    //
                    dstr.Dimadec = 2;
                    dstr.Dimalt = true;
                    dstr.Dimaltd = 5;
                    dstr.Dimaltf = 1.0000;
                    dstr.Dimaltrnd = 0.0000;
                    dstr.Dimalttd = 5;
                    dstr.Dimalttz = 0;
                    dstr.Dimaltu = 7;
                    dstr.Dimaltz = 4;
                    dstr.Dimapost = "''";
                    dstr.Dimarcsym = 0;
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMASSOC", 2);
                    dstr.Dimasz = 0.1000;
                    dstr.Dimatfit = 3;
                    dstr.Dimaunit = 1;
                    dstr.Dimazin = 0;
                    dstr.Dimblk = ObjectId.Null;
                    dstr.Dimblk1 = ObjectId.Null;
                    dstr.Dimblk2 = ObjectId.Null;
                    dstr.Dimcen = 0.0900;
                    dstr.Dimclrd = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 1);
                    dstr.Dimclre = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 1);
                    dstr.Dimclrt = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 3);
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMCONSTRAINTICON", 3);
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMCONTINUEMODE", 1);
                    dstr.Dimdec = 5;
                    dstr.Dimdle = 0.0000;
                    dstr.Dimdli = 0.5000;
                    dstr.Dimdsep = '.';
                    dstr.Dimexe = 0.1000;
                    dstr.Dimexo = 0.0625;
                    dstr.Dimfrac = 2;
                    //dstr.Dimfxl= 1.0000;
                    //dstr.Dimfxlon= 0;
                    dstr.Dimgap = 0.0300;
                    dstr.Dimjogang = 0.7854;
                    dstr.Dimjust = 0;
                    dstr.Dimldrblk = ObjectId.Null;
                    dstr.Dimlfac = 1.0000;
                    dstr.Dimlim = false;
                    dstr.Dimlunit = 4;
                    dstr.Dimlwd = LineWeight.ByLineWeightDefault;
                    dstr.Dimlwe = LineWeight.ByLineWeightDefault;
                    dstr.Dimpost = @" R.O. \X ";
                    dstr.Dimrnd = 0.0000;
                    dstr.Dimsah = false;
                    dstr.Dimscale = 24.0000;
                    dstr.Dimsd1 = false;
                    dstr.Dimsd2 = false;
                    dstr.Dimse1 = false;
                    dstr.Dimse2 = false;
                    dstr.Dimsoxd = false;
                    dstr.Dimtad = 1;
                    dstr.Dimtdec = 5;
                    dstr.Dimtfac = 1.0000;
                    dstr.Dimtfill = 0;
                    dstr.Dimtfillclr = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 0);
                    dstr.Dimtih = false;
                    dstr.Dimtix = false;
                    dstr.Dimtm = 0.0000;
                    dstr.Dimtmove = 0;
                    dstr.Dimtofl = true;
                    dstr.Dimtoh = false;
                    dstr.Dimtol = false;
                    dstr.Dimtolj = 1;
                    dstr.Dimtp = 0.0000;
                    dstr.Dimtsz = 0.0000;
                    dstr.Dimtvp = 0.0000;
                    dstr.Dimtxsty = db.Dimtxsty;
                    dstr.Dimtxt = 0.1250;
                    dstr.Dimtxtdirection = false;
                    dstr.Dimtzin = 0;
                    dstr.Dimupt = false;
                    dstr.Dimzin = 3;

                    // If the dimension style doesn't exist
                    if (!dst.Has("ROUGHOPENING"))
                    {
                        // Add it to the dimension style table and collect its Id
                        Object dsId = dst.Add(dstr);
                        // Add the new dimension style table record to the document
                        tr.AddNewlyCreatedDBObject(dstr, true);
                    }
                    if (dstr.ObjectId != db.Dimstyle)
                    {

                        db.Dimstyle = dstr.ObjectId;

                        db.SetDimstyleData(dstr);

                    }
                    // Commit the changes.
                    tr.Commit();
                }
            }
            catch (Autodesk.AutoCAD.Runtime.Exception e)
            {
                doc.Editor.WriteMessage(e.Message + "\n" + e.StackTrace);
            }
        }
        /// <summary>
        /// Settings For Dlo Dimstyle
        /// </summary>
        /// <param name="doc"></param>
        public static void SettingsForDloDim(Document doc)
        {
            try
            {
                using (Transaction tr = doc.TransactionManager.StartTransaction())
                {
                    Database db = doc.Database;

                    DimStyleTable dst = (DimStyleTable)tr.GetObject(db.DimStyleTableId, OpenMode.ForWrite, true);

                    // Initialise a DimStyleTableRecord
                    DimStyleTableRecord dstr = null;
                    // If the required dimension style exists
                    if (dst.Has("DLODIM"))
                    {
                        // get the dimension style table record open for writing
                        dstr = (DimStyleTableRecord)tr.GetObject(dst["DLODIM"], OpenMode.ForWrite);
                    }
                    else
                        // Initialise as a new dimension style table record
                        dstr = new DimStyleTableRecord();
                    dstr.Name = "DLODIM";
                    //_________dlodim________________//
                    dstr.Dimadec = 2;
                    dstr.Dimalt = false;
                    dstr.Dimaltd = 3;
                    dstr.Dimaltf = 1.0000;
                    dstr.Dimaltrnd = 0.0000;
                    dstr.Dimalttd = 3;
                    dstr.Dimalttz = 0;
                    dstr.Dimaltu = 7;
                    dstr.Dimaltz = 4;
                    dstr.Dimapost = "''";
                    dstr.Dimarcsym = 0;
                    //dstr.Dimassoc= 2;
                    dstr.Dimasz = 0.1000;
                    dstr.Dimatfit = 3;
                    dstr.Dimaunit = 0;
                    dstr.Dimazin = 0;
                    dstr.Dimblk = ObjectId.Null;
                    dstr.Dimblk1 = ObjectId.Null;
                    dstr.Dimblk2 = ObjectId.Null;
                    dstr.Dimcen = 0.0900;
                    dstr.Dimclrd = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 1);
                    dstr.Dimclre = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 1);
                    dstr.Dimclrt = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 3);
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMCONSTRAINTICON", 3);
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMCONTINUEMODE", 1);
                    dstr.Dimdec = 5;
                    dstr.Dimdle = 0.0000;
                    dstr.Dimdli = 0.5000;
                    dstr.Dimdsep = '.';
                    dstr.Dimexe = 0.1000;
                    dstr.Dimexo = 0.0625;
                    dstr.Dimfrac = 2;
                    dstr.Dimfxlen = 1.0000;
                    //dstr.Dimfxlon= 0;
                    dstr.Dimgap = 0.0300;
                    dstr.Dimjogang = 0.7854;
                    dstr.Dimjust = 0;
                    dstr.Dimldrblk = ObjectId.Null;
                    dstr.Dimlfac = 1.0000;
                    dstr.Dimlim = false;
                    dstr.Dimlunit = 5;
                    dstr.Dimlwd = LineWeight.LineWeight025;//-2;
                    dstr.Dimlwe = LineWeight.LineWeight025;//-2
                    dstr.Dimpost = "\\XD.L.O.";
                    dstr.Dimrnd = 0.0000;
                    dstr.Dimsah = false;
                    dstr.Dimscale = 24.0000;
                    dstr.Dimsd1 = false;
                    dstr.Dimsd2 = false;
                    dstr.Dimse1 = false;
                    dstr.Dimse2 = false;
                    dstr.Dimsoxd = false;
                    dstr.Dimtad = 1;
                    dstr.Dimtdec = 5;
                    dstr.Dimtfac = 1.0000;
                    dstr.Dimtfill = 0;
                    dstr.Dimtfillclr = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 0);
                    dstr.Dimtih = false;
                    dstr.Dimtix = false;
                    dstr.Dimtm = 0.0000;
                    dstr.Dimtmove = 0;
                    dstr.Dimtofl = true;
                    dstr.Dimtoh = false;
                    dstr.Dimtol = false;
                    dstr.Dimtolj = 1;
                    dstr.Dimtp = 0.0000;
                    dstr.Dimtsz = 0.0000;
                    dstr.Dimtvp = 0.0000;
                    dstr.Dimtxsty = db.Dimtxsty;
                    dstr.Dimtxt = 0.1250;
                    dstr.Dimtxtdirection = false;
                    dstr.Dimtzin = 0;
                    dstr.Dimupt = false;
                    dstr.Dimzin = 4;
                    //_________roughopening________________//
                    // If the dimension style doesn't exist
                    if (!dst.Has("DLODIM"))
                    {
                        // Add it to the dimension style table and collect its Id
                        Object dsId = dst.Add(dstr);
                        // Add the new dimension style table record to the document
                        tr.AddNewlyCreatedDBObject(dstr, true);
                    }
                    if (dstr.ObjectId != db.Dimstyle)
                    {

                        db.Dimstyle = dstr.ObjectId;

                        db.SetDimstyleData(dstr);

                    }
                    // Commit the changes.
                    tr.Commit();
                }
            }
            catch (Autodesk.AutoCAD.Runtime.Exception e)
            {
                doc.Editor.WriteMessage(e.Message + "\n" + e.StackTrace);
            }
        }

        /// <summary>
        /// Settings For Frame Dimstyle
        /// </summary>
        /// <param name="doc"></param>
        public static void SettingsForFrameDim(Document doc)
        {
            try
            {
                using (Transaction tr = doc.TransactionManager.StartTransaction())
                {
                    Database db = doc.Database;

                    DimStyleTable dst = (DimStyleTable)tr.GetObject(db.DimStyleTableId, OpenMode.ForWrite, true);

                    // Initialise a DimStyleTableRecord
                    DimStyleTableRecord dstr = null;
                    // If the required dimension style exists
                    if (dst.Has("FRAMEDIM"))
                    {
                        // get the dimension style table record open for writing
                        dstr = (DimStyleTableRecord)tr.GetObject(dst["FRAMEDIM"], OpenMode.ForWrite);
                    }
                    else
                        // Initialise as a new dimension style table record
                        dstr = new DimStyleTableRecord();
                    dstr.Name = "FRAMEDIM";
                    //___________FRAMEDIM_________________
                    dstr.Dimadec = 2;
                    dstr.Dimalt = false;
                    dstr.Dimaltd = 3;
                    dstr.Dimaltf = 1.0000;
                    dstr.Dimaltrnd = 0.0000;
                    dstr.Dimalttd = 3;
                    dstr.Dimalttz = 0;
                    dstr.Dimaltu = 7;
                    dstr.Dimaltz = 4;
                    dstr.Dimapost = "";
                    dstr.Dimarcsym = 0;
                    //dstr.Dimassoc= 2;
                    dstr.Dimasz = 0.1000;
                    dstr.Dimatfit = 3;
                    dstr.Dimaunit = 1;
                    dstr.Dimazin = 0;
                    dstr.Dimblk = ObjectId.Null;
                    dstr.Dimblk1 = ObjectId.Null;
                    dstr.Dimblk2 = ObjectId.Null;
                    dstr.Dimcen = 0.0900;
                    dstr.Dimclrd = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 1);
                    dstr.Dimclre = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 1);
                    dstr.Dimclrt = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 3);
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMCONSTRAINTICON", 3);
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMCONTINUEMODE", 1);
                    dstr.Dimdec = 5;
                    dstr.Dimdle = 0.0000;
                    dstr.Dimdli = 0.5000;
                    dstr.Dimdsep = '.';
                    dstr.Dimexe = 0.1000;
                    dstr.Dimexo = 0.0625;
                    dstr.Dimfrac = 2;
                    dstr.Dimfxlen = 1.0000;
                    //dstr.Dimfxlon= 0;
                    dstr.Dimgap = 0.0300;
                    dstr.Dimjogang = 0.7854;
                    dstr.Dimjust = 0;
                    dstr.Dimldrblk = ObjectId.Null;
                    dstr.Dimlfac = 1.0000;
                    dstr.Dimlim = false;
                    dstr.Dimlunit = 5;
                    dstr.Dimlwd = LineWeight.LineWeight025;//-2;
                    dstr.Dimlwe = LineWeight.LineWeight025;//-2
                    dstr.Dimpost = @"\X F.D.";
                    dstr.Dimrnd = 0.0000;
                    dstr.Dimsah = false;
                    dstr.Dimscale = 24.0000;
                    dstr.Dimsd1 = false;
                    dstr.Dimsd2 = false;
                    dstr.Dimse1 = false;
                    dstr.Dimse2 = false;
                    dstr.Dimsoxd = false;
                    dstr.Dimtad = 1;
                    dstr.Dimtdec = 5;
                    dstr.Dimtfac = 1.0000;
                    dstr.Dimtfill = 0;
                    dstr.Dimtfillclr = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 0);
                    dstr.Dimtih = false;
                    dstr.Dimtix = false;
                    dstr.Dimtm = 0.0000;
                    dstr.Dimtmove = 2;
                    dstr.Dimtofl = true;
                    dstr.Dimtoh = false;
                    dstr.Dimtol = false;
                    dstr.Dimtolj = 1;
                    dstr.Dimtp = 0.0000;
                    dstr.Dimtsz = 0.0000;
                    dstr.Dimtvp = 0.0000;
                    dstr.Dimtxsty = db.Dimtxsty;
                    dstr.Dimtxt = 0.1250;
                    dstr.Dimtxtdirection = false;
                    dstr.Dimtzin = 0;
                    dstr.Dimupt = false;
                    dstr.Dimzin = 4;
                    //___________FRAMEDIM_________________
                    // If the dimension style doesn't exist
                    if (!dst.Has("FRAMEDIM"))
                    {
                        // Add it to the dimension style table and collect its Id
                        Object dsId = dst.Add(dstr);
                        // Add the new dimension style table record to the document
                        tr.AddNewlyCreatedDBObject(dstr, true);
                    }
                    if (dstr.ObjectId != db.Dimstyle)
                    {

                        db.Dimstyle = dstr.ObjectId;

                        db.SetDimstyleData(dstr);

                    }
                    // Commit the changes.
                    tr.Commit();
                }
            }
            catch (Autodesk.AutoCAD.Runtime.Exception e)
            {
                doc.Editor.WriteMessage(e.Message + "\n" + e.StackTrace);
            }
        }