Draw Grid on plane in 3D


I have a problem in my program.Please, help me...

I tried to drawing grid on specific plane (for sketch)

so, i find the 3d coordinate of the 2d plane and succeed

And, I want drawing the grid on this plane by method of view or viewer class.

So, i tried to v3d_viewer::ActivateGrid method and v3d_view::SetGridActivate method.

But that method fail...I think, my attribute setting was incorrect.

please, can you show some code?

Or should I create my own?

Thank you.

JuryS's picture

I don't use v3d_view Grid, but I have some class that create something like Room in your project with active levels, grids on the floor, walls, activating some wall with privileged plane or in manual mode. If you need this code write here.

wjdghkgh's picture

thank you so much for your help!
I hope to see your code.

Thank you!

JuryS's picture

You can ask if that will be not clear

wjdghkgh's picture

I will try. thank you!

wjdghkgh's picture

I solved this problem.
i was tried to setting grid by method of v3d_view::Viewer().
But, must be setting the grid by method of v3d_viewer of Document.

Like this...

void C+ProjectName+Doc::DisplayGrid(gp_Pln aPlane, Quantity_Length XOrigin, Quantity_Length YOrigin, Quantity_Length XStep, Quantity_Length YStep, int Type, Quantity_Length Rotation, Quantity_Length XSize, Quantity_Length YSize, Quantity_Length Offset)
gp_Ax3 Ax3(aPlane.Location(), aPlane.Axis().Direction());
myViewer->SetRectangularGridValues(XOrigin, YOrigin, XStep, YStep, Rotation);
myViewer->SetRectangularGridGraphicValues(XSize, YSize, Offset);
myViewer->ActivateGrid(Aspect_GT_Rectangular, Aspect_GDM_Lines);

I hope that this code helps to beginner. like me...

Lion G.'s picture

it is indeed very helpful