Frequently Asked: How do I disable/enable lights inside blocks?

Andrew Markovich

November 07, 2017

By default, displaying light sources inside block inserts is enabled and Teigha rendering takes them into account. But large drawings can contain many light sources which can seriously downgrade rendering performance. For example, an architectural drawing can contain a building with rooms that contain lamps, and each lamp can be created as a block insert and can contain a lighting source. In this case an application can disable rendering of light sources from block inserts to increase rendering performance and only light sources placed at the top level of the hierarchy are displayed.

For .dwg databases, you can invoke the “LIGHTSINBLOCKS” system variable to enable/disable the display of light sources inside blocks:

void disableLightsInBlocks(OdDbDatabase *pDb)
{
  pDb->setLIGHTSINBLOCKS(0);
}

Programmatically an application can control the display of light sources inside blocks for parts of the graphics cache using the OdGsModel::setEnableLightsInBlocks method:

void disableLightsInBlocks(OdGsModel *pGsModel)
{
  pGsModel->setEnableLightsInBlocks(false);
}

Example of a drawing with four lights inside block inserts:

image1

Example of the same drawing with disabled display of lights inside block inserts:

image2