Set cplane perp to curve BUT vertical

What would be the best solution (fewest scriptable steps) to set cplane perp to a curve but also vertical in respect to world plane. If it is too easy could anyone make such script and share it here? Thank you very much. I even think this option could be default in rhino since sections in civil engineering are usually vertical and perp to some alignment curve. The same goes with clipping plane definition (there is along curve option but not vertical and along curve)

Thank you

do you mean something like this ?

screenshot still shows world xy cplane
tangent of 3d curve (pink)
projected (by black vector) tangent to be parallel to World xy (blue)
becomes normal of new c-plane (grey surface for illustration)
rotation of c-plane - x axis parallel to world xy

as a non native speaker - but i would try to describe like this:
the x,y component of the tangent of the curve will become the normal of the new c-plane ?
x-axis parallel to world-xy plane

kind regards - tom

Hi Ivan - this may do it - uses vertical to World only…

import Rhino
import rhinoscriptsyntax as rs

def test():
    id = rs.GetObject("select the curve", 4, preselect=True)
    if not id:
        return
    crv = rs.coercecurve(id)
    
    pt = rs.GetPointOnCurve(id)
    if not pt:
        return
    
    rc, par = crv.ClosestPoint(pt)
    
    rc, frame = crv.PerpendicularFrameAt(par)
    
    cPlane = Rhino.Geometry.Plane.WorldXY
    cPlane.Origin = pt
    
    zPt = cPlane.ClosestPoint(frame.Origin + frame.ZAxis)
    vecZ = pt-zPt
    if not vecZ.IsTiny():
        newCPlane = Rhino.Geometry.Plane(pt, vecZ)
        rs.ViewCPlane(plane = newCPlane)
    
    pass
    
test()

-Pascal

alternative is to use cross-product to “juggle” perpendicular vectors…

import rhinoscriptsyntax as rs
import Rhino.Geometry as rg

def SetVerticalCPlane():
    obj = rs.GetObject("Select a curve", rs.filter.curve)
    if obj:
        point = rs.GetPointOnCurve(obj)
        if point:
            param = rs.CurveClosestPoint(obj, point)
            tangent = rs.CurveTangent(obj, param)
            vecY = rg.Vector3d(0.0,0.0,1.0)
            vecX = rg.Vector3d.CrossProduct(tangent,vecY)
            if vecX.IsTiny():
                return
            pl = rg.Plane(point,vecX,vecY)
            rs.ViewCPlane(plane=pl)

SetVerticalCPlane()