Iso lines

Hi, when I import IGES, faces have iso lines on them when mouse cursor is over. But when I create faces using BRepBuilderAPI, they don't have iso lines on them. How can I fix this?
Thanks

Roman Lygin's picture

Hi Maili,

You likely encounter a case of a plane which, by default, does not use iso-lines. When
you import a model from IGES, the plane is encoded as NURBS surface and you do see iso-lines.

To enforce drawing you could do the following:

const Handle(AIS_Drawer)& aDrawer = anAISObject->Attributes();
aDrawer->Link()->SetIsoOnPlace (Standard_True);

Hope this helps.
Roman

---
opencascade.blogspot.com - blog on Open CASCADE

Maili's picture

Thanks for reply but SetIsoOnPlane didn't work for me.

Roman Lygin's picture

Try this
myAISContext->DefaultDrawer()->SetIsoOnPlane (Standard_True);

The code I sent earlier only makes sense when the object has already been displayed (e.g. in shading mode). This makes Object's drawer to connect to Context's drawer. If to call it before that it does not work, correct.

Maili's picture

Thanks but still no difference. (Converting the face to nurbs makes iso lines appear though.)

Roman Lygin's picture

Sorry, this worked for me.
Then a suggestion is to check which Drawer is used when computing a presentation.
Set a break point in AIS_Shape::Compute() (or other subclass) and trace down to Prs3d_WFShape::Add(), the line with if (!Tool.IsPlanarFace() || aDrawer->IsoOnPlane()).

In normal case each interactive object has a drawer with a field referring to a shared interactive context's drawer. If you set it properly then you should see the iso-lines.
Codes above demonstrated two different methods of doing that. Strange that none did work for you.

Good luck.
Roman
---
opencascade.blogspot.com - blog on Open CASCADE

Maili's picture

I think I am talking about different iso lines. DefaultDrawer()->SetIsoOnPlane() method puts iso lines on faces in scene (permanently). But I don't want that so I put context->SetIsoNumber(0). What I want is that iso lines show up only when mouse is over or the face is selected. With nurbs faces, it is exactly like what I want (no iso line is shown until mouse is over the face) Can it be done for planar faces?
Thanks again

Roman Lygin's picture

Could you attach a screenshot of your current NURBS behavior ? I'm not sure I now understand what you are trying to achieve. If I remember correctly the same Drawer is used both for displaying and highlighting. If there's a way that they become distinct (so that in one you have 0 iso-lines and in the other - 1 or more), I need to check the source code. But it's better to check the picture first.

Roman
---
opencascade.blogspot.com - blog on Open CASCADE

Maili's picture

Taking screenshot is not possible at the moment but I draw the picture. When mouse is over a face of a box (nurbs) it is like this: http://img10.imageshack.us/my.php?image=cubeue4.png

Roman Lygin's picture

Maili,

I think I now understand your issue.

My code works for neutral point and you are using a local context, aren't you ?
I checked the code and found out that it creates a drawer for subshapes selection - see StdSelect_Shape::Compute():

static Handle(Prs3d_Drawer) DRWR;
if(DRWR.IsNull()){
DRWR = new Prs3d_Drawer();
DRWR->WireAspect()->SetWidth(2);
...

Not only does it inappropriately use a static drawer but worse, you have no control over it at all! You can't for
instance change a line width or set 3 iso-lines for NURBS should you wish so. Though it can't be literally called a bug,
I find this to be a serious limitation and would like to encourage OCC folks to pay attention to this.

Unlike local context, in neutral point the object's drawer is used which you can set up as you wish.

Hope this helps.
Roman
---
opencascade.blogspot.com - blog on Open CASCADE

Maili's picture

Thanks for help (I think it is too late to turn to neutral point for me so I will represent faces as nurbs)