- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm having trouble creating dimension styles. The process I take is this... Assign and/or change dimension variables, name the dimension style, add the dimension style record to the dimension style table. This process creates the dimension style as wanted, but creates a dimension override... that's not what I want... as an example I have attached the code...
Public Sub CreateDimStyle()
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
Dim DimStyleName As String = "English"
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
Dim acDimStylTbl As DimStyleTable = acTrans.GetObject(acCurDb.DimStyleTableId, OpenMode.ForRead)
Dim acDimStylTblRec As DimStyleTableRecord
'Assign dimension variables
acCurDb.Dimalt = 0
acCurDb.Dimaltd = 2
acCurDb.Dimaltf = 25.4
acCurDb.Dimaltrnd = 0.0
acDimStylTblRec = New DimStyleTableRecord()
acDimStylTblRec.Name = DimStyleName
If acDimStylTbl.Has(CEGDimensionStyle) = False Then 'If dimension style does not exist, create it
If acDimStylTbl.IsWriteEnabled = False Then acDimStylTbl.UpgradeOpen()
acDimStylTbl.Add(acDimStylTblRec)
acTrans.AddNewlyCreatedDBObject(acDimStylTblRec, True)
Else 'Dimension style exists... open style record for changes
acDimStylTblRec = acTrans.GetObject(acDimStylTbl(DimStyleName), OpenMode.ForWrite)
End If
acTrans.Commit()
End Using
End Sub
The above code inserts the dimension style with an override (if you were to look in the dimstyle dialog box for instance) if you set the above dim style to the current style. Any ideas on what im doing wrong? I want to set the newly created dim style in the above code to the current dim style WITHOUT an override and with all the dim style settings saved.
Please... any help is greatly appreciated! Thanks in advance.
Solved! Go to Solution.