Mach3 macro for controlling Powerpoint

Here is the latest version of the macro that allows Mach3 to open Powerpoint, display your individual slices/slides and move your Z axis into position for each build layer. This solution is only good for slice files that are bitmap files or any format that can be loaded into Powerpoint.

To setup the slides show:

Open PPT and insert a new photo album. Load your slice files. Note: for some reason, when PPT loads a series of images, it puts the last file at the top of the list then continues the order properly. For example. if you have 100 images in your sequence, your order will look like this:

image_100.png
image_001.png
image_002.png
image_004.png
and so on…….

Fig1_A Don’t know why PPT does this but it’s annoying. The first solution would be to select image_100.png and move it down to the end of the list (in the PPT dialog) This could be a pain if you have to move it down, one click at a time, to the bottom of the list.

The easy solution is to go into the folder that contains your slice files, duplicate the last image and rename it image_101.png. Then when you import your slides, you just delete image_101.png, which will be at the top of the list. The rest will be in numerical order.

Fig2_B Under album layout, set picture layout to 1 picture. This will center the images and keep them aligned.
Fig1

Click create. You will see that the first slide is blank and that’s fine, do not delete this slide. Now just set the background to “black” for all slides. Save as a .pps file not .ppt

Here is the macro for Mach3:

[sourcecode language=”vb”]

Option Explicit

‘Change the constant values below to suit – make sure your Powerpoint file is .pps
‘*****************************************************************
Const ppFileName As String = "C:\My Documents\my slideshow.pps"
Const ZStartPoint As Double = 0.0 ‘where Z starts from
‘*****************************************************************

Dim numSlides As Integer
Dim exposureTime As Integer
Dim ZIncrement As Double
Dim s As Integer

‘ User inputs for variables

NumSlides = 15
exposureTime = 8000 ‘ in ms
ZIncrement = .005

Dim objPPT
Dim objPresentation

Set objPPT = CreateObject("PowerPoint.Application")

objPPT.Visible = True ‘ set to display on top

Set objPresentation = objPPT.Presentations.Open(ppFileName)

Code "G90" ‘absolute distance mode

Code "G0 Z" & ZStartPoint ‘start Z at wherever
While IsMoving()
sleep 10
Wend

Code "G91" ‘incremental distance mode

SetFeedRate(5/60) ‘ feedrate 5 inches/minute set as appropriate

For s=1 To numSlides

objPresentation.SlideShowWindow.View.GotoSlide (s) ‘show the next slide

sleep exposureTime

objPresentation.SlideShowWindow.View.GotoSlide (1) ‘ show slide 1  blank slide

Code "G1 Z" & ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement ‘lift Z a couple of tads
Code "G4 P1"
While IsMoving()
sleep 10
Wend

Code "G1 Z-" & ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement ‘lower Z a tad
While IsMoving()
sleep 10
Wend

Sleep 1000 ‘ this value adds a delay before the next slide is displayed

Next

Code "G90" ‘back to absolute distance mode

objPresentation.Close

objPPT.Quit

[/sourcecode]

Copy this text (using the icons that show up when the mouse is over the code) and save as M800.m1s
put it in your Mach3 macros folder (in the profile you are using) then type M800 on the MDI screen. That’s it, You can now adjust the parameters in the macro to suit your machine and resin mixture. Let the experiments begin!

This has been tested successfully with Powerpoint 2003

Thanks to John T for the macro mods! This macro is fully functional but we still want to add more features, I will post updates as they get completed.

Jon

