I was having this exact problem
My sim was required to produce a male heir for his legacy.
Naturally the first two children were girls. They are completely adorable and I love them to bits
But it occured to me that the mum, Logan, had spent the first 2 pregnancies on a diet of straight pink cake. hmm. Third pregnancy Logan only ate blue cake.
And a boy.
Is this the key? Quite likely it is just a coincidence, but mb not. All Logan ate, and I do mean ALL, for the first 2 pregnancies was pink cake. 2 girls (this is not very good for the waistline) All Logan ate for the 3rd was blue cake. A boy.
.....
mb