Loading ...
Sorry, an error occurred while loading the content.

Re: [libertybasic] Re: Code Needed Please - Want to create GCODE from a BMP file.

Expand Messages
  • Stefan Pendl
    ... The help file includes code to mask a sprite, see Help = Language Syntax and Usage = Sprites = Add a Mask . This shows how to get the pixel information
    Message 1 of 16 , Aug 5, 2013
    • 0 Attachment
      Am 06.08.2013 05:47, schrieb binarymirror:
      > Hey John;
      >
      > Thanks for the additional comments. I'll take a look at the links you left.
      >
      > Now, to your questions/observations:
      >
      > Yes, I plan on running the "print" head across one width, leaving deposited material. By using a little logic when examining the pixels and then outputting the GCODE, I want to deposit a dot when there is a single isolated pixel - but when there are two or more pixels side by side, I want to actually describe the vector value that will keep the extrusion head turned on while it moves. (hope that was clear?)
      >
      > I am trying to NOT roll the material back and forth. By running fabric that could be 144" long - I'm concerned that it won't stay in registration. I could just imagine using a vector image that rolls the fabric back and forth a few feet could deposit dots in the wrong place and mess up the final product. (and the fabric could stretch, skew or pucker, making for more problems)
      >
      > And another reason I don't want to roll back and forth, is my concern for running the extruder over top of material that has already been deposited. (of course, that problem could be eliminated by using "Z" axis control for the extruder - which is one more control I'm trying to avoid dealing with.
      >
      > As one might suspect, I'm not going for high resolution here - I'll be happy with approx 15DPI. Doesn't sound like much, but that's all I need when viewing the end result from a distance.
      >

      The help file includes code to mask a sprite, see "Help => Language
      Syntax and Usage => Sprites => Add a Mask".

      This shows how to get the pixel information from a displayed image,
      which is really simple and can be done in memory too.
      If you display the image, you don't have to know the image file format.


      --
      Stefan Pendl
      http://stefanpendl.runbasichosting.com/

      LB 4.04 Pro ... http://www.libertybasic.com/assist.html
      LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

      LB Community Wiki .............. http://basic.wikispaces.com/
      LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
      LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

      Books at http://www.lulu.com/ and http://www.amazon.com/
      Alyce Watson ... APIs for Liberty BASIC
      Carl Gundel .... Beginning Programming with Liberty BASIC

      Windows 7 Home Premium 64-bit SP1
      AMD Turion X2 RM-70 2GHz, 4GB RAM
    • John Fisher
      ... deposited material. By using a little logic when examining the pixels and then outputting the GCODE, I want to deposit a dot when there is a single
      Message 2 of 16 , Aug 6, 2013
      • 0 Attachment
        >Yes, I plan on running the "print" head across one width, leaving
        deposited material. By using a little logic when examining the pixels
        and then outputting the GCODE, I want to deposit a dot when there is a
        single isolated pixel - but when there are two or more pixels side by
        side, I want to actually describe the vector value that will keep the
        extrusion head turned on while it moves. (hope that was clear?)

        *I'm interested in what extrusion head you hope to use, and how fast it
        spits out bits... and do you need to use GCODE at all- if you are
        hacking the existing mechanism you just need two stepper drives and a
        'extrude' command?? If the deposits are adjacent they'll join anyway- no
        need to raise/lower head or create a vector?? And can you keep the
        extruder 'flying' at a constant ( close) height?*

        >Fabric that could be 144" long
        *At 15 dpi a 48 inch traverse implies 720 dots, and 144 inch implies
        2160. What kind of time is acceptable? It's basically an old dot matrix
        printer on a grand scale, with only one pin enabled!**
        *

        *I modified my existing LB code to allow selection of any size/type of
        image file, then programmatically change it to a bitmap ( calling
        ImageMagick) of width 720 pixels. It is then easy to read the whole file
        into memory and read the RGB values of its pixels.**Unfortunately I have
        no extrusion mechanism to play with. *



        [Non-text portions of this message have been removed]
      • binarymirror
        As for the extrusion head - haven t selected one yet. My choice will be influenced by the size of plastic bead I want to deposit, its speed of feed and temp.
        Message 3 of 16 , Aug 6, 2013
        • 0 Attachment
          As for the extrusion head - haven't selected one yet. My choice will be influenced by the size of plastic bead I want to deposit, its speed of feed and temp. The temp is going to have an impact on how well it adheres to the fabric. Probably will just purchase the parts I need, not a whole 3D printer.

          As for "do I need to make my own GCODE", I looked into doing what you're suggesting - of just controlling the steppers and issuing an extrude command - but then I had a conversation with a friend and realized that there's more to it than that. He suggested I look at "Repetier-Host". It's a program that lets you view GCODE objects and then send them to your extruder. It also lets you control the extruders heater temp, affect scaling, object origin, rotation, stepping speed, and more - so - rather than go down that rabbit hole myself, I've chosen to use "repetier-Host"(or something like it).

          You're right - there's no need to raise/loser the head - which I'm not planning on doing. As for needing to create a vector - it appears that I would actually end up with a smaller file size if I created a vector instead of creating individual steps corresponding to every pixel.

          Yep, it "will be" like a one pin dot matrix printer - nice analogy ;-)

          Well, I envy you on having the programming skill with your existing LB code. That's why I've been asking questions here since I don't have that skill set. The last time I did any coding was 15 years ago - so any skill I once had is long gone - I'm climbing a steep learning curve for a retiree. Also wish I could talk you into modifying your code so I could then take it and insert the GCODE part.

          Charlie
        • John Fisher
          Hi Charlie ... Yeah. I looked into G-code- and repetier-Host is software I came across. As you say, control of temperature, extrusion and x-scan can be
          Message 4 of 16 , Aug 7, 2013
          • 0 Attachment
            Hi Charlie

            On 07/08/2013 04:23, binarymirror wrote:
            > As for "do I need to make my own GCODE", I looked into doing what
            > you're suggesting - of just controlling the steppers and issuing an
            > extrude command - but then I had a conversation with a friend and
            > realized that there's more to it than that. He suggested I look at
            > "Repetier-Host". It's a program that lets you view GCODE objects and
            > then send them to your extruder. It also lets you control the
            > extruders heater temp, affect scaling, object origin, rotation,
            > stepping speed, and more - so - rather than go down that rabbit hole
            > myself, I've chosen to use "repetier-Host"(or something like it).
            >
            Yeah. I looked into G-code- and "repetier-Host" is software I came
            across. As you say, control of temperature, extrusion and x-scan can be
            complex. There does appear to be software out there- eg cad-py -but
            you'd need Python experience
            >
            > Well, I envy you on having the programming skill with your existing LB
            > code. That's why I've been asking questions here since I don't have
            > that skill set. The last time I did any coding was 15 years ago - so
            > any skill I once had is long gone - I'm climbing a steep learning
            > curve for a retiree. Also wish I could talk you into modifying your
            > code so I could then take it and insert the GCODE part.
            >
            In principle to generate G-code is easy. That is, if you just use moves
            to absolute positions and a ( binary) off /on to eject a pixel. There
            seem to be good simulators out there that could test the output- eg
            WYSIWYG G-code simulator/editor http://www.cnccookbook.com/CCGWizardE.html

            I'll put up a webpage on diga.me.uk on my thoughts in the next couple of
            days- present version asks for any image, scales it to 720 pixels wide
            and plots its pixels raster-fashion on screen, but could instead /as
            well send to a g-code file 'G1 X2.0 Y2.0' as an absolute move and 'M113
            S0.7' /'M113 S0' or 'M64 P1' /'M65 P1' to extrude and stop extrude. I
            suspect it'll get much too complicated with all the delays & rate
            calculations needing adding probably.... you'd be welcome to use it if
            it's any help. It's an adaptation of software where I was playing with
            altering bitmap images. I'm still not sure about making moves of over 1
            pixel into effectively a single, longer move. I see it as OK if you are
            not extruding, but surely a row of extruded dots has to be created by a
            sequence of single 'move/ create' steps?

            Hope the LB side works out- it sounds a great project. It's always a
            problem deciding whether you are re-inventing the wheel when trying to
            program something like this yourself, or spending similar time getting
            to grips with complex specialist software!

            JohnF
            PPS ...also a retiree of some years standing!


            [Non-text portions of this message have been removed]
          • John Fisher
            ... See http://diga.me.uk/image2Gcode.html [Non-text portions of this message have been removed]
            Message 5 of 16 , Aug 7, 2013
            • 0 Attachment
              > I'll put up a webpage on diga.me.uk on my thoughts in the next couple of
              > days-
              >
              See http://diga.me.uk/image2Gcode.html



              [Non-text portions of this message have been removed]
            • binarymirror
              Hi JohnF; Thanks for the input. I agree, generating the GCODE shouldn t be difficult. If I can get it to work, I ll share the resulting file back to you. As
              Message 6 of 16 , Aug 7, 2013
              • 0 Attachment
                Hi JohnF;

                Thanks for the input.

                I agree, generating the GCODE shouldn't be difficult. If I can get it to work, I'll share the resulting file back to you.

                As for the project, I've been having fun "so far" ;-) Still more work to do. I shouldn't have a problem with the hardware end - I've been in Ham Radio for over 40 years, and have been building my own computers for 15 years or so.

                Ok on being retired too. It's been a little over 2 years since I retired. It took me about 18 months to get used to not having to work for someone else.

                Thanks,
                Charlie
              Your message has been successfully submitted and would be delivered to recipients shortly.