.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
creating a text style
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hello Group, this is my attempt, taken from snippets given here, but i obviously havent got the whole picture:
PublicSharedSub CreateTextStyle(ByVal TextStyleName AsString, ByVal FontFileName AsString, ByVal OblAng AsDouble)
Dim DataB AsDatabase = Application.DocumentManager.MdiActiveDocument.Database
Dim MyTransaction AsTransaction = DataB.TransactionManager.StartTransaction()
Try
Dim MyBlockTable AsBlockTable = MyTransaction.GetObject(DataB.BlockTableId, OpenMode.ForRead)
Dim MyBlockTableRecord AsBlockTableRecord = MyTransaction.GetObject(MyBlockTable(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
Dim MyTextStyleTable AsTextStyleTable = MyTransaction.GetObject(DataB.TextStyleTableId, OpenMode.ForRead)
'check to see if text style exists, and if not create text style
If MyTextStyleTable.Has(TextStyleName) = FalseThen
MyTextStyleTable.UpgradeOpen()
Dim MyTextStyleTableRecord AsNewTextStyleTableRecord
MyTextStyleTableRecord.FileName = FontFileName
MyTextStyleTableRecord.Name = TextStyleName
MyTextStyleTableRecord.ObliquingAngle = OblAng
MyTextStyleTable.Add(MyTextStyleTableRecord)
MyTransaction.AddNewlyCreatedDBObject(MyTextStyleT
True)
EndIf
Finally
MyTransaction.Commit()
MyTransaction.Dispose()
EndTry
EndSub
and i call it from sub:
Call CreateTextStyle("330", "romans.shx", DTR(330))
but error comes up
at Autodesk.AutoCAD.DatabaseServices.Transaction.GetO
any help would be appreciated !
Solved! Go to Solution.
Re: creating a text style
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
1. First of all let using Insert Code button:
2. What kind of error happened (full description and error code)? Maybe eLockViolation ? If so you have to Lock/Unlock document.
Re: creating a text style
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Alex,
nearly there then!
Dim
lock AsDocumentLock = Application.DocumentManager.MdiActiveDocument.LockDocument
etc....
lock.Dispose()
works fine, thank you for response



