pattern parts in assembly with max dimension between

I regularly have to place parts in assemblies that have a max distance between them. ie: 70" between gussets, 48" between spacer bars, 72" between hinges.

So far if I set up parametric conditions and then change them I have to manually change the linear pattern spacing and instances every time. I've searched the forum and I've seen people using equations to set their spacing for holes but I can't seem to get it to work for linear pattern.

spacing = ("d1@sketch1"-(2*"edge_offset")-"component length")/(instances-1))

instances = int(("d1@sketch1"-(2*"edge_offset")-"component length")/72))

what am I doing wrong?

SolidworksAssemblies