Edit: maybe I wasn't clear in my post. I am not looking for different ways to model this. I am just having a problem with the VBA correctly rotating the hob past 180 degrees. Other than that it works perfectly.
I write a simple macro to use a custom hob cutter to create a worm gear. As far as I'm aware, this is the only way to create such a model (especially in Solidworks). The plan was to use a cavity feature between the two parts, rotate both the appropriate amount, and run that in a loop. The problem is that at some point (at around step 12 how I have it set up right now) the gear seems to move quite a bit more than it should, completely ruining the model. Here is how it should look, and here is how it looks after enough iterations. I can't figure out if this is a mate issue, or a macro issue. Any ideas?
Assembly and script attached: https://drive.google.com/open?id=1UfCddX2GJ21VDfuyXJ3EfYeOrO_nEuBU