How to create custom AIS_* object?

yuriv's picture

I would like to create my custom AIS objects (presentable, selectable, etc). May be someone has skeleton of a code for this issue or detailed guide? Unfortunately the official documentation too poor in this context. Any information will be appreciated.

Thank in advance.

kgv's picture

The most straightforward way

The most straightforward way to implement custom AIS object is to look through existing classes in AIS Package.

And usually there no need to write completely new presentation from scratch. Instead, existing class providing basic functionality can be found and extended with required features through inheritance.

yuriv's picture

Hi kgv! It's good! But, for

Hi kgv!

It's good! But, for example, I would like to make the "wall" in architectural terms. In floor plan it's simple rectangle with length and width. I constructed it like wire, but it's not selectable, it's drawing only. And I need to add some character points (middle point to move, end points to resize, etc) to make this entity mutable.
From what I need to inherit my custom AIS object? From AIS_Shape, AIS_Curve, another entity? How I can do my object selectable? How I can add the character points? There are no clear information about it. What means "3. Install the process, which provides the user with the identity of the owner of the detected entities in the selection loop." in visualization guide from Opencascade documentation?

Thank you for response.

san's picture

Custom AIS objects

Hello yuriv,

It should be noted that this forum is for OCCT development topics, while the OCCT usage forum might contain the answers to the most typical questions that arise when you start using OCCT.

As for creation of custom AIS objects, you can have a look at ViewerTest package, you can find few simple AIS objects there that we implemented to test OCCT visualization. They are really simple and easier to understand than e.g. AIS_Shape source code. Common practice is to inherit AIS_Shape class if you plan to visualize OCCT topological data structures, and AIS_InteractiveObject class otherwise.

Regarding interactive modification of 3D presentations e.g. using dragging, it is not supported natively by OCCT visualization, so you have to design it at application level. Alternatively, you can contact us so that we implement it for you.

Best regards,

Copyright 2011-2016
Contact us