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:

Variable names and documentation


Recommended Posts

Hello all,

 

I am currently using X5.

 

I wish to find all available information for using VB script to automate as much of the "routine" tasks as possible. A very simple example would be to post to several different machines automatically.

( this routine partially functions, but the editor keeps popping open for each machine even though I have tried to keep it closed)

 

I have read the "MASTERCAM.FT" file and found that many funtions can be called from SCRIPT as long as the correct parameters are used. Where can I find any detailed information on the proper use of this file? When should I pass any parameter along with the function call, and how do I know what they are? I have tried using some of them from script with less than total success.

 

Can any hot keys be called directly from script? If so, how might I do it?

 

I have also read the MASTERCAM help file located in the editor used for VB script. Much of that information also refers to "MC9" data. Is this file up to date? While looking through it I do notice that many of the calls do reference new features, but yet I feel something might be missing. Can anyone provide some insight ( examples of code) that would aid me in my learning process?

 

Just for example, I translated (copied) some geometery. I ended up with both group and results. How do I clear the colors from both the group and the result? I tried using the 'CALL RUNFTCOMMAND("MASTERCAM","ClearColors")' but it did not work. Again, perhaps I am missing something. Also, I have tried using the "create_letters" function without any luck.

 

If possible, please point me in the right direction. I have asked my tech support group for all the information they had. While they were very receptive to my questions, they did not have much information.

 

Any and all help is most appreciated.

 

Regards,

Steven

Link to comment
Share on other sites

I have just tried several different calls to the MASTERCAM.FT file. None of them worked.

 

Could it be that I do not have the location of the file correctly mapped out? Do I need to set any part

of the configuration to allow Mastercam to use this function? All help is appreciated.

 

Regards,

Steven

Link to comment
Share on other sites

if you are using MasterCam's VBScript, you dont need to call the .ft file. You make your own vbscript and call commands from there.

 

From a masterCam VBSCript:

 

RunMastercamCommand "OnScreenRegenerate"

 

when you start up the vbscript editor, click "Help", "MasterCam VBSCript for help with Mastercam's VBscript commands.

 

also, the editor keeps popping up after you post code because you need to toggle a setting in the Post ....

change the "bug1$" value to 0

Link to comment
Share on other sites

Thank you for the help.

 

Could you please clarify where to get the list of commands for the "runmastercamcommand" function?

 

I did not see what I expected to see in the help file.

 

I did see a list of calls in the VB example for version 9, showing all the mastercam calls.

 

Also, could you please explain calling hot keys?

 

You have been most helpful and I really appreciate the time you are taking.

 

Regards,

Steven

Link to comment
Share on other sites

The commands you can run using RunMastercamCommand are the "commands" you see in the Mastercam.FT file.

 

Also, could you please explain calling hot keys

You don't call hotkeys from a script, but you can run a script from a hotkey -->

 

To be able to launch a VB Script from a toolbar button and/or a keystroke command...

You must use the ScriptLinker utiltity to "setup" the Script.

 

Available here (scroll down to the Add-Ons section) ->

Mastercam-Downloads-X6

 

*These direct links are for X6!

If using a different version be sure to download the ScriptLinker for the version of Mastercam that you are running!

ScriptLinker [64-bit X6]

ScriptLinker [32-bit X6]

Link to comment
Share on other sites

Hello again,

 

Making great progress now.. thanks to all your help.

 

Does anyone know how to retrieve the NC FILE NAME or the PROGRAM # from the toolpath group or

using VB script?

 

Thanks,

 

Steven

 

The closest I've been able to do is to use GetNciNameFromOperationID. It will give the filename, but not the extension, of the posted code AS LONG AS THE USER DOESNT OVERRIDE the filename when they post.

Link to comment
Share on other sites
  • 2 months later...

Hello again,

 

I seem to need a little more help.

 

Can anyone provide some SCRIPT examples of creating and modifying toolpaths?

 

I would very much like some examples of chaining, and sorting chains.

 

I have a project where a single contour path will contain up to 100 chains and should be

sorted by "Z" level. Can anyone provide some examples of sorting chains in a toolpath,

or information on how to sort while chaining?

 

any information is much appreciated.

 

Steven

Link to comment
Share on other sites

This script will import Op1 from the operations file exported to "c:\tmp\IMPORTOP.OPERATIONS-6"

and then prompts you to select a chain to go with the Operations Geometry.

 

Sub Main()
Dim strInputFile : strInputFile = "c:\tmp\IMPORTOP.OPERATIONS-6"
Dim intOpNumber : intOpNumber = 1
Dim strComment : strComment="Test"
Dim objOverRide
Set objOverRide= New McOverride
objOverRide.DepthOn = False
objOverRide.FeedRateOn = False
objOverRide.FeedRatePercentOn = False
objOverRide.SpindleSpeedOn = False
objOverRide.SpindleSpeedPercentOn = False

Dim blSuccess
blSuccess=AskForChain("Select a chain")
Dim intOpID
intOpID = MakeOperationFromID(strInputFile, intOpNumber, strComment,objOverRide)

End Sub

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...