public static ObjectId AddStandardDimstyle()
{
Document doc=acadApp.DocumentManager.MdiActiveDocument;
Editor ed=doc.Editor;
Database db=doc.Database;
DimStyleTableRecord dimstyle = new DimStyleTableRecord();
using(Transaction tr=db.TransactionManager.StartTransaction())
{
DimStyleTable dt = tr.GetObject
(db.DimStyleTableId, OpenMode.ForRead) as DimStyleTable;
if(dt.Has("Standard")) return dt["Standard"];
}
dimstyle.Name = "Standard";
Color byblock = Color.FromColorIndex(ColorMethod.ByBlock, 0);
dimstyle.Dimadec = 0;
dimstyle.Dimalt = false;
dimstyle.Dimaltd = 2;
dimstyle.Dimaltf = 25.4;
dimstyle.Dimaltrnd = 0.0;
dimstyle.Dimalttd =2;
dimstyle.Dimalttz = 0;
dimstyle.Dimaltu = 2;
dimstyle.Dimaltz = 0;
dimstyle.Dimapost = "";
dimstyle.Dimarcsym = 0;
dimstyle.Dimasz = 0.18;
dimstyle.Dimatfit = 3;
dimstyle.Dimaunit = 0;
dimstyle.Dimazin = 0;
dimstyle.Dimblk = ObjectId.Null;
dimstyle.Dimblk1 = ObjectId.Null;
dimstyle.Dimblk2 = ObjectId.Null;
dimstyle.Dimcen = 0.09;
dimstyle.Dimclrd = Color.FromColorIndex(ColorMethod.ByBlock,0);
dimstyle.Dimclre = Color.FromColorIndex(ColorMethod.ByBlock, 0);
dimstyle.Dimclrt = Color.FromColorIndex(ColorMethod.ByBlock, 0); ;
dimstyle.Dimdec = 4;
dimstyle.Dimdle = 0.0;
dimstyle.Dimdli = 0.3800;
dimstyle.Dimdsep = char.Parse(".");
dimstyle.Dimexe = 0.18;
dimstyle.Dimexo = 0.0625;
dimstyle.Dimfrac = 0;
dimstyle.Dimgap = 0.09;
dimstyle.Dimldrblk = ObjectId.Null;
dimstyle.Dimlfac = 1.0;
dimstyle.Dimlim = false;
dimstyle.Dimltype = db.ByBlockLinetype;
dimstyle.Dimlunit = 2;
dimstyle.Dimlwd = LineWeight.ByBlock;
dimstyle.Dimlwe = LineWeight.ByBlock;
dimstyle.Dimpost = "";
dimstyle.Dimrnd = 0.0;
dimstyle.Dimsah = true;
dimstyle.Dimscale = 1;
dimstyle.Dimsd1 = false;
dimstyle.Dimsd2 = false;
dimstyle.Dimse1 = false;
dimstyle.Dimse2 = false;
dimstyle.Dimsoxd = false;
dimstyle.Dimtad = 0;
dimstyle.Dimtdec = 4;
dimstyle.Dimltex1 = db.ByBlockLinetype;
dimstyle.Dimltex2 = db.ByBlockLinetype;
dimstyle.Dimtxtdirection = false;
dimstyle.Dimtfac = 1.0;
dimstyle.Dimtih = true;
dimstyle.Dimtix = false;
dimstyle.Dimtm = 0.0;
dimstyle.Dimtmove = 0;
dimstyle.Dimtofl = false;
dimstyle.Dimtoh = true;
dimstyle.Dimtol = false;
dimstyle.Dimtolj = 1;
dimstyle.Dimtp = 0.0;
dimstyle.Dimtsz = 0.0;
dimstyle.Dimtxsty =Layers.Layers.StandardTextStyle();
dimstyle.Dimtvp = 0.0;
dimstyle.Dimtxt = 0.18;
dimstyle.Dimtzin = 0;
dimstyle.Dimupt = false;
dimstyle.Dimzin = 0;
if (isMM)
{
dimstyle.Dimaltf = (double)10 / 254.0;
dimstyle.Dimasz = 2.4;
dimstyle.Dimcen = 2.4;
dimstyle.Dimdec = 1;
dimstyle.Dimdle = 1.5;
dimstyle.Dimdli = 13;
dimstyle.Dimexe = 1.5;
dimstyle.Dimexo = 1.5;
dimstyle.Dimgap = 2.4;
dimstyle.Dimlunit = 2;
dimstyle.Dimtdec = 0;
dimstyle.Dimtxt = 3;
}
ObjectId id=ObjectId.Null;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
DimStyleTable dt = tr.GetObject
(db.DimStyleTableId, OpenMode.ForWrite) as DimStyleTable;
id= dt.Add(dimstyle);
tr.AddNewlyCreatedDBObject(dimstyle, true);
tr.Commit();
}
return id;
} //end