Stochastic simulation of facies is a continuing and important area of research. To increase model performance and reproduce realistic relationships between categories (facies), an understanding of the geometries and internal architecture of the domain is required. Modelling of spatial categorical data with truncated bi-Gaussian simulation and generating the required mask that reproduces the desired category’s spatial relationships is an important, initial step in categorical variable modelling. Truncated bi-Gaussian simulation is typically used when there are known, complex spatial relationships between the categories. Truncation rules based on thresholds applied to the Gaussian realizations (i.e. the mask) control the proportions and ordering of categories in the simulation. The choice of these thresholds has a large effect on the final models. This work describes a program that is developed for truncated Gaussian simulation where the truncation rules are linear, but are locally varying to account for locally varying proportions. The appropriate truncation rules are calculated based on the user supplied locally varying proportion maps. Moreover, an optimization framework to determine the input variograms used to generate the initial Gaussian realizations is presented. Initially, the optimization is brute force with the best set of variograms carried forward; the second local refinement step is important in obtaining reasonable bi-Gaussian models. A case study simulating rock types at a mineral deposit is presented to illustrate the implementation of the proposed methodology.