From: Michael H. <ma...@ma...> - 2012-02-06 12:10:58
|
Am 06.02.2012 um 12:27 schrieb andy pugh: > On 6 February 2012 12:04, Erik Christiansen <dv...@in...> wrote: >> Though I haven't thought that one through with a lot of caffeine in the >> veins, I'm having trouble working out how to do it. The current LinuxCNC >> dialect looks ugly, but is a powerful problem-domain language which >> provides problem-domain statements which do real things on the machine. >> Python-C-Basic-Fortran-whatever-style higher level flow control has been >> added to that, giving the best of both worlds. I concur with Andy: the G-code block must remain as a 'domain specific language', there is no reason to force to everybody dissolve their gcode into calls of some sorts that said, the question is wether the 'scripting language' IS some extension of G-code. As said, I think this is of dubious value. I would rather go for an existing language, and Andy's example could look like so *internally*: g('G95 G96 G7') g('M3 S500') g('G1 X100 Z50') An .ngc import filter would make the requirement to add the 'g(' and ')' noise disappear, so existing linear (non-oword) programs would run unchanged - as he typed it below. If you'like to do 'advanced scripting', then just use a different file extension, and the whole thing would look like: if param[4711] > 815: # do it the G-code block style g('G95 G96 G7') g('M3 S500') g('G1 X100 Z50') else: # alternatively, using direct calls comes for free, # so that isnt precluded: SpindleOn(mode=CSS, Speed=500) Feed(X=100, Z=50, mode=FeedPerRev) Existing non-linear programs (using control structures) can be automatically translated. -m ps: not a new idea - here's a scripting example from the Mach3 Macro reference - doesnt look all that different. I think they made a bright decision to reuse an existing language and embed the G-code block capability - the only step they missed is to make such programs directly executable like an NGC file, not just embedded behind a button in the UI. ‘ Create a new Teach File in Mach3\Gcode MyTeachFile = “TeachMe.nc” Err = OpenTeachFile(MyTeachFile) If Err <> 0 Then ‘ Teach file created successfully ‘ Write some G Code to it Code “G00 X0 Y0” Code “G02 X0 Y0 I-1 J0 F40” ‘ Close the Teach file CloseTeachFile() ‘ Now load the teach file for execution LoadTeachFile() Else ‘ OpenTeachFile failed Message “Unable to open Teach File” End If > > The G-code is converted to motion commands deep in the recesses of > LinuxCNC. What I think I am describing is an alternative interpreter > which sits in the same place in the chain as the current one, but > which accepts a different language. I am only suggesting keeping the > syntax of an existing language, not the language as such. > > So: > G95 G96 G7 > M3 S500 > G1 X100 Z50 > > Might become: > SpindleOn(mode=CSS, Speed=500) > Feed(X=100, Z=50, mode=FeedPerRev) > > The reason _not_ to convert this to G-code is that then we could have > all sorts of things that are not possible in G-code: > if (SpindleMode=CSS) uimessage "some relevant message" > That can't be converted to generic G-code because generic G-code is > bad at strings and has no mode introspection. > > -- > atp > The idea that there is no such thing as objective truth is, quite simply, wrong. > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Emc-users mailing list > Emc...@li... > https://lists.sourceforge.net/lists/listinfo/emc-users |