Merging Blocks Projects: Possible? Worth It?

One of the goals my team have this year is for everyone to do more outside of their main role, and the way we’ve settled on doing that is breaking up the design into submodules that will each have one team member fully responsible for building, testing, and programming, and then the leads will help manage the integration.

When it comes to programming, this actually fits nicely into a model that’s more like industry where the functionality of one component (e.g. a particular mechanism) is built separately from the overall control program and ideally abstracts away the details of what’s happening so that the control program can simply execute a “start intake” command rather than having to know that the motor in port 8 needs to spin forward at 70% speed and the motor in port 4 needs to spin in reverse at 50% speed, etc. It also allows for better code re-use between e.g. a driver control program and a programming skills program.

Doing something like this is straightforward when using Python (especially if using VS Code rather than VEXCode), and it’s even fairly easy to deal with if the integrated programs are done in Python, while the submodules are created in blocks. The problem is, I’m not sure if any of my Students will be up for doing Python this year, and I doubt anyone beyond our Lead Programmer would, so I’m trying to figure out whether/how we can make something similar work with Blocks.

My idea is that each blocks project would have an identical device configuration, and the projects for a given mechanism would simply define My Blocks for each of the functions of the mechanism they control…and that’s as far as I get in what I know we can do.

What I’d want to do from there is be able to import the My Blocks from the other projects into the integrated program without having to go through the error-prone tedium of manually re-creating them (or simply merge the two projects together into one). Extra bonus (and I know I’m thinking very pie in the sky here) if we don’t have to re-import them every time an update is made to the submodule.

Does anyone know if something like this is possible with the tooling that exists today? If it is, has anyone tried it and found it to be worthwhile? If it isn’t, is this something that other people might like to see?


There doesn’t exist any way that I’ve seen to integrate/include other modules. This is probably largely intentional from Vex, because if you’re getting to that point, you’re sufficiently advanced enough to be able to move to another language that intrinsically supports that sort of model.


You can copy/paste between projects using ctrl+c, v. Select the stack by clicking on it, and then copy. Then open the other project and paste it. I just tried this with the desktop version.

I would doubt there would be any way to automate beyond that. You can open the files in a text editor and possibly you will find an easier way… But for your kids, the copy-paste could be sufficient.



However, just for kicks and giggles, I have a hunch on how this could be done, but I need to first install blocks on my computer so I can test it… Hopefully this works :sweat_smile:

I haven’t dug into the format of the file closely, but there’s some amount of text data in there. Maybe it’s possible to do it, but I wouldn’t count on it being predictable and repeatable.

I’m happy to be wrong!

The file format is a mix of Json and XML.

Yeah, I definitely agree for the most part, was just hoping for something that’d be workable with contributors who are at different levels.

Well, here I put on my chagrined face… it never even occurred to me to try that. Nothing in the UI ever made me thing that normal copy/paste was possible (down to there not being any indication that a stack of blocks is selected, at least on macOS) within a file, much less between files.

That really should take care of what I need to do.

I did a bit of digging on the format after I posted this, and it’s pretty straightforward, so I don’t think it’d be too big a deal to write something that could merge things, perhaps even selectively. Only real pitfall I saw would be trying to make 100% sure you don’t have stacks on top of one another, but that’d be easy enough to deal with.

Regardless, now that I know copy-paste works :roll_eyes: I don’t think I’ll explore this any deeper unless I get really bored.