构件符号变化事件,可以对构件的颜色,透明度进行设置,只需要重写基类BPEntitySymbologyEventListener_getOverrides函数,就可以对工程里的构件符号进行处理,可参考6-7中示例,将需要处理的构件存在一个容器内,然后对容器内的构件设置颜色和透明度。注册使用BPEntitySymbologyEventListenerCenter类进行,在需要在工具中开启。

void EntitySymbologyEvent::_getOverrides(BPSymbologyOverridesR overrids,::BIMBase::Core::BPEntityCR eh) const
{    
    BPProjectP pProject = BPApplication::getInstance().getProjectManager()->
        getMainProject();    
    if (pProject == nullptr)        
        return;    
    if (!eh.isValid())        
        return;    
    BPEntityId entityId = eh.getEntityId();    
    bool bIsOveride = false;    
    //遍历选择集    
    if (m_selected.find(entityId) == m_selected.end())        
        return;    
    overrids.setOveride(true);    
    COLORREF oldColor = RGB(233, 184, 119);
    overrids.setColor(oldColor);    
    overrids.setTransparency(0.9);
}

代码6-7:构件符号变化事件示例