To analyze the effects of fabrication and alignment errors on optical systems with complex apertures such as a segmented telescope, a visual basic routine (VBR) is developed using CODE V’s COM interface. One of the eminent features of this VBR is its graphical user interface (GUI). The GUI facilitates the user to model different types of segmentations quickly and precisely. The input parameters describe the basic shapes of the segments (polygon or sector), the chamfers at their corners, and the gaps between them. Fabrication errors (i.e. surface errors and alignment errors such as decenters and tilts for each segment) can also be introduced easily and effectively through the GUI. Geometrical and diffraction-based analyses can then be performed to study and analyze the effects of these errors on the imaging quality of the optical system. Results of tolerance analysis are presented for a test system, which require a very stringent tolerance to be placed on the discrepancy among the radii of curvature for different segments. In short, the VBR is a user friendly and a flexible tool with its application scope in designing complex aperture optical systems.