Public destDb As New Database(False, True) Public sourceDb As New Database(False, True)
Private Sub doc_CommandWillStart(ByVal sender As System.Object, ByVal e As Autodesk.AutoCAD.ApplicationServices.CommandEventArgs) If e.GlobalCommandName = "COPYCLIP" Or e.GlobalCommandName = "COPYBASE" Or e.GlobalCommandName = "CUTCLIP" Then sourceDb = HostApplicationServices.WorkingDatabase
destDb = HostApplicationServices.WorkingDatabase If sourceDb = destDb Then Dim SourceNOD As DBDictionary = trans.GetObject(sourceDb.NamedObjectsDictionaryId, OpenMode.ForRead)
Hi Jeff,
Do I need to open and wrinte all dictionariesI use that way? Even the NOD.
Dim NOD As DBDictionary = trans.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForWrite)
NOD .TreatElementsAsHard = True
I do not know what you are doing and would have to look back at the docs, but off the top of my head it might work if the entity contains a extension dictionary with a reference to the entry or the entry references the entity as hard pointer
Another way is subscribe on Autodesk.AutoCAD.DatabaseServices.Database.BeginWblockObjects event.
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Manually copying objects between drawings triggers what I want to do but doesn't affect it.
I want to be able to read from the source drawing database NOD.
I get an eNotFromThisDocument error on this line.
Dim SourceNOD As DBDictionary = trans.GetObject(sourceDb.NamedObjectsDictionaryId, OpenMode.ForRead)
Looks like it was the way I was defining the transaction. I was starting the transaction using the active document's database. This seems to work.
Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = sourceDb.TransactionManager Dim trans As Transaction = tm.StartTransaction()