On Sunday 29 May 2016 18:05:28 linden wrote: > Hello all > I am trying to modify a script to convert G code programs that > have there G2 and G3 arc centers (I and J) defined in relative terms > to absolute values.
This, to me, is an odd request. I write 99% of my own code, and find the use of absolutes in arc data is a major pain in the butt. I drive it to the starting point of the arc, do the arc in relative IJ, drive it to the next starting point, drive the arc in relative, wash rinse and repeat until the width of the board has been carved. I also, as a general rule but not always, do my own tool raduis compensation. One routine in particular which carves green and green style (big box joints IOW) in wood can be configured by editing 2 variables at the top of the file, so as to carve all the joints in a blanket chest, inverting the pattern of the carving depending on whether the board being carved is a side piece or an end piece, or is the much narrower bottom base rail of the chest, again inverting the pattern depending on end piece or side piece. Wood being the fickle stuff it is, I find the joint fit between the mating pieces is best controlled by fudging a wee bit on the tool diameter which in this case is a 1/4" solid carbide end mill, up spiral style. So thats the third variable at the top of the file, usually set for about 2 thou smaller than it is, which in turn gives a joint fit with just enough room for a bit of Elmer's waterproof glue as I drive a screw thru the middle of each fingers face, into the gullet of the finger its mated with. The face of the finger has been prepared to hide the screw by recessing the screws pan head and a well fitted washer into a counterbore, and the counterbore is topped with a recess that a square pillowtopped ebony button is driven and glued into. All done in the same jig on the same milling machine except for the ebony bits, which are held in a separate jig and made by the sandwich baggy full in some cases. If I had to do all that in absolute mode, I would gave given up and had myself committed long ago. I can make that code available on my web page below if there is any interest. I wouldn't even call it pretty, but it has worked, and worked well, even if the mahogany wants to warp, I have screws enough to pull it into shape and square. > ie as the program is now it will run with G90 I need it to run > properly with G90.1 Is there a way to do this with python. Can I get > it to read through the lines of the program until it finds an I J or K > and then go back to the previous line and add the current I value to > the X value of the previous line to make the new I value absolute. > I am sure this has been done before some where if some one has > an example they could share or suggestions I would be much obliged. Is > this even possible. I would prefer to do this with python and > integrate it in to the current script (see snippet below) but I could > live with bash if it was easer. Below are the lines in the current > python script that read through the code and truncates the decimal > places displayed. Could I add a block similar to this that when > through before and did the conversion. Any suggestions or am i trying > to do the imposable. > > Thanks Linden > > def parse(pathobj): > out = "" > lastcommand = None > > #params = ['X','Y','Z','A','B','I','J','K','F','S'] #This list > control the order of parameters > params = ['X','Y','Z','A','B','I','J','F','S','T','Q','R','L'] > > > for param in params: > if param in c.Parameters: > if param == 'F': > outstring.append(param + > format(c.Parameters['F'], '.0f')) > elif param == 'S': > outstring.append(param + > format(c.Parameters[param], '.0f')) > elif param == 'T': > outstring.append(param + > str(c.Parameters['T'])) else: > outstring.append(param + > format(c.Parameters[param], '.3f')) > > > ---------------------------------------------------------------------- >-------- What NetFlow Analyzer can do for you? Monitors network > bandwidth and traffic patterns at an interface-level. Reveals which > users, apps, and protocols are consuming the most bandwidth. Provides > multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make > informed decisions using capacity planning reports. > https://ad.doubleclick.net/ddm/clk/305295220;132659582;e > _______________________________________________ > Emc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-users Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene> ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
