Clone a polyline with a new objectId

Clone a polyline with a new objectId

p_jones2_1983
Explorer Explorer
328 Views
2 Replies
Message 1 of 3

Clone a polyline with a new objectId

p_jones2_1983
Explorer
Explorer

Is it possible to clone a polyline so that it has a new objectId?

0 Likes
Accepted solutions (1)
329 Views
2 Replies
Replies (2)
Message 2 of 3

ActivistInvestor
Mentor
Mentor
Accepted solution

Cloning any DBObject produces a new object that is not in any Database. A DBObject cannot have an ObjectId unless it is added to a Database. You can call BlockTableRecord.AppendEntity() and pass it a new object (such as the one returned by calling Clone()), and it will append the entity to the BlockTableRecord and assign an ObjectId to it.

 

You can also use Database.DeepCloneObjects() to clone existing entities to a new owner or to the same owner, and that API will take care of adding the clones to the Database/owner., and assigning them ObjectIds.

 

You can search this group for 'DeepCloneObjects' to find examples of its use, or wait for someone to write one for you (sorry, I don't have time for that).

0 Likes
Message 3 of 3

p_jones2_1983
Explorer
Explorer

i can code i just needed to know the procedure. thanks for the advice and will give it a try.

0 Likes