- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear all,
Here i have one question,
while using myDBt.Save() program is terminating,
Is there only way to use myDBt.saveas()
Please give me suggession...
{code}
PublicSub text_replace_CAD(ByVal fname AsString, ByVal old_string AsString, ByVal new_string AsString)
Dim myTranst AsDatabaseServices.Transaction
Dim myTransMant AsDatabaseServices.TransactionManager
Dim myBTRt AsBlockTableRecord
Dim myBTt AsBlockTable
Dim myDBt AsNew DatabaseServices.Database(False, True)
If fname.ToUpper.EndsWith("DWG") Then'myDBt.ReadDwgFile(fname, IO.FileShare.ReadWrite, True, "")
myDBt.ReadDwgFile(fname, FileShare.ReadWrite,
True, "")
EndIf
myTransMant = myDBt.TransactionManager
myTranst = myTransMant.StartTransaction
myBTt = myDBt.BlockTableId.GetObject(OpenMode.ForWrite)
myBTRt = myBTt(BlockTableRecord.ModelSpace).GetObject(OpenMode.ForWrite)
Dim myBTEn AsBlockTableRecordEnumerator = myBTRt.GetEnumerator()
WhilemyBTEn.MoveNext
Dim acEnt As Entity = CType(myTranst.GetObject(myBTEn.Current, OpenMode.ForWrite), Entity)
SelectCaseacEnt.GetType.Name.ToUpper
Case"DBTEXT"Dim dbt AsDBText = acEnt
dbt.TextString =
"Mabani"Case"MTEXT"Dim mtb AsMText = acEnt
mtb.SetContentsRtf(
"Mabani")
Case"RotatedDimension".ToUpper
Dim mtb AsRotatedDimension = acEnt
mtb.DimensionText =
"Mabani"EndSelectEndWhile
myDBt.Regenmode =
True
myDBt.CloseInput(
True)
myTranst.Commit()
myDBt.SaveAs(fname, DwgVersion.Current)
myDBt.Save()
myTransMant.Dispose()
EndSub
{code}
Solved! Go to Solution.