Hi everyone,

I'm trying to get emcsh to open a user generated ngc file through the
tclsh interface.  Currently I have axis open and axis loads the default
ngc file which draws EMC2 Axis on the axis preview screen.  When I try to
issue an emc_open followed by my filename in the tclsh I get an error
reported by axis that a file is already open.

I looked on google, and it looked like someone else had the same problem
with no resolution.  So i went in and tried to add some code to emcsh.cc
and shcom.cc to implement an emc_close command.

in shcom.cc I added (copied and modified from sendProgramPause)

int sendProgramClose()
{
    EMC_TASK_PLAN_CLOSE emc_task_plan_close_msg;

    emc_task_plan_close_msg.serial_number = ++emcCommandSerialNumber;
    emcCommandBuffer->write(emc_task_plan_close_msg);
    if (emcWaitType == EMC_WAIT_RECEIVED) {
        return emcCommandWaitReceived(emcCommandSerialNumber);
    } else if (emcWaitType == EMC_WAIT_DONE) {
        return emcCommandWaitDone(emcCommandSerialNumber);
    }

    return 0;
}

in emcsh.cc I added to the function Emc_Init

    Tcl_CreateObjCommand(interp, "emc_close", emc_close, (ClientData) NULL,
                         (Tcl_CmdDeleteProc *) NULL);

and I added the function

static int emc_close(ClientData clientdata,
                     Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[])
{
    if (0 != sendProgramClose()) {
        Tcl_SetResult(interp, "emc_close: can't close program",
                      TCL_VOLATILE);
        return TCL_OK;
    }

    return TCL_OK;
}

Now I think I did everything correctly for a hack and slash job of adding
a new command, but when i try to run the emc_close command it never
returns back in the tclsh.  I know the EMC_TASK_PLAN_CLOSE message is
getting sent since the first time it complained that the machine had to be
out of estop and turned on.  It's after I turned off the estop and turned
on the machine and then did an emc_close command in tclsh that it didn't
come back.  The axis gui still responds and I can turn the machine on and
off from there, but the EMC2 AXIS is still drawn in the axis preview and
it looks like the tclsh died so something is not working properly.

Anybody have an ideas on what I did wrong?

Thanks!




------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to