I have been struggling quite a bit to work out how to control trim planes and how and when they will work and on what.
In this example, I've been trying to write a script for an Utzon courtyard house (see pic). Basically, it's an L-shaped building on two sides of a courtyard with a shed roof raising outward from the courtyard. Now, the way I constructed the roof (see script), it requires a split to miter the two roof parts in order to avoid overlapping geometry where they meet. But I can't make it work.
Could someone please give an overview of how to use trim? Because I obviously either don't know, or I try to make it do stuff which it can't do. In the latter case, is there an alternative way for me to reach my goal?

/**
* File: trimWalls.cga
* Created: 23 Jun 2015 12:13:04 GMT
* Author: Nic
*/
version "2015.0"
attr floorH = 3
attr bldgW = 8
attr wallThickness = 0.35
attr roofAngle = 30
@Startrule
Lot --> RoofBase01 RoofBase02 shapeL(bldgW, bldgW) {shape : Footprint | remainder : rotateScope(0,180,0) Garden }
Garden--> shapeL(wallThickness, wallThickness) { shape : extrude(floorH*0.75) GardenWall | remainder : Ground }
Footprint --> extrude(floorH) Envelope
RoofBase01 --> t(0,floorH,0) rotateScope(0,90,0) split(x) { bldgW : set(trim.horizontal,true) set(trim.vertical,true) trim() roofShed(roofAngle, 2) Attic | ~1 : NIL }
RoofBase02 --> t(0,floorH,0) rotateScope(0,90,0) split(z) { bldgW : set(trim.horizontal,true) set(trim.vertical,true) trim() roofShed(roofAngle, 1) Attic | ~1 : NIL }
GardenWall --> comp(f) {side : Wall | top : Crown }
Envelope --> comp(f) {side : Wall }
Attic --> comp(f) {vertical : Wall | top : Roof }
Wall --> color(0.9,0.8,0.6)
Crown --> color(0.7,0.7,0.7)
Roof --> color(0.9,0.7,0.6)
Ground --> color(0.2,0.6,0.2)