Ah. https://github.com/LinuxCNC/linuxcnc/blob/master/src/emc/usr_intf/emcrsh.cc It uses sockets in that file which implies this is how communications is done.
But as usual, the code is quite vague. For example there's this function. static cmdResponseType setSpindle(char *s, connectionRecType *context) { And inside the function switch (checkSpindleStr(s)) { case -1: return rtStandardError; case 0: sendSpindleForward(spindle); break; and a few more cases. So where is sendSpindleForward(spindle) ? Is there a way to search for "sendSpindleForward" to find out if it's a MACRO or a function that formats the message to go to the socket? Thanks John > -----Original Message----- > From: Frank Tkalcevic [mailto:fr...@franksworkshop.com.au] > Sent: December-15-20 9:48 PM > To: 'Enhanced Machine Controller (EMC)' > Subject: Re: [Emc-users] Python question > > If you look at the axis source code, to increment the spindle you call... > > c.spindle(linuxcnc.SPINDLE_INCREASE) > > where > > c = linuxcnc.command() > > > linuxcnc.command() comes from halui.cc (I think), which sends a message... > > static int sendSpindleIncrease(int spindle) > { > EMC_SPINDLE_INCREASE emc_spindle_increase_msg; > emc_spindle_increase_msg.spindle = spindle; > return emcCommandSend(emc_spindle_increase_msg); > } > > So, to invoke an action, you are actually sending a message to linuxcnc, not > just settings a pin. Status information, like spindle speed, > for example, come from the status message, which is also exposed via halui > for python. > > There are examples, like linuxcnc/src/emc/usr_intf/emcrsh.cc, which do this > in C++. > > > > -----Original Message----- > From: John Dammeyer [mailto:jo...@autoartisans.com] > Sent: Wednesday, 16 December 2020 3:59 PM > To: 'Enhanced Machine Controller (EMC)' > Subject: Re: [Emc-users] Python question > > Let's say you wanted to access the hal pins and essentially run the machine > using a different programming language like C instead of > python. > > How's the linkage done from say the Axis GUI to the rest of the system? Like > Spindle ON button and then Spindle + > > John > > > > -----Original Message----- > > From: andy pugh [mailto:bodge...@gmail.com] > > Sent: December-15-20 5:15 PM > > To: Enhanced Machine Controller (EMC) > > Subject: Re: [Emc-users] Python question > > > > On Wed, 16 Dec 2020 at 01:10, <ken.stra...@gmail.com> wrote: > > > > > > Are the necessary environment variables document somewhere? > > > > I think you just need to "import linuxcnc" to get access to linuxcnc > > command and state. > > > > But you would probably still need to create and net hal pins to get > > values from hal. > > > > > > -- > > atp > > "A motorcycle is a bicycle with a pandemonium attachment and is > > designed for the especial use of mechanical geniuses, daredevils and > > lunatics." > > ? George Fitch, Atlanta Constitution Newspaper, 1912 > > > > > > _______________________________________________ > > Emc-users mailing list > > Emc-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/emc-users > > > > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users > > > > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users