Close

Relief for ODA Team in Ukraine

Learn more
ODA BimRv SDK
Work with Visual Styles

Similar to ODA Drawing SDK, ODA BimRv SDK has visual styles for rendering the elements of a DbView. But in contrast with Drawing SDK, visual styles in BimRv SDK are not separate elements in the database; they are part of a DbView.

In the next examples, pDBView stores a pointer to an object of the OdBmDBView class.

The OdBmDbView class allows you to set up the following: rendering mode for the elements in a DbView, transparency of the elements, edge visibility, and setup parameters for edge jitter effect, silhouettes and shadows of the elements. For example:


// Get the pointer to the current DBDrawing
OdBmDBDrawingInfoPtr pDBDrawingInfo = pDb->getAppInfo(OdBm::ManagerType::DBDrawingInfo);
OdBmDBDrawingPtr pCurrDrawing = pDBDrawingInfo->getActiveDBDrawingId().safeOpenObject();
// Get the current DBView
OdBmObjectIdArray viewports;
pCurrDrawing->getViewports(viewports);
OdBmViewportPtr pViewport = viewports[0].safeOpenObject();
OdBmDBViewPtr pDbView = pViewport->getDbViewId().safeOpenObject();
ODBM_TRANSACTION_BEGIN(t, pDb)
  t.start();
// Set some view parameters
pDbView->setDisplayStyle(OdBm::ViewDisplayStyle::ShadedWithEdges);
pDbView->setTransparency(70);
pDbView->setShowEdges(true);
pDbView->setEnableSketchyLines(true);
  t.commit();
ODBM_TRANSACTION_END();
    

This code will change the rendering style and affects the parameters, but will not change the rendering of elements. To do so, an active DbView should be set as a visual style object for the active GsView.

To turn off visual styles for the current view, an empty objectId should be set to the GsView.


// pDevice stores pointer to the current rendering device
OdGsView* pView = pDevice->viewAt(0);
pView->setVisualStyle(pDbView->objectId());
    

Note that not all rendering devices suppoer visual styles. ODA provides visual styles and rendering effects support for the WinGLESS2 device. To enable visual styles, set the 'UseVisualStyles' property for the device.


OdString devicePath = theApp.settings().getGsDevicePath();
if (devicePath.isEmpty()) return;

setDevicePath(devicePath);

OdGsModulePtr pGs = ::odrxDynamicLinker()->loadModule(devicePath, false);
OdGsDevicePtr pDevice = pGs->createDevice();

OdRxDictionaryPtr pProperties = pDevice->properties();
if (!pProperties.isNull()) 
{
    ...
    if (pProperties->has(OD_T("UseVisualStyles"))) // Check if property is supported
         pProperties->putAt(OD_T("UseVisualStyles"), OdRxVariantValue(true));
}
...
    

ODA BimRv SDK makes it possible to override the display of face and edge colours, fill patters, lineweights and other paramters within a view. Overrides are applied to elements, categories of elements, and elements passed through filter conditions. The selected display mode of the view affects the overrides. In shaded mode, overrides are applied to faces and edges, even if a material is set, but for faces in realistic mode, textures of materials has the priority.

To simplify access to overridden graphics, OdBmDBView has three methods:

Type Method Description
OdBmOverrideGraphicSettingsPtr getCategoryOverrides(const OdBm::BuiltInCategory::Enum&) const Returns graphic overrides for a category in the view. Input parameter is the built-in category ID.
OdBmOverrideGraphicSettingsPtr getElementOverrides(const OdBmObjectId&) const Returns graphic overrides for an element in the view. Input parameter is the element ID.
OdBmOverrideGraphicSettingsPtr getFilterOverrides(const OdBmObjectId&) const Returns graphic overrides for a filter in the view. Input parameter is the filter element ID.

These methods return an empty pointer if there is no graphics override for the passed parameters.
The OdBmOverrideGraphicSettings class has methods to access data of graphics overrides for faces and edges:

Type Method Description
OdInt32 getDetailLevel() const Returns overridden detail level in view.
bool getHalftone() const Returns value of the halftone override.
bool getProjFillPatternVisible() const Returns visibility of fill pattern overridden for faces.
bool getCutFillPatternVisible() const Returns visibility of the cut surface fill pattern

If an element’s graphic overrides are set by element, category and filter condition, the resulting overrides should be combined using this priority: element, category, filter.

See Also

Work with Views

Work with View Templates

Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.