The law, which goes into effect immediately, targets devices that turn semiautomatic handguns into makeshift machine guns.