.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cloned ObjectID or Handle using an Overrule

2 REPLIES 2
Reply
Message 1 of 3
SRSDS
329 Views, 2 Replies

Cloned ObjectID or Handle using an Overrule

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

 

 

2 REPLIES 2
Message 2 of 3
chiefbraincloud
in reply to: SRSDS

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.

Dave O.                                                                  Sig-Logos32.png
Message 3 of 3
SRSDS
in reply to: chiefbraincloud

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

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost