.NET

Reply
Active Contributor
jimmie_fulton
Posts: 44
Registered: ‎04-06-2005
Message 1 of 1 (102 Views)

Database DimStyle

102 Views, 0 Replies
01-16-2006 01:10 PM
What is the proper way to set a Database's active DimStyle using the Managed API? When I set a DimStyle with the sample code below, it is set, but it's values are overridden by the properties of whatever DimStyle was previously set.

private void SetDimStyle(string dimStyleName)
{
 Database db = HostApplicationServices.WorkingDatabase;
 using (Transaction trans = db.TransactionManager.StartTransaction())
 {
  DimStyleTable dst = (DimStyleTable)trans.GetObject(db.DimStyleTableId, OpenMode.ForRead);
  if (dst.Has(dimStyleName))
  {
   DimStyleTableRecord dstr = (DimStyleTableRecord)trans.GetObject(dst[dimStyleName], OpenMode.ForRead);

   if (dstr.ObjectId != db.Dimstyle)
    db.Dimstyle = dstr.ObjectId;
  }
 }
}

That's it. I get the same results whether or not the dimstyle I am setting is just added, or already existed in the drawing.

Thanks!

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