For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Faster AIS_Lines

Martin Hammerle's picture
Forums: 

I have tausends of AIS_Lines to display, OCC gets very slow after a few 1000 Lines. Does anybody have a solution to display faster AIS_Objects?
Thanks in Advance!
Martin

Patrik Müller's picture

Hi,

try to collect a TopoDS_Compound and display it.

Best regards,

Patrik Müller

Martin Hammerle's picture

Thanks Patrik,
I thought of that, but I have also Points which I haven't found how to add, as I have some attributes that comes with the objects, it would be messy to handle it in compounds, maybe to inherit from AIS_Object and write directly in OpenGL. By any chance any idea how to do that?

Patrik Müller's picture

Hi,

can you give more informations (if you don't wan so write it to the forum post an email)?
I haven't tried using OpenGL directly in an AIS context (but that would be a nice idea).

Patrik

Martin Hammerle's picture

Hi Patrik
give me some time with Angels idea. I'll let you know if I discover something.
Cheers Martin

angel's picture

Hi Martin,
Maybe you can append your "AIS_Line" to "AIS_ListOfInteractive" and Display like as following:

// Obj_List is AIS_ListOfInteractive
AIS_ListIteratorOfListOfInteractive it;

for (it.Initialize(Obj_List); it.More(); it.Next())

{
myAISContext->DisplayedObjects(Obj_List,Standard_False);
}
myAISContext->UpdateCurrentViewer();

Sincerely,
Angel

Martin Hammerle's picture

Hi Angel,
thanks for your valuable input, I changed the code to the following:

AIS_ListOfInteractive
Obj_List;
AIS_ListIteratorOfListOfInteractive it;

for(int i=0;i Obj_List.Append(lines[i]->ais_obj);
}

for (it.Initialize(Obj_List); it.More(); it.Next())

{
myAISContext->DisplayedObjects(Obj_List,Standard_False);
}
myAISContext->UpdateCurrentViewer();

its fast but it doesn't show anything as I left out the display of the lines. Do I need to do something more?
Cheers
Martin

angel's picture

Hi Martin ,
Sorry, I have a mistake for
"myAISContext->DisplayedObjects(Obj_List,Standard_False);", and it should be myAISContext->Display(Obj_List,Standard_False);".

Sincerely,
Angel

Martin Hammerle's picture

Hi Angel
If I try to display the list directly, it gives me a syntax error. So I changed to the following, which works but is slow again.

myAISContext->Display(it.Value(),Standard_False);

Thanks for your help so far.
Martin

Patrik Müller's picture

Hi Martin,

trying it this way makes no difference to the "standard way" displaying interactive objects. You can get all actual interactive objects via "AIS_ListOfInteractive".
So instead of having thousands of lines collect them to a TopoDS_Compound and display this compound.
You see it in AIS_ListOfInteractive. You have only one AIS_Object more in the list.

Greets to Switzerland,
Patrik Müller

angel's picture

Hi Martin,
You can try as following:
// Obj_List is AIS_ListOfInteractive
AIS_ListIteratorOfListOfInteractive it;
for (it.Initialize(Obj_List); it.More(); it.Next())

{
Handle(AIS_InteractiveObject) aAisShape = it.Value();
myAISContext->Display(aAisShape,Standard_False);
}
myAISContext->UpdateCurrentViewer();

Sincerely,
Angel

Stephane Routelous's picture

Hi,

once again, the only way to have your display faster is to create your own class inheriting from AIS_InteractiveObject and draw the primitives using the low level functions from the Graphic3d package ( Graphic3d_Group )

You can check the pdf document about visualisation to see how it's working.
Read also the code in AIS_Line.cxx

HTH