How create a ramp with angle with python script
Add cube, resize, subdivide, move edge.

Image showing 3 test runs as in listed in code below
There are many ways to skin this cat, thought I would add a method to
Add a unit cube, scale to desired width x depth x height, and translate such that origin is as in question. (Could IMO use COG as origin and translate later)
The 4 vertical edges of cube are always the same index, will subdivide these, Insert new vertices into face using pyhton &amp; bmesh  Notice that the subdivide percent of each edge needs to be flipped depending on vert 0 of edge.
Finally the 11th original edge of cube is moved using Pythagoras (tangent)
import bpy
import bmesh
from mathutils import Matrix
from math import radians, tan

context = bpy.context

def add_ramp(x, y, z, ramp, angle):
    bm = bmesh.new()
    bmesh.ops.create_cube(
            bm,
            size=1,
            matrix=(
                Matrix.Diagonal((x, y, z, 1)) @
                Matrix.Translation((.5, .5, .5))
                )
            )
    pc = ramp / z
    bm.edges.ensure_lookup_table()
    edge = bm.edges[11]
    edges = [bm.edges[i] for i in (1, 3, 6, 9)]
    bmesh.ops.subdivide_edges(
            bm,
            edges=edges,
            edge_percents={
                e : (pc if e.verts[1].co.z &gt; e.verts[0].co.z else 1 - pc) 
                 for e in edges},
            use_grid_fill=True,
            cuts=1,
            )
    bmesh.ops.translate(
            bm,
            verts=edge.verts,
            vec=(0, (z - ramp) * tan(angle), 0),
            )
    me = bpy.data.meshes.new(&quot;Shape&quot;)
    bm.to_mesh(me)
    ob = bpy.data.objects.new(&quot;Shape&quot;,me)
    bpy.context.collection.objects.link(ob)
    
add_ramp(4, 8, 10, 5, radians(30))
add_ramp(4, 8, 10, 6, radians(45))
add_ramp(4, 8, 10, 5, radians(-30))