.NET

Reply
Active Contributor
NayaraFJ
Posts: 42
Registered: ‎08-11-2011
Message 1 of 2 (261 Views)
Accepted Solution

Creating Dimension Styles

261 Views, 1 Replies
09-03-2012 04:42 AM

I'm not able to create a "DIMSTYLE" with Dimblk1 different Dimblk2.

 

 

        public static ObjectId CreateDimstyle(DimStyleTableRecord dim, string name, string seta1, string seta2)
        {
            Document acDoc = Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;
            using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
            {
                DimStyleTable dimStyleTable = (DimStyleTable)acTrans.GetObject(acCurDb.DimStyleTableId, OpenMode.ForWrite);
                DimStyleTableRecord dimStyleTableRecord = null;
                if (dimStyleTable.Has(name) == false)
                {

                    if (dimStyleTable.IsWriteEnabled == false)
                        dimStyleTable.UpgradeOpen();
                    dimStyleTableRecord = new DimStyleTableRecord();
                    dimStyleTableRecord.Name = name;
                    dimStyleTable.Add(dimStyleTableRecord);
                    acTrans.AddNewlyCreatedDBObject(dimStyleTableRecord, true);
                }
                else
                {
                    dimStyleTableRecord = acTrans.GetObject(dimStyleTable[name],
                        OpenMode.ForWrite) as DimStyleTableRecord;
                }

                dimStyleTableRecord.Dimtxsty = dim.Dimtxsty;

                dimStyleTableRecord.Dimtxt = dim.Dimtxt;
                dimStyleTableRecord.Dimscale = dim.Dimscale;
                dimStyleTableRecord.Dimdec = dim.Dimdec; 
                dimStyleTableRecord.Dimadec = dim.Dimadec;
                dimStyleTableRecord.Dimlunit = dim.Dimlunit; 
                dimStyleTableRecord.Dimaunit = dim.Dimaunit; 
                dimStyleTableRecord.Dimtad = dim.Dimtad; 
                dimStyleTableRecord.Dimtih = dim.Dimtih; 
                dimStyleTableRecord.Dimtix = dim.Dimtix; 
                dimStyleTableRecord.Dimtofl = dim.Dimtofl;
                dimStyleTableRecord.Dimblk = ConvertToLayer.GetArrowObjectId(seta1);
                dimStyleTableRecord.Dimblk1 = ConvertToLayer.GetArrowObjectId(seta1);
                dimStyleTableRecord.Dimblk2 = ConvertToLayer.GetArrowObjectId(seta2);
                dimStyleTableRecord.Dimasz = dim.Dimasz;
                dimStyleTableRecord.Dimgap = dim.Dimgap;
                dimStyleTableRecord.Dimclrt = dim.Dimclrt;
                dimStyleTableRecord.Dimclre = dim.Dimclre;
                dimStyleTableRecord.Dimclrd = dim.Dimclrd;
                dimStyleTableRecord.Dimexo = dim.Dimexo;
                dimStyleTableRecord.Dimtmove = dim.Dimtmove;
                dimStyleTableRecord.Dimtoh = dim.Dimtoh;
                dimStyleTableRecord.Dimexe = dim.Dimexe;
                acCurDb.SetDimstyleData(dimStyleTableRecord);
                acTrans.Commit();
                return dimStyleTableRecord.ObjectId;
            }
        }

 What am I doing wrong.
Please help me out!

 

I managed.
I also had to configure: acDimStyleTblRec.Dimsah = true;

 

Active Contributor
NayaraFJ
Posts: 42
Registered: ‎08-11-2011
Message 2 of 2 (254 Views)

Re: Creating Dimension Styles

09-03-2012 05:41 AM in reply to: NayaraFJ

I managed.
I also had to configure: acDimStyleTblRec.Dimsah = true;

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.