Community
Hello again,
I need to use the Handle of the cloned object during a DeepClone override but AutoCAD shuts down when I try to use it.
This is the best I can think of but it still boots me out when I try.
Public Overrides Function DeepClone(ByVal dbObject As DBObject, ByVal ownerObject As DBObject, ByVal idMap As IdMapping, ByVal isPrimary As Boolean) As DBObject Try Return MyBase.DeepClone(dbObject, ownerObject, idMap, isPrimary) Catch Finally CompileCloneObjects(dbObject.Handle.ToString, MyBase.DeepClone(dbObject, ownerObject, idMap, isPrimary).Handle.ToString) End Try End Function
My guess is that you are trying to access the handle of the new object, before it has been assigned a handle. I believe you are going to need to use the IdMap to accomplish whatever it is you are trying to do.
II can't seem to work out how to use the idmap and spent a good while trying. I'm finding alternatives though.
A bit clumsy but this seems to work.
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor Try Return MyBase.DeepClone(dbObject, ownerObject, idMap, isPrimary) Catch Finally Dim psr As PromptSelectionResult = ed.SelectLast() If psr.Status = PromptStatus.OK Then For Each so As SelectedObject In psr.Value ObjHandle = so.ObjectId.Handle.ToString Next End If CompileCloneObjects(dbObject.Handle.ToString, ObjHandle) End Try