Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

VBS for change machinetype


Recommended Posts

Yes, you're looking for SetActiveMachine()

 

Here's a snippet from one of my scripts:

 

For Index = 1 To Ubound(Ar)

Call SetPostName(PostPath & Ar(Index) & PostExtStr)

Call SetActiveMachine(MachPath & Ar(Index) & MachExtStr)

Call RunPostAll(UserOutputPath, False)

Next

 

I case you're not aware, documentation of the vbscript functions available is in VBScript.htm.

(in the help subdirectory, under your mastercam installation directory.)

 

There is also SCRIPT56.CHM in the same location, which contains general documentation about the language itself.

  • Like 1
Link to comment
Share on other sites

Here's another version that a new guy might find easier to follow:

 

This will change the machine to the MasterCam supplied machine named "MILL 3 - AXIS HMC MM.MMD-6"

it looks in the default folder "C:\Users\Public\Documents\shared Mcamx6\CNC_MACHINES\", which is the default folder in Mcx6, and Windows 7 :

 

Sub Main()
' -- Add code here...
' define a variable for your machine folder
Dim MachineFolder
MachineFolder="C:\Users\Public\Documents\shared Mcamx6\CNC_MACHINES\"

' define a variable for the machine (.mmd-6)
Dim MachineName
MachineName="MILL 3 - AXIS HMC MM.MMD-6"

' define a variable to tell us whether we suceeded or not
Dim Success
' change the current machine to what we have above
Success=SetActiveMachine(MachineFolder & MachineName)

' pop up box to tell us the results
If Success = True Then ' we changed the machine
 ShowString "Machine Def was successfully changed"
Else
 ShowString "Machine Def change was unsuccessfull"	 ' something went wrong
End If

End Sub

  • Like 1
Link to comment
Share on other sites
  • 1 month later...

As I said in post #2:

 

I case you're not aware, documentation of the vbscript functions available is in VBScript.htm.

(in the help subdirectory, under your mastercam installation directory.)

 

There is also SCRIPT56.CHM in the same location, which contains general documentation about the language itself.

 

on my system that's C:\Program Files\mcamx6\help for X6, C:\Program Files\mcamx7\help for X7

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...