Displaying measurements in of 3D Models

Hi,
I saw the import/Export sample of opencascade, Now i have a small requirement, Besides showing the 3D drawing, I want to show the dimensions as measurements illustrated along with the 3D Model. How can I do this? Please help.

I have attached a snap showing the functionality I want, Please refer it.

Thanks
-anand

Attachments: 
Sharjith Naramparambath's picture

Use AIS_XXXDimension classes. XXX can be Length, Radius or whatever! Check out the documentation.

Anand R P's picture

Thank You Sharjith

Anand R P's picture

I tried with AIS_LengthDimension, but its not giving desired results. Can you give a sample code for doing this?

-
regards
anand

Forum supervisor's picture

Dear Anand,
Some example you may find in ViewerTest_RelationCommands.cxx file.
See function VLenghtDimension.
Hope it will help you.
Regards

Anand R P's picture

Thank U, thank U very much!!!

Anand R P's picture

Thank U, thank U very much!!!

Anand R P's picture

Hi,
I tried the way as it is written in ViewerTest_RelationCommands, but nothing comes in the screen. Here I found a difference, my edges are qualifying the IsParallel condition, I dont know.

Please check the attachment, to see my requirement. I think there is something wrong with the plane I am calculating, Can u explain the logic behind this line...

Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (EdgeA,EdgeB,theGeomPlane,theDist,TheMessage_Str );

Attachments: 
Anand R P's picture

Sorry I slight mistype occured, my consecutive edges were NOT qualifying IsParallel condition, eventhough it seemed to be parallel.

Anand R P's picture

Hi,
After exhaustive tests I my self came to a conclusion that for showing dimension properly of a cylinder, an END EDGE and LATERAL EDGE is needed.

Is this conclusion right?
Please comment.

-
Thanks
Anand

Forum supervisor's picture

Dear Anand,
I would suggested you to overlook AIS_LengthDimension class.
It has 5 constructor. Purpose of each are well documented. See corresponding documentation.
Regards

Anand R P's picture

Hi,
I made a walk-through, now I got enough idea about the API function. Thank You for the quick replies.

regards
- Anand

RAHUL SINGH's picture

sir, i want to know how to get cylinder's coordinate in opencascade class
thanx

Anand R P's picture

Use TopExp_Explorer to extract the radial edges use GCPnts_UniformAbscissa...see following code

BRepAdaptor_Curve curve_adaptator (edge);

GCPnts_UniformAbscissa discretizer;
discretizer.Initialize (curve_adaptator, numPoints);
if (discretizer.IsDone ())
{
for ( int i =1 ; i <= discretizer.NbPoints() ; i++ )
{
gp_Pnt p = curve_adaptator.Value (discretizer.Parameter (i));
points.push_back( p );

}
}