My weekly donations through the month of June continue and this week, my love of theatre has influenced my selection. Musicals are my favorite but I love it all! Plays, operas, ballets, and concerts inspire me. I love when performances challenge your view of the world or allow you to see things from someone else’s point of view. Because of this, I have chosen to donate to the Fund for Black Theatre in the U.S. this week. The fund is locally organized on behalf of Sew Productions Inc and proceeds will be distributed to support Black artists and Black Theatre. If you remember, last week, we created our curtain wall grid lines. This week we will want to randomly delete grid line segments to get the effect of varying panel sizes.

- create the grids by entering width and height information
- randomly delete curtain wall grids but allow for user configurations
- randomize curtain wall panel materials
- option to remove mullions

We create a new method and call it RandDeleteHorizGrids. The parameters we need are the document, the user selected curtain wall, a user entered integer that we will use for the probability of deleting the grid, and the user entered information on the maximum number of grids that should be deleted in a row. It’s also important to note that in the execute method, we need to create a random number generator. The seed will be the date and time. It is important to only have one random number generator for the entire application to ensure sequences don’t repeat. If you use the same seed in a random number generator, you will get the same series of random numbers.

In our RandDeleteHorizGrids, we first need to declare our variables. Then we can take each horizontal grid and divide it into the individual curves. Each curve is a curtain grid line segment which we will delete or keep.

We are also using a counter to track how many gird line segment have been deleted in a “column” of the curtain wall. This allows the user to set a maximum size to each panel. For example, if you want a maximum 8 foot panel and your grid is 2 feet on center then you can remove a maximum of 3 consecutive gird line segments in any column. Our counter keeps track of this so if we reach the maximum, the grid line segment is not removed and the counter is reset to 0. Before we can start deleting curves, we need to confirm our removal counter list is initialized. If our removal counter list is null, we create a new list with zero at each index. The number of indexes is equal to the number of columns that our curtain wall has.

We are also tracking the index (i) of the curve in the list of curves. “i” starts at zero and while it is less than the total number of curves, we add 1 for each time we loop through. In our for loop, we take the curve at that index to perform our actions. We use our random number generator to get a random number between 0 and 99. Then we check if this random number is less than the user entered probability. For example, if the user chose the probability of grids being removed to be 30 then the grid is only deleted if the random number is less than 30. We also need to check if your counter is less than the maximum number of horizontal grid line segments that should be removed in a column. If both are true, we remove the grid line segment. If both are false, we reset the counter to 0.

In this case, we do not need to make any adjustments to accommodate the vertical grid lines. We do just rename our variables for clarity. The reason I have the horizontal and vertical grids in different methods is that you may want to delete only horizontal grid line segments or only vertical grid line segments. Randomly deleting both means you will have non-rectangular shapes for your panels. Separate methods allow us to easily call each method.

And that sums up how to randomly delete curtain wall grid line segments to have random panel sizes. These methods still allow for user control by allowing for input on the maximum panel size and on the probability of a gird line segment being deleted. Next week we will start to look at the curtain wall panels.

If you want to learn to code and don’t know where to start check out my posts about Steps to Learn to Code [for architects and designers] Part 1 and Part 2.