.NET

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

Creating Dimension Styles

222 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!

 

Active Contributor
NayaraFJ
Posts: 42
Registered: ‎08-11-2011
Message 2 of 2 (215 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;

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community