DiscussionsIssue archiveOther usage issues

Archived discussion

Faster AIS_Lines

Other usage issuesWed, 08/21/2002 - 15:3911 replies

Browse this forum
QuestionAuthor

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!
Author

Discussion

11 archived replies

Posts are displayed in their archived order.

01Commenter-1

Hi,

try to collect a TopoDS_Compound and display it.

Best regards,

Commenter-1 Müller

02Author

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?

03Commenter-1

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).

Commenter-1

04Author

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

05Commenter-2

Hi Author,
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,
Commenter-2

06Author

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;iais_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
Author

07Commenter-2

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

Sincerely,
Commenter-2

08Author

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.
Author

09Commenter-1

Hi Author,

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,
Commenter-1 Müller

10Commenter-2

Hi Author,
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,
Commenter-2

11Commenter-3

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