Hi,
For vertical opening, you should use shaft opening API NewOpening(Level bottomLevel, Level topLevel, CurveArray profile) instead:
Following code works well against your floor:
// find two levels for shaft opening
FilteredElementCollector coll = new FilteredElementCollector(doc);
var levels = coll.OfClass(typeof(Level)).ToElements();
Level bottom = levels.First(x => x.Name == "1ST FLOOR") as Level;
Level top = levels.First(x => x.Name == "2ND FLOOR PLATE") as Level;
using (Transaction t = new Transaction(doc, "d"))
{
t.Start();
// code works when 3rd argument in the line below is true
// when it is false (to make a vertical cut), it fails with "Can't change plane of Opening Cut Sketch."
//Opening opening = doc.Create.NewOpening(roof, openingCa, false);
Opening opening = doc.Create.NewOpening(bottom, top, openingCa); // create shaft opening
t.Commit();
}
As for why the API you called doesn't work, the root cause should be your floor has slope and slope floor cannot allow vertical opening: For example, you can remove the slope of floor and then your code can work well; another finding is: after creating vertical opening against floor without slope, same error will popup if you try to change the slope of floor which already has vertical opening.
Revit SDK samples have sampes named Openings and ShaftHolePuncher demonstrate different opening behaviros; again, from viewpoint of Revit UI, Revit also provides separated opening-by-face and shaft-openning for different purpose. so we should use appropriate opening API for different opening situtations.
Hope it's helpful.