colmguckian Posted November 26, 2011 Posted November 26, 2011 I have a code which changes the dimension style in a drawing from DimStyle1 to Dimstyle2 Is it possible to change from dimstyle1 to dimstyle2 if dimstyle2 was on a closed drawing. If so What changes should I make to my code. Public Class Class2 <CommandMethod("changedimstyle")> _ Public Sub ChangeDimStyle() Dim doc As Document = Application.DocumentManager.MdiActiveDocument Dim db As Database = doc.Database Dim ed As Editor = doc.Editor Using trx As Transaction = db.TransactionManager.StartTransaction() Dim dimTbl As DimStyleTable = trx.GetObject(db.DimStyleTableId, OpenMode.ForRead) Dim dimDtr As DimStyleTableRecord = trx.GetObject(dimTbl("DimStyle1"), OpenMode.ForRead) Dim ids As ObjectIdCollection = dimDtr.GetPersistentReactorIds() For Each objId As ObjectId In ids If objId.ObjectClass.IsDerivedFrom(RXClass.GetClass(GetType(Dimension))) Then Dim dimen As Dimension = trx.GetObject(objId, OpenMode.ForWrite) dimen.DimensionStyleName = "DimStyle2" End If Next trx.Commit() End Using End Sub End Class Quote
BlackBox Posted November 26, 2011 Posted November 26, 2011 Please do not post duplicate threads. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.