Hi Jørn.
To better understand what alignScopeToGeometry() is doing, you can use the Model Hierarchy (Window -> Show Model Hierarchy). This let you see the scope axis for your objects at each level in the rules. Click on your model in the scene, and then click on the "Inspect Model" button (2nd button to the right of the "Generate" button on the toolbar along the top). Then a tree shows up in the Model Hierarchy window. It starts with your root node (trase), and the next level of the tree is the rule lagHoyspent. Click on this level to see how the scope is positioned when you call this rule (right before the rule is executed, after the split). On the model, the x axis is drawn in red, y is green, and z is blue. The last level in the tree shows how the scope is positioned after the rule lagHoyspent is completely exectued. alignScopeToGeometry(yUp, any, longest) aligns the x axis to the longest edge.
Hopefully, the Model Hierarchy would help you understand what was going on with the translation problem as well.
I'm glad you found a solution (Ben, thanks for the solution!). Be careful though because it might work differently for both cases of polygons where (a) the short side of the polygon is larger than avstand or (b) the short side of the polygon is smaller than avstand. Perhaps you don't need to care about both cases though.
Another solution would be to align the x axis to the longest edge of your polygon, then split in x, and then without realigning the scope, just resize the scope and insert the object.
@StartRule
trase -->
alignScopeToGeometry(yUp, any, longest)
split(x){~avstand: lagHoyspent}*
lagHoyspent -->
s('1, hoyde, bredde) // the scope size in the x dir will be avstand from the split
center(z)
i(poleAsset)
color (farge)