Babylon Editor Set Mesh Programmatically

Hello! I’m currently learning to use the babylon editor. In the editor, you can add a mesh to the scene and then attach a script to it. This script can then alter the position/rotation/etc of that mesh by referencing this.position, this.rotation, etc.
However, I would like to set the mesh programmatically and can’t find how that would be done. I could add my own variable to my class such as this.myMesh = MeshBuilder() and reference that for all my translations but I would miss out on a lot of the nifty tools built into the editor classes. Does anyone know the best way to do this? Thanks!

Edit: After doing some more research, it seems my question is more along the lines of: How can I set an instance of the Mesh class to use a box or sphere?

Edit: This seems to work. It’s added as a child which I’m good with. Is this the best way then? There still seems to be some quirks doing it this way

export default class MyScript extends Mesh {

  public onStart(): void {
    const box = MeshBuilder.CreateBox('testbox');

cc @julien-moreau

bump @julien-moreau

Here’s a way to do it:

Just copy the positions and indices to an empty mesh from the constructor and recalculate the normals.

I’d be curious to hear from the council what the ‘gotchas’ are on this approach. It works great for simple meshes.