Hi, I need to open a bunch of drawings, update a block and then save. I am trying to do it without opening each drawing in AutoCAD. Here is the code snippet I have. I figured before I plug in my block editing code, I would test things out with just adding a line. It seems to be boing through the drawings, and I get no errors, but the line is not being added. What am I missing here? Any suggestions to improve how I'm doing this would be greatly appreciated.
thanks
Try
Dim mydb AsNewDatabase(False, True)
mydb.ReadDwgFile(Newfname,FileOpenMode.OpenForReadAndWriteNoShare, True, "")
Using Trans AsTransaction = mydb.TransactionManager.StartTransaction()
Dim btr AsBlockTableRecord = Trans.GetObject(mydb.CurrentSpaceId,OpenMode.ForWrite)
Using myline AsNewLine(NewPoint3d(0, 0, 0), NewPoint3d(10, 10, 10))
btr.AppendEntity(myline)
Trans.AddNewlyCreatedDBObject(myline,True)
EndUsing
Trans.Commit()
EndUsing
mydb.SaveAs(Newfname,True, DwgVersion.Current, mydb.SecurityParameters)
Catch ex As Autodesk.AutoCAD.Runtime.Exception
EndTry