Thank you John

It is courtesy of your tutorials that i have a very basic understanding 
of python in the first place.
I will go and poke around the source of your Arc Generator and see what 
i can figure out,
At least i know how one would go about this now and that it is possible.
As always making things work in practice takes a bit more than making 
them work in theory.

The reason for this silliness in the first place is I have one old 
controller that has not been replaced with linuxCNC yet. It only 
recognizes absolute arks. All my programs are programed with relative 
arcs and it is driving me nuts making a second copy and hand editing any 
of my programs that i have to run on this machine.
Now i have two versions to keep current ect. ect. What I am aiming for 
is to keep one master program and run it the way it is on my linux 
machine or run it through a post for my non linux machine until i get to 
replacing this one odd controller.

Thanks again for your help

linden

On 16-05-29 03:41 PM, John Thornton wrote:
> Parsing through files is a common thing to do. In python I'd just read
> each line of the file and remember the last line to get the XY
> coordinates to calculate the new offsets when you encounter a G2 or G3.
> I've written several G code generators you can see them on the wiki for
> inspiration. Look at the Arc Generator for my code to calculate arcs.
>
> JT
>
>
> On 5/29/2016 5:05 PM, 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.
>> 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
>> Emc-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/emc-users
>
> ------------------------------------------------------------------------------
> 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
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users


------------------------------------------------------------------------------
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
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to