@ CAB :
Look CAB, yes if you have 2 adjacent vertexes that overlap or start-end vertex overlap, you have to use clean_poly.lsp by gille...
This is explanation for first case...
Second and fourth case that you posted have vertexes created in CW direction... In my code it was explicitly said that vertexes must be CCW... It is assumed that LWPOLYLINE has to be closed also - with "C" - close option...
Your third case it solved correctly, with more than less success... I also said that roof solution must be unique - pline must not have porches that are actually roof dormers - that's why it failed to do it 100% correct...
Also your fourth case and if it was CCW isn't unique single roof solution - you have separate compositions witch are behaving as dormers... So this case also can't be solved with my code 2droof-MR... In this cases it's best to use previously made routine witch uses extrude command (c:roof)...
M.R.