Can you change the object handle of a Civl3D object?

If I have a pipe00 with object handle 12345
Then I delete this pipe and create a new pipe 01 with object handle 54321

Is there a way to change the object handle from 54321 back to 12345?

It appears to be read only in the API dev guide.

Handles cannot be manually assigned.

If memory serves they are sequential in nature (so if you had 12345 the next one would be 12346).

Short answer is no. The handle is a unique ID for an object (within the scope of a drawing) and is auto-generated and immutable.

I’m curious to better understand the problem you’re trying to solve?

1 Like

Me as well.

My theory is that when changes occur, it is better to preserve the OBJECTHANDLE of pipes and structures.

if structure01 is DREF’d into many other .dwg files, and in those files, the structure is projected into many profile views, you don’t want to delete the source object, and recreate it. In this case, you orphan any downstream process (profile view project) that was using structure01.

So you need to respect a complicated change mgmt process.

If we could manually assign OBJECT HANDLE, you might be able to ignore change mgmt proceedures more.

For example, I could delete all pipes and structures, and recreate them all from a polyline that is only slightly different than the polyline from yesterday. When complete, I can assign all the same OBHECT HANDLES to any object that didn’t change.

Downstream .dwg files with DREFS and profile views would not be orphaned. And I wouldn’t have to have some complicated dynamo that is multi threaded that solves for

object exists, but don’t want to change it
object exists, but need to change it.
object exists, need to delete it.
object doesn’t exist, need to create it.

See like this is easier,

delete everything, recreate everything, match any objecthandles you can (and in doing so trick all the downstream files into thinking nothing happened).

hope that makes sense. Prob doesn’t :slight_smile:

Yep, makes perfect sense.

This is the root cause of the whole issue. If the source Polyline is modified, then the integrity of all the downstream processes will be preserved because Dynamo will “bind” to that Polyline (using it’s handle) and update any derived pipes/structures accordingly. However, if “slightly different” for the Polyline means anything other than making modifications, then from the computer’s perspective it isn’t a “slight change” anymore - it’s a completely different object. Most people don’t think this way for non-named objects like AutoCAD geometry, so it’s going to be challenging to try and manage Polylines the same way that you might manage things like Alignments, Surfaces, etc. For example, as soon as someone offsets the Polyline and deletes the old one, the whole workflow is broken.

Now, about the Data Shortcuts. How are the pipes/structures in the downstream drawings “linked” back to the objects in the source drawing? By default, they are linked using the object handles as the unique “key” that ties things together. As stated earlier, you don’t have any control over the handles, but you DO have control over the names.

Notice the edit in the quote above. You can accomplish what you’re after by changing the behavior of the data shortcuts to “link” using the names instead of the handles. This can be done using the Data Shortcuts Editor. Might not be the silver bullet, but worth a try.

1 Like