Exception in cmdtarg.cpp

Hi
I had exception on the following line in cmdtarg.cpp while trying to implement a code:

"case AfxSigCmd_v:
// normal command or control notification
ASSERT(CN_COMMAND == 0); // CN_COMMAND same as BN_CLICKED
ASSERT(pExtra == NULL);
(pTarget->*mmf.pfnCmd_v_v)();
break; "
On the break line.

This is the code I put in:

double x=0,y=0,z=0;
TopoDS_Vertex V3;
string delim(" ");
fstream is;
string buffer;
double value(0.);
int dimCount(0);
string row;
stringstream newRow;

is.open ("points.txt");
if (!is)
{
cerr exit(1);
}
//ofstream out(tempfile.c_str());

getline(is, row);
if (row == "")
{
//cout getchar();
}
//cout string::size_type lastPos = row.find_first_not_of(delim, 0);
string::size_type pos = row.find_first_of(delim, lastPos);
while (string::npos != pos || string::npos != lastPos)
{
dimCount++;
buffer = row.substr(lastPos, pos - lastPos);

value = atof(buffer.c_str());
//cout lastPos = row.find_first_not_of(delim, pos);
pos = row.find_first_of(delim, lastPos);
if (dimCount == 1)
{
x = value;
}
else if (dimCount == 2)
{
y = value;
}
else if (dimCount == 3)
{
z = value;
}
else
{
cerr }
}
dimCount = 0;

gp_Pnt P(x,y,z);
BRepBuilderAPI_MakeVertex MV(P);
V3 = MV.Vertex();

Handle(AIS_Shape) Point3 = new AIS_Shape(V3);
myAISContext->Display(Point3,Standard_False);

Please provide any suggestions on the problem.
Thanks.

Nitin

Nitin's picture

Hi
Now it is suddenly not opening the Just in time debugger..It directly closes the application window when I click on the button to run the geometry.

Nitin's picture

Hi
I need some suggestions for this problem. Plz help me out.

Is it possible to get a point through gp_Pnt with a initialisation of this kind:
gp Pnt P(x,y,z)
where x,y,z are taken from another class or function??

Thanks.
Nitin

Forum supervisor's picture

Dear Nitin,
I would suggested you to become more friendly with OCCT documentation
(varies User's guides and Doxygen documentation ).
http://www.opencascade.org/ex/stats/cnt2.php?code=Occdoc651&usr=&chw=RKH...
It really can help you:
gp_Pnt (const Standard_Real Xp, const Standard_Real Yp, const Standard_Real Zp);
// Creates a point with its 3 cartesian's coordinates : Xp, Yp, Zp.
Regards

Nitin's picture

Hi Forum supervisor
Thanks for the suggestion. I went through the gp_Pnt documentation.
It mentions the parameters x,y,z to be constants.
This implies that I cannot use gp_Pnt to inherit points from a loop and display them on the screen.

I want to read points from a .txt file and display them on the screen. How can I do that?

Forum supervisor's picture

Dear Nitin,
I don't see any restrictions to use gp_Pnt class.
If you need collections you may use Array of Points, or Sequence of Points
(see TColgp) package.
Regards

Nitin's picture

Hi Forum Supervisor
I am using this code in my program. This compiles successfully. But on running the executable and on clicking the button to display the points, the window crashes. Even in the debug mode I am not getting hte JIT debugger window.

"
is.open ("points.txt");
if (!is)
{
cerr <<"kaputt"<Display(Point2,Standard_False); "

Is the use of gp_Pnt valid in this code??

Regards
Nitin

Nitin's picture

Hi
Ya its working now..Actually I tried debugging it..and in the debugger its now running the executable fine..
Thanks
Regards
Nitin