« Posts by Jon

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

The Power Point macro and how to use it

This macro is for PPT versions older than 2007.

When it comes to model slices, we start to realize that the number of slices could potentially number in the thousands for a single 3d object. If you choose to use PPT to display the slices that will be projected, you must add custom animation parameters to each slide. These animations are just simple fade-in and fade-out animations. The only reason for the macro is to apply this custom animation to all the slides at once. Without it, you would have to apply the custom animation to each slide manually, OUCH!

So…Why the need for custom animation? With this type of printer, you expose your resin for a number of seconds for each slice, (depending on the resin you are using), The screen needs to go black while your build tray/Z axis moves into the next position. Once the Z is set for the next layer, The next slide is displayed and so on.

Right now, this macro is set to display the slide 2 seconds after loading to give the machine time to move into position and allow time for the resin to flow completely between the gap that will become the next layer. There is a fade-out at the end which turns the screen black again to ensure the Z doesn’t start moving while the resin is still being exposed.

The parameters of the macro can be edited. The delay time before the fade-in, and the delay time before the fade-out. This second delay time minus the first is what would equal your final exposure time. (10-2=8) because both delay times are from zero. Right now, the delay before the fade-in, is 2 seconds and  delay before the fade-out  is 10 seconds. Again, the final exposure time might vary depending on resin recipe used. The fades are set to the fastest speed which is .1 sec. So, as it is, the entire time for each slide is 10.1 sec. Here is the macro and a link on how to use it: How to use

[sourcecode language=”vb”]

Sub albumAni()
Dim osld As Slide
Dim oshp As Shape
Dim oeff As Effect
‘This code is for pre 2007 only
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.Fill.Type = msoFillPicture Then
Set oeff = osld.TimeLine.MainSequence.AddEffect(oshp, msoAnimEffectFade, , msoAnimTriggerWithPrevious)
With oeff
.Timing.Duration = 0.1
.Timing.TriggerDelayTime = 2
End With
Set oeff = osld.TimeLine.MainSequence.AddEffect(oshp, msoAnimEffectFade, , msoAnimTriggerWithPrevious)
With oeff
.Exit = True
.Timing.TriggerDelayTime = 10
.Timing.Duration = 0.1
End With
End If
Next oshp
Next osld
End Sub

[/sourcecode]

Note: The parameters in green are really the only ones that need to be adjusted.

I will be posting the Mach 3 macro next and will explain how to use the two together to get proper sync between the slide timing and machine control timing.

Jon