How to retrieve scene's camera representation entities?

Hello,

When creating a scene with camera, sketchup adds entities which represents camera geometry and lines and volumes. It also adds layer as shown below:

image

Is there a way to retrieve these layers reference from the model (with a SUModelRef) or the scene (with a SULayerRef).
May be the layer itself contains the information?

Whatever my goal is to be able to make the relation between a scene and its corresponding camera representation (camera, volume, lines).

Thanks,
Manuel

The Advanced Camera Tools is a shipped SketchUp extension, not core functionality. It is usually a bad idea to build upon other extensions, as you don’t know if they will change in the future.

Advanced Camera Tools has no public API, meaning whatever you find works from experimenting with it just happens to work by chance, not by its design.

2 Likes

I thought it was part of the API, as it is shipped with Sketchup.
Thanks for the info!

Only the top level model itself has (and “owns”) the collection of layer objects that the model contains.

Layers in SketchUp are not used exactly like CAD layers. In SketchUp layers are simply shared display behaviors, that are “used” by multiple drawing objects. SketchUp layers do not have a geometry entity collection, and are not used to separate SketchUp’s “sticky” geometry. Component Instances and Groups are the objects that separate geometry.

The scene pages will keep a collection of layer visibility states, if the scene page is set to do so, but do not “own” any of the layers in this list.

Sketchup::Layer objects do not own a scene page collection.
Only the top level model itself has a collection of scene pages.

As said above, these are created by the ACT extension, so most likely there are ACT extension specific attribute dictionaries attached to the ACT camera entities and/or ACT generated scenes.

The layers created by the ACT extension do not as said above “own” geometry, but geometry, groups or component instances can be set to honor the visibility setting of these layers. It looks to me that all ACT camera entities share the “Lines” and “Volume” layers, so they’ll ALL be hidden or visible depending upon the setting for these layers.
Meaning that each ACT camera does not have it’s own set of layers.

A scene page in SketchUp can be set to remember the visibility state of layers and the view API camera (which is a low level API entity, not the geometric ACT camera entities that the extension creates… This is likely to cause you some confusion.)

As I mentioned above, scene pages have a layers collection used to remember visibility states for the scene if the “use Hidden Layers” flag is set true. If it is false, then this collection is probably empty. Again this layers collection is not a set of layers that a scene “owns”, it is only a subset of the model’s layers that are in a certain visibility state (either hidden or shown, I don’t know which myself, test if you wish to know yourself,) … and only if the “use Hidden Layers” flag is set.


I second what Christina said. But it might not hurt to simply attach custom attribute dictionaries to ACT camera instances so that your extension could create a report for example.

But as always, if Trimble changes the ACT extension in the future, your extension could break.

1 Like

One good things is that ACT stores all entities in the same layer, so it’s easy to show/hide this in a single click.
Many thanks Dan for that clear and accurate feedback.

I don’t recall the exact details without looking at the source. (I’m at home right now.) But there should be a number of attributes on the component definition/instances for the cameras. There might be some model attributes - but I’d need to look that up.

Note that attributes etc of the ACT is an implementation detail - so it could potentially change at any point.

1 Like