Thu, 11/21/2002 - 12:02
I am trying to set an object as having an infinite state (ignored on fitall() ). I have my AIS_Shape myShape, i can call the function SetInfiniteState(Standard_True); without compilation erros but it doesnt do anything. Here is my code :
gp_Pnt GridPosition = gp_Pnt(m_Grid_X_Origin*myGScale,m_Grid_Y_Origin*myGScale,m_Grid_ZOffset*myGScale);
p_Pln gPlane = gp_Pln(GridPosition,gp_Dir(0,0,1));
BRepBuilderAPI_MakeFace MakeFace(gPlane, m_Grid_X_Max*myGScale, m_Grid_X_Min*myGScale, m_Grid_Y_Max*myGScale, m_Grid_Y_Min*myGScale);
TopoDS_Face S = MakeFace.Face();
myShape = new AIS_Shape(S);
myShape -> SetInfiniteState(Standard_True); // causes object to be concidered infinite and not concidered in fit all
myShape -> SetColor(ColorPlane);
myShape -> SetMaterial(Graphic3d_NOM_PLASTIC);
myShape -> SetTransparency ((myTrans/100.0f));// from 0 - 100 percent in integer to 0-1 floating point
myShape -> SetDisplayMode(AIS_Shaded);
gp_Trsf myTrsf;
myTrsf.SetRotation(gp_Ax1(GridPosition,gp_Dir(0,0,1)),-myGridRotRad);
myAISContext->SetLocation(myShape,TopLoc_Location(myTrsf)) ;
myAISContext -> EraseAll(Standard_False);
myAISContext -> Display(myShape);
Thu, 11/21/2002 - 16:09
Hi,
your code is OK !
I had to change your variables with "my" values. try that :
gp_Pnt GridPosition (0,0,0);
gp_Pln gPlane = gp_Pln(GridPosition,gp_Dir(0,0,1));
BRepBuilderAPI_MakeFace MakeFace(gPlane, 400, -400, 400, -400);
TopoDS_Face S = MakeFace.Face();
Handle (AIS_Shape) myShape = new AIS_Shape(S);
myShape -> SetInfiniteState(Standard_True); // causes object to be concidered infinite and not concidered in fit all
myShape -> SetColor(Quantity_NOC_RED);
myShape -> SetMaterial(Graphic3d_NOM_PLASTIC);
myShape -> SetTransparency ((70/100.0f));// from 0 - 100 percent in integer to 0-1 floating point
myShape -> SetDisplayMode(AIS_Shaded);
gp_Trsf myTrsf;
myTrsf.SetRotation(gp_Ax1(GridPosition,gp_Dir(0,0,1)),-0.5);
myAISContext->SetLocation(myShape,TopLoc_Location(myTrsf)) ;
myAISContext -> EraseAll(Standard_False);
myAISContext -> Display(myShape);}
The problem is that an "infinite state" shape cannot be shaded ...
Look in AIS_shape.cxx, the method called "void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPrs,const Standard_Integer aMode), you will see :
if (IsInfinite()) StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer);
... which means that this shape will be displayed in wireframe ...
I guess you don't want that !
mbd
Thu, 11/21/2002 - 16:20
Thanks, i want a solid object - not necessarily shaded with lights but solid and that doesnt affect the fit all method. I have a "ground plane" that lies on top of the grid. I dont want it to effect the fit all on other objects in other contexts though. Can i turn off the detection for objects or contexts in Fit All ?
Thu, 11/21/2002 - 16:38
Here is a possibility :
Declare "myShape" (your plane) as a public Variable of your document.
In "void CMyAppView::OnBUTTONZoomAll()", you write :
{
GetDocument()->GetAISContext()->Erase(GetDocument()->myShape);
myView->FitAll();
myView->ZFitAll();
GetDocument()->GetAISContext()->Display(GetDocument()->myShape);
}
... which means that when you fit all, you erase your plane, fit all displayed objects and then re-display your plane.
This method is poor but does its job !
mbd
Thu, 11/21/2002 - 16:58
Thanks, ill give it a go.
Thu, 11/21/2002 - 17:25
Hi,
did you try AIS_Plane ?