here is an example of me splitting up an STL for an LPX profile keycap which has a choc switch stem:
https://github.com/wolfwood/printed-keycap-mods/blob/738607ae7a4a48b24030c2fea899623cefc17bdb/LPX/LPX.scad#L3-L23
the LPX module imports the STL and manually repositions it to sit on the origin.
LPX_legs "selects" the stem using a cube.
LPX_shell removes the stem using a cube with identical dimensions.
in LPX/MX.scad I take the LPX_shell and stick on a printing-friendly MX-compatible stem from rsheldiii's fantastic keycap generator https://github.com/rsheldiii/KeyV2
https://github.com/wolfwood/printed-keycap-mods/blob/develop/LPX/MX.scad#L36-L42
is your keycap for an MX switch (cross shaped stem?) or a kailh box switch (cross with a box)?
to get a nice top surface on a keycap it would be ideal to print it at a 90° y rotation (with the layer lines running the same direction as your finger), but then the stem would need to be completely supported. as a compromise, its best to print with a 45° rotation on the y axis so the stem only needs to be supported at the base, and the resolution is still finer on the top.
a "normal" MX stem is round, but it ends up with very thin areas where the corners of the cross cutout approach the edge of the cylinder. its also a bit janky to print at 45°. so rsheldiii's KeyV2 uses a shape that fills the available space above the switch stem completely, with long cut outs for the cross. I've also seen ppl use a shape made of rectangles like a # with the inner square removed. this is easier to print (but it won't fit a box switch). my code additionally cuts the edges that the stem will be supported on at a 45° angle so its easier to support (not standing on a corner).
the LPX keycaps were designed with 3D printing in mind and their choc stems also have a 45° chamfer. i got a lot of the ideas in my 3D printed keycap library from the recommendations made by the designer of LPX, which i link to here: https://github.com/wolfwood/printed-keycap-mods/tree/738607ae7a4a48b24030c2fea899623cefc17bdb#print-keycaps-that-feel-great