
Fri, 08/08/2003 - 22:16
Hi OCC-users,
I am reading again and again so much code-examples of you all folks. It looks just great.
Allow me one big question ? How in heaven do you visualize it ? Why can´t I find a really relevant hint in any of the manuals or so ?
Why this big secret and mysticism around it ?
I read about that AIS_Shape and viewer stuff and use it too, but there simpliy is no point. Nothing to see.
What is the secret ? I am using Linux and there is qt 2.3 and 3.1 installed on my machine.
I thought that OCC is that "big", that it has the ability to visualize, without a single line in QT, MFC or what the heck ever...
Is this wrong ?
Can anyone tell me how you finally get your results on the screen "VISUALLY" ???
It cannot be that eternally tough. Someone of you must know this ? Or does no one visualize anything with OCC, just numerics ?
Any hint is a great thing.
MCV
Sat, 08/09/2003 - 13:56
Hi,
perhaps you can show us a part of your code so we can search for an error? I don't understand your question - do you want to use OCC without an GUI or what?
Regards,
Patrik
Sat, 08/09/2003 - 20:18
Okay I am talking about the example on page 85 in the visualization's user guide of OCC 5.0
If you do not have it, although it is freely downloadable, I can send it to you afterwards.
Best Regards and Thanks.
MCV
Sat, 08/09/2003 - 22:07
No,
I have the complete package. But as already set the examples in the pdf files are just code fragments. So give some more hints.
Patrik
Sun, 08/10/2003 - 22:03
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
int main()
{
Handle(Graphic3d_GraphicDevice) myGraphDevice = new Graphic3d_GraphicDevice("");
TCollection_ExtendedString aName("3DV");
Handle(V3d_Viewer) myViewer = new V3d_Viewer(myGraphDevice, aName.ToExtString(), "", 400., V3d_Xpos, Quantity_NOC_DARKVIOLET, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT);
Handle(Graphic3d_Structure) s = new Graphic3d_Structure(myViewer->Viewer());
s->SetVisual(Graphic3d_TOS_SHADING);
Handle(Graphic3d_Group) myGroup = new Graphic3d_Group(s);
Graphic3d_Array1OfVertex Points(0,3);
Points(0).SetCoord(-100.0/2.0,-100.0/2.0,-100.0/2.0);
Points(1).SetCoord(-100.0/2.0,100.0/2.0,-100.0/2.0);
Points(2).SetCoord(100.0/2.0,100.0/2.0,-100.0/2.0);
Points(3).SetCoord(100.0/2.0,-100.0/2.0,-100.0/2.0);
// THESE 2 LINES HAVE BEEN OUTMARKED, BECAUSE WHO KNOWS TO WHICH PACKAGE normal.SetCoord(); BELONGS TO ?
// Normal.SetCoord(0.0,0.0,1.0);
// myGroup->Polygon(Points,Normal);
//****************************************************
Handle(V3d_AmbientLight) L1 = new V3d_AmbientLight(myViewer,Quantity_NOC_GRAY50);
Handle(V3d_DirectionalLight) L2 = new V3d_DirectionalLight(myViewer,V3d_XnegYnegZneg,Quantity_NOC_WHITE);
Handle(Xw_Window) w = new Xw_Window(myGraphDevice,"Test V3d",0.5,0.5,0.5,0.5);
w->Map();
Handle(V3d_PerspectiveView) v = new V3d_PerspectiveView(myViewer);
v->SetEye(100.0,100.0,100.0);
v->SetWindow(w);
v->SetLightOn();
(myViewer->Viewer())->Display(s);
v->Update();
return 0;
}
Mon, 08/11/2003 - 01:46
Okay okay folks thank you, I solved it and also found the suspect Normal.SetCoord() Method, which is in the gp_XYZ-packages. The display works properly, and shows a polygon.
Now OCC 5.0 finally starts making a lot of fun.
Nevertheless, any tip or hint is welcome anyway, maybe there is a better way to display things via a purely AIS_Shape-usage...
Any additional hint is welcome indeed...
have fun...
MCV
Mon, 08/11/2003 - 11:00
Hi,
assume you have successfully created your AIS_InteractiveContext and built TopoDS_Shapes from your geometry - the only thing you have to do is:
anInteractiveContext->Display(new AIS_Shape(myTopoDS_Shape));
HTH,
Patrik