How to creat SUInstancePath correctlly?

    SUInstancePathRef instance_path = SU_INVALID;
    SUInstancePathCreate(&instance_path);
    SUInstancePathPushInstance(instance_path, instance_ref);
...
   SUInstancePathRelease(&instance_path);

After SUInstancePathPushInstance or SUInstancePathSetLeaf, I can’t receive ViewObserver change event. Is this a bug? Or didn’t I creat the path correctly?

An instance path is just a set-like construct containing related entity references.

It does not affect the view in the live application unless it is used as an argument to the Ruby API’s Sketchup::Model#active_path= method. Even so, setting (changing) the model’s active edit path does not cause the Ruby API ViewObserver#onViewChanged callback to fire.

The C API does not (yet) expose the View object for use by C extensions. However, there is an open API feature request …


In testing this, I noticed that when using the code snippet from the InstancePath constructor documentation, it did fire the ViewObserver#onViewChanged callback, but for the geometry creation before creating the instance path.

This observer callback firing only happened in a newly opened model the first time. Thereafter, the observer callback did not fire. So, this seems to be a bug that should not be relied upon.