Window Positioning Modifier

Hi,
This is my first code for Blender. I share it here. In the case someone is interested in using it, in writting his own modifier, or in modifying it.

Patch

How it works :
In the UI, the user can select a face (using vertex group name), and select a set of windows (using name of the object).
Then set a count, position of the window in “face space”, and this modifier will place the windows on the face (a bit like the “Array” Modifier).
And cut hole in the face if the window contains a loop of edge with “CarveEdge” vertex group assigned.

Use :
I made this modifier to be able to quickly place windows, doors and details on a surface of a building.
And always be able to easily move the windows, or the shape of the face. Without to have to care about the holes
in the surface.
This could be use then later with a python script, which generate great amount of randomly generated building bodies.
And dress it up with nice windows and details, preliminary created.

Some details about the code :
This is my first code for blender and also first time I write code in C. And I made it as quickly as I could. So the code can be pretty ugly. There are many things which need to be re-written.
I convert the derived mesh may be 5 times. Wrote some functions which Blender most likely already has. I use a modified version of the knife tool, which is about 3000 lines of code, I had to adapt it to my case, not sure I did it correctly.

Known bug :
-When the user set the scene viewport render mode to “rendered” it can’t stop to continously render even though the view angle doesn’t change.
And when setting the viewport mode to “Solid” Blender freezes.
May be due to a recursive/infinite call of applymodifier function ?
-Cuts the face in front of window’s face, if there is any.
-If enabled in edit mode, windows show up with the wrong material.