Comments (23)

  1. 9:44 pm, June 11, 2011Gomish  / Reply

    WOW! Excelent! Would that mean I can use the Trial Version of Mach3 since It is not using a 500 GCODE lines?

  2. 9:47 pm, June 11, 2011Gomish  / Reply

    Another question: Can I use the PowerPoint 2003 to create the slide show and on the host computer can I use the PowerPoint Viewer 2003 to run the PPS?

    Thank You!

  3. 9:56 pm, June 11, 2011Jon  / Reply

    In theory, YES to all questions. Have not tried any of those but would like to know if they work. Please give it a try and post your results. That would be great to know if it will work with the trail version of Mach and the PPT viewer.

  4. 11:52 am, June 14, 2011J. Rijnders  / Reply

    Hi All, I really love this project but I do not understand why you use / need mach3. Is it not more easy to use a arduino to interface between the stepper driver and the computer? I think it would be much more flexible to have a simple program that can be directly addressed and where you can make changes in stepping speed and dir and pulse signals.

    • 6:57 pm, June 14, 2011hradec  / Reply

      @J. Rijnders
      You don’t actually need MACH3. Jon Watson macro is an OPTION, if you already have a MACH3 setup and are used to it, like Jon is!

      The Chemshapes default electronics actually IS Arduino based. Right now our host software is under development, but it will talk directly with an arduino over a serial port and it will have all the goodies in an easy and simple manner.

      Our software does the slicing of a mesh, display the layers for curing, moves the axis, and much more.

      We are also working a standard shield for the arduino mega, using pololu stepper driver, as a reference design for others.

      On the arduino side, we are using a slightly modified Reprap Sprinter firmware (the link is on the left bar of this website), which is a new reprap arduino firmware that has being re-written from scratch and has some really neat features, like acceleration which, interesting enough, makes the steppers movement much more SILENT than it used to be.

      If you go to the top menu, you’ll find the software menu with 3 sections:

      – firmware (the arduino firmware based on sprinter)
      – host software (our custom software)
      – Jon Watson Macro

      In those subsections you’ll find specific information for each of then!

      -H

  5. 7:09 pm, June 14, 2011Jon Watson  / Reply

    A fair point to make. The only reason for a Mach3 solution is because I already have a CNC router that uses Mach. I have a working setup using Mach with my stepper drivers & breakout board. I honestly don’t know what an “Arduino” is. I see it mentioned a lot in association with the Rep Rap type printers. There are other software programs in development now and I’m sure they will be great all-in-one solutions for this type of printer, but right now, this works for me without having to learn, setup or invest in different hardware or software.

  6. 8:31 pm, June 15, 2011Gomish  / Reply

    @Jon PPT Viewer 2003/2007 offer no automation thru VBScript/VBA.
    PPT Viewer 97/2000 Offers limited Automation and I was able to start Mach3 Demo and a Macro, It works!, BUT it does not want to go to Slide (1) in between the exposure and the Mach Z moves 🙁
    BTW he Feed rate and Z Increment are in whatever units you start Mach3 in.
    Code follows If someone can help:

  7. 8:31 pm, June 15, 2011Gomish  / Reply

    Option Explicit

    ‘Change the constant values below to suit – make sure your Powerpoint file is .pps
    ‘*****************************************************************
    Const ppFileName As String = “c:slideshow.pps”
    Const ZStartPoint As Double = 0.0 ‘where Z starts from
    ‘*****************************************************************
    Dim numSlides As Integer
    Dim exposureTime As Integer
    Dim ZIncrement As Double
    Dim s As Integer
    Dim oPPTShow
    Dim oPPTViewer
    Dim ppSlideShowManualAdvance As Boolean
    Dim ppViewerSlideShowUseSlideTimings As Boolean
    ‘ User inputs for variables
    exposureTime = 8000 ‘ in ms
    ZIncrement = .025 ‘ Increments Slice Thickness

    Set oPPTViewer = CreateObject (“PowerPointViewer.Application”)
    Set oPPTShow = oPPTViewer.NewShow (ppFileName, ppViewerSlideShowUseSlideTimings, 2)

    NumSlides = oPPTShow.SlidesCount’ SlidesCount
    Code “G90” ‘ absolute distance mode
    Code “G0 Z” & ZStartPoint ‘ start Z at wherever

    While IsMoving()
    sleep 10
    Wend

    Code “G91” ‘ incremental distance mode
    SetFeedRate(50/60) ‘ feedrate 5 inches/minute set as appropriate
    For s=1 To numSlides ‘ pickup the total slides
    oPPTShow.next ‘ show the next slide
    sleep exposureTime
    Set oPPTShow.GotoSlide = 1 ‘ show slide 1; blank slide

    Code “G1 Z” & ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement ‘lift Z a couple of tads
    Code “G4 P1”
    While IsMoving()
    sleep 10
    Wend

    Code “G1 Z-” & ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement + ZIncrement ‘lower Z a tad
    While IsMoving()
    sleep 10
    Wend

    Sleep 1000 ‘ this value adds a delay before the next slide is displayed
    Next
    Code “G90” ‘ back to absolute distance mode
    oPPTShow.Exit
    Set oPPTShow = Nothing
    oPPTViewer.Quit
    Set oPPTViewer = Nothing

  8. 7:18 am, June 16, 2011Gomish  / Reply

  9. 7:21 am, June 16, 2011Gomish  / Reply

  10. 9:31 am, June 17, 2011Gomish  / Reply

    http://www.multiupload.com/1CD6322GEB

    The script works with MACH3 Demo (500 line limit)version 3.42.40/42 and FREE PPView97( you can download from Microsoft Links Above) perfectly!
    Meaning on the HOST computer you have only XP License to worry about.

    Thank You Jon for the Inspiration!

    • 1:59 pm, June 17, 2011Jon  / Reply

      @Gomish
      You’re welcome. I’m sure the script will be tweaked & adapted by individuals as needed. It will allow users that currently have stepper/driver setups using Mach to start testing their printers & resin concoctions to find a good, inexpensive mixture that will work with off-the-shelf projectors without major “bulb” modifications, which in my opinion, is the main goal.

    • 7:01 pm, November 10, 2011Vince  / Reply

      @Gomish
      Would be possible edit the macro in order to activate & sync a second axis (..X or Y..) during the time when the screen is black (…machine moves up, pauses, then moves back down)…? This is for a tilti-action system that I try to implement.

      Jon / Gomish
      Thank you so much!

  11. 8:47 pm, June 18, 2011Gomish  / Reply

    To Admins – Please clean my posts up, so only the working Version of script and ppview97 Downloads are left.

  12. 4:51 am, July 20, 2011peter  / Reply

    Hi Ive loaded this macro onto mach3 and get the error
    error on line 20 – active x component cant create object.
    Any ideas?

  13. 7:19 pm, July 20, 2011Jon  / Reply

    Can you show me what line 20 is? Also, make sure your Powerpoint file is .pps NOT .ppt

  14. 6:52 am, July 22, 2011peter  / Reply

    Hi thanks for helping,
    Its definatly a pps Microsoft PowerPoint 97-2003 Slide Show (.pps)
    I think line 20 is line 23 Set objPPT = CreateObject(“PowerPoint.Application”)
    Im using windows 7 and microsoft powerpoint 2010.
    Ive tried this on two seperate computers with mach3 and get the same error message.
    Thanks Peter.

    • 4:15 pm, February 4, 2013Mike  / Reply

      @peter
      I have the same error, and your solution is not working because my file is .m1s (checked with total commander). Can you upload your macro file sowewhere or how to deal with this problem ? Other text formating programs are not makling difference.

  15. 11:25 pm, July 24, 2011peter  / Reply

    Hi I found the problem.
    Part of it is that I was editing the m800 macro in word pad. despite my putting an m1s extension on the end, word pad adds a hidden .txt ending.
    I also made a 10 sec animation of an expanding rectangle with time code in Final cut pro and exported it as a png sequence. This runs well as a pps slideshow and gives a frame count to check for dropped frames.

  16. 6:21 am, February 9, 2012Jerrett  / Reply

    Hi all,
    I am totally new to this but I do know a little about mach 3 as i use it to run a cnc router. I was looking at the 3dlprint website and how Peter tilts the vat to break the resin free. He mentioned he had some elongation in the print and I think it might be from pulling away the build plate from the vat. It got me thinking that it might be better to twist either the vat or build plate to accomplish this. Could you write another axis to the macro that will twist back and forth before raising the build plate? I dont know jack about gcode. I always use cut3D to do all that for me so I have to learn some stuff it looks like.

  17. 4:12 pm, February 9, 2012Dan  / Reply

    Is there any way to use a similar script to automate a slide show in Openoffice impress instead of powerpoint?

  18. 3:18 pm, December 19, 2012Ray  / Reply

    Hi Jon, great work! the Words that are in green i am not sure what to put there, could you enlighten me? I understand to first one in line 5: Const ppFileName As String = “C:My Documentsmy slideshow.pps” but the others i don’t now what to put there. your assistance will be greatly appreciated!

    Thank you!

  19. 1:02 pm, January 20, 2013goldi80  / Reply

    how to put federate more than 60 is impossible i tray everything
    only wen my printer starts it go to g1 0 , 800 in mach3 speed

Leave a Reply

Allowed Tags - You may use these HTML tags and attributes in your comment.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Pingbacks (0)

› No pingbacks yet.