Sketchup API how to activate a section plane

I define a SUSectionPlaneRef to get a cut view of a wall. I know for sure that the plane I use is correct, but still I can’t get the result I want in a layout. I’ve checked its active status with SUSectionPlaneIsActive and it is obviously not active so that would be my first guess.

So for now I have a scene with a camera placed vertically above my wall, and I can get a correct view of th top of the wall. I would like the section plane I define to be taken into account so that i can generate a “top” view of the inside of the wall.

Activate the section in that scene then update the scene (make sure the section cuts property is checked in the scene), save, then update the reference in Layout.

  1. The first thing you need to do is add the section plane object to some entities collection.

  2. An entities collection can contain one to many section plane objects, but only one can be set active at any time.

  3. A section plane cuts only through the entities in the same context. If you want to cut through the whole model, then add the section plane to the model’s entities collection. If you want to cut only part then group what you want to cut through and add the section plane to the group’s entities collection.

  4. You need to set the flag for your scene so it will use section planes.

  5. However, I do not see a C API function to set a section plane object to active. Opening an issue:

Oops, sorry I’m on pain meds for my hip and missed this was regarding API. Sorry about that.

1 Like


I’ve already added the section plane to my model’s entities, and I’ve also set the scene flag useSectionPlanes to true.

Just to let me know, it won’t be able to work until there is a way to activate the section plane, is that correct? I can spend my time on other things then.

Thank you,


I guess not unless you use a template model with a section plane that is already activated. Just change it’s plane to suit.

Another workaround (if you want the section plane nested) might be to import a component file that has an active section plane inside it. And then add entities to the component definition.

Good evening Dan,

I’ve tried the following workaround:

  1. I have a .skp file representing a full house (let say house.skp) and containing an active section plane.
  2. I make a model from house.skp, look for its active section plane and store it in a static variable (let say SUSectionPlaneRef _activeSectionPlane)
  3. I isolate a wall in the house and save it in an other skp file (let say wall.skp) using SUComponentInstanceSaveAs
  4. I create a model from wall.skp
  5. I add _activeSectionPlane to this model’s entities
  6. I set its plane to suit my needs
  7. I create a scene with the flag set to take section planes into account
  8. I generate a layout based on this scene much like the sample GenerateLayoutFromSkp

And then I get this soooo weird warning message: “Warning: Cannot call WriteClass/WriteObject for CObject.” and crash.

I’ve checked the return status of every single SU function calls concerned, and everything seems fine to me.

Any clue what could be going wrong? Both models from house.skp and wall.skp coexists(i.e. the first one is not yet released when i’m using the second), so _activeSectionPlane is actually present in both model’s entities.

SUComponentInstanceSaveAs function has SERIOUS issues! See the issue thread:

What does “isolate” mean ? If you grouped the wall and then saved it out, the “wall.skp” should not have a model level section plane.

The same object cannot be a member of both model databases.
One would have to be a copy of the other.

Okay, I see in step 5 you are attempting to assign the “house.skp”'s section plane to the “wall.skp”'s entities. You cannot do this.

Not surprised that the app crashes.

Would that work if if I change the plane of the active section in the “house” model? I mean, if the active section in the house model intersects the wall i save in wall.skp, would the function SUComponentInstanceSaveAs also save this section?

I’m not sure what “that” is. Simply stated, geometry objects cannot be added to more than one model collection.

I’m sorry, there is no way around this. Once you add the “unowned” C API object to a model collection, it thereafter belongs to that model and it’s collection.

Unfortunately, no. The section plane is not just “in” the house model, it’s in the model’s entities collection. The wall (if it is a component) has it’s own entities collection, so doing a saveAs on the wall will not save the model’s section plane object because it’s not a member of the wall’s entities collection.

I do not know why, but the C API lacks copy / cloning functions, as well as explode functions which (if they existed) could help you greatly. We’ll just have to wait until these functions are implemented.
If you have more input or complaints, add your comments to the issue threads in the GitHub Issue Tracker for SketchUp APIs.

Your only recourse would be to create a new section plane in the wall’s entities collection and copy properties from the existing section plane in the other entities context.

But again, you are limited by the lack of an active setter function for section planes. So, (again) the only workaround I can think of is to use a component file that has an active section plane built-in, and load that component definition, create and place it’s instance as a wall component, and then add your wall geometry into it’s definition. And of course, manipulate the 2nd section plane’s properties as you need.

As I said earlier, that function has serious issues. (Ie, I would not recommend trying to use it.)
The C API really needs a correctly implemented SUComponentDefinitionSaveAs function (as it’s actually the definition that owns the geometric entities collection, not the instances.)

Hello, So far I’ve tried this other workaround:

  1. create a model from the file “house.skp”
  2. remove all scenes, layers, groups, instances and unactive section planes from this model
  3. save it (using SUModelSaveToFile) into the file “template.skp”
  4. create a model from this file
  5. get the group definition corresponding to the wall i wall
  6. create an instance of this group definition and add it to this model’s entities.

And I get stuck again right here: SUComponentDefinitionCreateInstance return SU_ERROR_GENERIC.

Any idea what this means? Can’t I create a group instance like that?
I really don’t get what i am doing wrong. Any help would be appreciated.

Well the docs say …

SU_ERROR_GENERIC if comp_def is not the definition of a type that can be instantiated

… which is weird as I though that it was only image definitions that they wanted to “restrict” access to.

I cannot see any other way to add a group instance to an entities collection.

@tt_su ?

Good morning Dan,

Now I’ve tried the following steps:

1) create a model from the file “house.skp”
2) remove all scenes, layers, group definitions, groups,instances and unactive section planes    from this model
3) save it (using SUModelSaveToFile) into the file “template.skp”
4) create a model from this file
5) create all the instances composing the wall I want
6) generate a layout and export it to .pdf format.

Everything seems to work fine, I’m quite sure I have all the instances I need in my model, I can definitely create the layers and the scene I want, BUT:

function LODocumentExportToPDF returns the error code SU_ERROR_SERIALIZATION, no .pdf file is saved (while it worked before all this mess with the active plane).

Do you have any idea why? Are there things that need to be done for visualization after having created an instance? Any links with the materials for example?

Right now I’m trying to generate layouts directly from the original house model, but that seems rather complicated and time consuming.

This is a separate issue that needs it’s own topic thread.
I’ve not messed with PDF export via the LO API yet myself.