Cancer "crab" and cancer "lattice" look related, but it could be a coincidence. They are not very close in meaning, but one could perhaps imagine a crab's collection of legs to be somewhat similar to a lattice, or crab legs could have been used to make some kind of lattice—I have no idea. Could those two words possibly be related?
I've heard a theory that the "lattice" meaning is actually the original. According to this theory, cancer comes from Proto-Italic *kar-kr- by dissimilation. If this is true, then cancer and carcer would be doublets, and the original meaning of both would be something like "cage". Carcer then shifted to mean "entrapping cage" and thus "jail", while cancer first shifted to "claws" (which hold something) and thus to "crab" by metonymy.
I don't, unfortunately, currently have access to De Vaan or another reputable source, so I can't say how well-accepted this theory is. But the Ancient Greek karkínos "crab" might show a similar development from the original *kar-, which lends a bit of weight.
For reference, de Vaan writes:
The Latin word can only be connected with evidence outside Italic if we assume a dissimilation of earlier *karkros 'enclosure' (cf. carcer) to *kankros. Since the pincers of a crab form a circle, this may have been the cause of its denomination.
Not perhaps the very last word on the matter.
In Slavic languages (at least, East-Slavic), the word рак (/rak/) can mean either "crayfish" or "cancer". Also, we have the word краб (/krab/) but it only means the crustacean crabs. This is somehow related with cancer, i.e. краб related to рак as both can refer to a crustacean, but рак also can refer to "cancer".
This is kind of an interesting linguistic thing that bothered me from the childhood, I mean why рак can refer to both the strange (even scary) looking animal and the terrible, often fatal, disease.
Now I see that Draconis is right with regard to the Greek καρκίνος (/karkinos/) meaning "crab". And, by the way, the Zodiac Sign which is supposed to look like a crayfish is called Cancer.
Unfortunately I didn't quite get how the question raised in your head, because we speak different languages. To me, "cancer" and "crab" are kind of related, but I don't understand how "lattice" associates with both "cancer" and "crab". Can you explain once more please what "Cancer "crab" and cancer "lattice"" mean to you?