If you want to write completely new object different from Stds, then try so:
1. Create new object [ File>GDL Objects>New Object... ]
2. Use Subtype Template ("Select Subtype" Button) [ General GDL Object>Model Element>Opening>Wall Opening>Window (Wall) ].
3. Open Niche Object(s) from AC9 Std Lib. to look how they are written. In another words use them as example.
4. Also look in GDL help: [ GDL Reference Guide > Miscellaneous > Doors and Windows > Non-Rectangular Doors/Windows in Straight Walls ]
You can also just develop any Niche object from GS and save object under another name.
Also,see the Intro to Object Making book (PDF) or section of the F1-online help in AC 9.
You can create a custom wall niche by creating the shape slab you wish the niche to have and giving the slab the ID of "wallniche". Save this as a GDL window or door, and it will be a niche of the modeled depth.
Also, if this is a one-off, another method is to use an appropriate shape and solid element subtract it from the wall. Note that this may well be the desired approach is your wall is a log wall or otherwise has reveals. The niche objects use the 'trick' of cutting a hole, and then re-filling the cut with a back and sides of a material matching the wall material. In a log wall, this results in a solid side to the niche, where in reality you want the log reveals. Ditto any other kind of reveal (blockwork, etc.)
So, it just depends on the result you want and how general of a niche object you want as to which approach you take.
One of the forum moderators AC 27 USA and earlier • macOS Ventura 13.6.2, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB