
Thu, 10/07/2004 - 10:22
Recently I want to implement measuring the distance between two points( or vertexs).So I use the class of BRepExtrema_DistShapeShape.
I define a object of the class as the following :
TopoDS_Shape sh1,sh2;
BRepExtrema_DistShapeShape myDistShapeShape;
myDistShapeShape=new BRepExtrema_DistShapeShape(&sh1,&sh2);
As the result,there are some errors appearing:
1) D:\Developingsoftware\Opencascade5.1\samples\standard\mfc\VSTAR\VSTARDoc.cpp(351) : error C2512: 'BRepExtrema_DistShapeShape' : no appropriate default constructor available
2) D:\Developingsoftware\Opencascade5.1\samples\standard\mfc\VSTAR\VSTARDoc.cpp(352) : error C2664: '__thiscall BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const class TopoDS_Shape &,const class TopoDS_Shape &)' : cannot convert parameter 1 from 'class TopoDS_Shape *' to 'const class TopoDS_Shape &'
Reason: cannot convert from 'class TopoDS_Shape *' to 'const class TopoDS_Shape'
No constructor could take the source type, or constructor overload resolution was ambiguous
So I don't know how to construct the object of the class of BRepExtrema_DistShapeShape.so if you know ,plese tell me.Tanke you firstly. My Email:lhb_0531@163.com
Fri, 10/08/2004 - 11:17
Hi,
your first error comes for the reason that there is no constructor for BRepExtrema_DistShapeShape without parameters in OCC5.1 (see classbrowser). You have to pass the two shapes in the constructor.
The second error is because you try to pass an adress (&s1) where an object is required (sh1).
The following example worked for me:
BRepBuilderAPI_MakeVertex v1 (gp_Pnt (0,0,0));
BRepBuilderAPI_MakeVertex v2 (gp_Pnt (1,0,0));
BRepExtrema_DistShapeShape myDistShapeShape (v1,v2);
myDistShapeShape->Dump (cout);
HTH
Angelika
Sat, 10/09/2004 - 05:44
Thank you very much.wish you have a good day.