You got about as far as I've gone. I haven't tried to do any toolpathing with VBS yet, so I can't help you. Sorry.
This may be of some help, though. Good luck!
Code:
'////////////////////////////////////////////////////////////////////////////////
'//
'// Author: Mick George Mick.George@Mastercam.com
'// Date: 28/10/2003 03:28 PM
'// File Name: Toolpath Door CHook.vbs*
'//
'// Description: Run Door CHook, create <style> door, set level 1 INSIDE and level 2 OUTSIDE
'// then create one door, exit chook. Create your operations and save them to
'// DOOR.OP9 And run this script
'//
'// Comments: You don't need to create a door, this script can apply to any drawing that has
'// two inside pocket operation and an outside contour.
'//
'////////////////////////////////////////////////////////////////////////////////
'///////////////// My Constants /////////////////
'
' -- Operations library
Const DEF_OPERATIONS_LIB = "DOOR.OP9"
'
' -- Operation comments for each operation saved
Const DEF_OP_INSIDE_ROUGH_POCKET = "INSIDE ROUGH POCKET"
Const DEF_OP_INSIDE_FINISH_CONTOUR = "INSIDE FINISH CONTOUR"
Const DEF_OP_OUTSIDE_CONTOUR = "OUTSIDE CONTOUR"
'
' -- Level numbers
Const DEF_INSIDE_LEVEL = 2
Const DEF_OUTSIDE_LEVEL = 1
' -- Start Script
Call Main()
' ////////////////////
' Sub Declaration
' ////////////////////
Sub Main()
Dim strPathToOP9, ovOverRides
If Not IsDrawing Then ShowString "We need a drawing!": Exit Sub
strPathToOP9 = GetPathFromExtension("OP9")
strPathToOP9 = AddBackSlash(strPathToOP9) & DEF_OPERATIONS_LIB
' -- If you want to over-ride the operations depth now is the time...
Set ovOverRides = New McOverride
With ovOverRides
.DepthOn = True ' -- Override operation depth?
.Depth = -.125 ' -- New depth If DepthOn = True
.FeedRatePercentOn = True ' -- New feed rate Is a percentage?
.FeedRate = 80
.SpindleSpeedPercentOn = True ' -- New spindle speed Is a percentage?
.SpindleSpeed= 80 ' -- New spindle speed If SpindleSpeedOn = True
End With
Call GetReady
' ****************************************
' * Chain all entities on our inside level
' ****************************************
If ChainAll(True, False, DEF_INSIDE_LEVEL, vbNullString ) Then
' -- Apply our rough pocketing routine
If MakeOperationFromName(strPathToOP9,DEF_OP_INSIDE_ROUGH_POCKET,DEF_OP_INSIDE_ROUGH_POCKET, ovOverRides) <> mcOPERATION_INVALID Then
' -- Apply our finish pass
If MakeOperationFromName(strPathToOP9,DEF_OP_INSIDE_FINISH_CONTOUR,DEF_OP_INSIDE_FINISH_CONTOUR, ovOverRides) <> mcOPERATION_INVALID Then
' -- Ok to go
Call GetReady
Else
ShowString "Could not apply " & DEF_OP_INSIDE_FINISH_CONTOUR & " operation"
Call GetReady
End If
Else
ShowString "Could not apply " & DEF_OP_INSIDE_ROUGH_POCKET & " operation"
Call GetReady
Exit Sub
End If
' *****************************************
' * Chain all entities on our outside level
' *****************************************
If ChainAll(True, False, DEF_OUTSIDE_LEVEL, vbNullString) Then
' -- Apply our outside contour routine
If MakeOperationFromName(strPathToOP9,DEF_OP_OUTSIDE_CONTOUR,DEF_OP_OUTSIDE_CONTOUR, ovOverRides) <> mcOPERATION_INVALID Then
' -- Clear all
Call GetReady
Else
ShowString "Could not apply " & DEF_OP_OUTSIDE_CONTOUR & " operation"
Call GetReady
Exit Sub
End If
Else
ShowString "Could not chain outside level"
End If
Else
ShowString "Could not chain inside level"
End If
End Sub
' ////////////////////
' Function Declaration
' ////////////////////
Function IsDrawing()
Dim Ret
Ret = StartDBSearch(mc_alive, -1)
IsDrawing = Ret
End Function
' ////////////////////
' Sub Declaration
' ////////////////////
Public Sub GetReady
Call FreeChains
Call UnselectAll
Call RepaintScreen(True)
End Sub
' ////////////////////
' Function Declaration
' ////////////////////
Function AddBackSlash(sPath)
If Right(sPath, 1) <> "" Then sPath = sPath & ""
AddBackSlash = sPath
End Function