About Demand Loading and Xref Performance (VBA/ActiveX)

Through a combination of demand loading and saving drawings with indexes, you can increase the performance of drawings with external references.

Demand loading works in conjunction with the XLOADCTL and INDEXCTL system variables. When you turn on demand loading, if indexes have been saved in the referenced drawings, AutoCAD loads into memory only the data from the reference drawing that is necessary to regenerate the current drawing. In other words, referenced material is read in “on demand.”

To realize the maximum benefits of demand loading, you need to save the referenced drawings with layer and spatial indexes. The performance benefits of demand loading are most noticeable when you

To turn on demand loading, use the XRefDemandLoad property. If you turn on demand loading with the acDemandLoadEnabledWithCopy option, AutoCAD makes a temporary copy of the externally referenced file and demand loads the temporary file. You can then demand load the xref while allowing the original reference drawing to be available for modification. When you disable demand loading, AutoCAD reads in the entire reference drawing regardless of layer visibility or clip instances.

To turn on layer and spatial indexes, set the INDEXCTL system variable using the SetVariable method. The following settings apply to the INDEXCTL system variable:

By default, INDEXCTL is set to 0 when you create a new AutoCAD drawing.