[C API] Modified definitions keep the same GUID

It looks like when I modify the content of the entities collection of a component definition with the C API, the definition’s GUID is not changed.

Is this a known issue? Is this expected?

Is there a known way to trigger a GUID change in the C API?

I also tried changing the name, description, axes, and behavior of the definition, with no success.

I looked into duplicating the definitions, but it looks like in the C API we can’t assign a new definition to an existing instance (we can in the Ruby API). So this forces me to parse the whole hierarchy to also duplicate all instances, with their attributes and all properties, etc.
And it’s even worse for groups…

Not until now.

I would expect it to have as it does within SketchUp (Ruby API being a guide).

Not that I know of. I’m not sure how the GUID updates work from within the application. Would have to investigate. It’s strange that C API doesn’t exhibit this behaviour, as I’m not seeing the Ruby API doing anything particular with GUIDs. Would expect the core to take care of this.

In the live API I would think GUID update is connected to the transaction. It would make sense as it is updated on every change and would also explain where this functionality isn’t included in the non-live API.

In the Ruby API, the change of GUID for a definition seems to take place after a commit_operation.

Did you try this in the C-API?

How would a coder implement an undo operation via the C API ?
(I do not find any function with the word “commit” within it.)

The C API doesn’t have any functions to deal with transactions. The standalone version creates a model without undo enabled. This is why the Live C API is read only.

2 Likes

Do you want me to file a bug report on github?

Makes sense.

1 Like

Yes please.

Done.

2 Likes