Script to cut windows and doors into walls

 From:  Larry Fahnoe (FAHNOE)
10907.21 
Hi Michael,

Sorry, questions like this may cause you some frustration or irritation… I'll understand if you say "go away kid, you bother me!"

I've run into an interesting bug that I haven’t been able to figure out. After a fresh start of MoI, if I use my CutWalls script to cut a single window into one or more solids, the solids' names are preserved as one would expect. However if I then either Undo or reload the saved model and use the script in the exact same way the solids' names are deleted. Making it stranger still, if I point the script at a surface or joined surface and do the same operations, the surface names are never deleted. So basically the script only works correctly once after a fresh start of MoI, any subsequent use and the names of solids being cut are deleted.

I have narrowed the loss of object name down to the boolean difference operation, and of course a normal Construct > Boolean Difference behaves normally—object names are not deleted. Same issue with MoI v4 and v5 May beta.

With v5 the puzzle is more interesting in that solids which are part of a group do not have their names deleted.

Prior to the boolean difference, the script seeks to determine the thickness of the wall by creating a probe line normal to the curve and doing an intersect on the wall and the curve. It then moves the curve slightly outside of the wall and extrudes a solid which extends slightly through the wall on the other side (to be able to cut surfaces as well as solids). That solid is then used by the boolean difference to cut the wall objects.

The script is designed to be able to cut multiple windows and walls, and allows the walls to be of varying thickness. To accomplish this, the script loops through the set of window curves probing the wall behind each, making solid cutters, frames and glass as necessary. There is a single boolean difference at the end of the script to do all the cutting at once. (if I put the boolean difference into the loop, then the objects being cut replicate…)

If there are multiple windows being cut, then even with a fresh start of MoI, the names of the solids are being deleted.

All of this leaves me thinking that there is some state information that’s somehow not getting cleaned up, and that the various operations that the script performs are causing something to leak into the boolean difference, triggering the behavior. Beyond that hunch, I’m a bit clueless. Doesn't matter if input #2 (keep objects) is true or false.

To reproduce, create a box about 6” thick to represent a wall object, then draw a closed planar curve on one side to represent a window opening to be cut. Name the two objects then execute CutWalls. Select the box as the base object and the curve as the object to subtract. Don’t need to tick any of the option checkboxes. The window will be cut and the box’s name will be removed. Or, the other case, put two window curves on the box & the names are always removed.

--Larry

EDITED: 6 Jan 2023 by FAHNOE