View Full Version : Mastercam VB....?


cansucuoglu
11-21-2007, 06:03 PM
Hello;

I am newly staring writin Vb on mastercam. I have been using RhinoScript for a long time. I think I understand enough fom VB but, in mastercamVB I am totaly paralyzed.

Do you guyz know any tutorial or reference with mastercamVB.

C.

PeterCharles
11-25-2007, 04:30 PM
Are you working with stand alone VB, or does Mastercam use VBA (Visual Basic for Applications) as it's macro language?

Either way, a basic understanding of VB syntax is a good starting point.

cansucuoglu
11-26-2007, 06:35 PM
Well, MasterCam started to support VB in the new version. I think I know VB as RhinoScript is VB(a little bit modified). It is not the macro language though. I am struggling to understand MasterCams mentality I guess maybe....

PeterCharles
11-27-2007, 01:52 PM
Not having access to Mastercam I can't advise further, but found this on another forum:-
"I understand that Mastercam will have VBA in the near future. This level of automation will be much easier to achieve when it has VBA integrated."
I would expect to find VBA (if it's there) in the menu system under something like Tools/Macros or something like that. Did look on the Mastercam web site but couldn't find any info (bit poor really). Nothing in the help files??

Switcher
11-27-2007, 02:00 PM
I don't work with mastercam (I did stay @ a Holiday Inn, once :) ), found this pdf (http://www.mastercam.com/Camzone/Newsletter/Archives/1st2003.pdf) on the site, not much info at all.


Have you ever wished you could automate
the repetitive tasks you do in
Mastercam? Perhaps you work with a vendor
that is always requesting work that is a variation
on past jobs, and you need the ability to
quickly update an entire family of parts and
their toolpaths. In the past, these types of
customizations were available to only those
with a good knowledge of programming in C
language and the appropriate compiler, or the
money to hire a professional C-Hook writer
to do the job for them.
With Version 9.1, Mastercam now has the
ability to automate tasks using Microsoft's
Visual Basic® Script, commonly referred to as
VB Script. This new feature makes automation
of Mastercam possible for every
Mastercam user. If you are familiar with creating
your own macros in MS Word®, MS
Excel®, AutoCAD® etc., then you will easily
be able to develop Mastercam scripts. This is
an invaluable tool for automating repetitive
tasks, family of parts applications, and making
complex tasks easier.
Here's a scenario that could become a reality
for a customer with a specific product, like
entertainment centers, that vary in size and
material. The order gets taken by phone or
via e-mail. As the order entry is completed,
a VB Script grabs the sizes, quantities of the
pieces, and materials that make up the product.
This information is used by Mastercam
to create the parts, create toolpaths, nest the
parts, and send the information to the
router on the shop floor. How can someone
who knows Visual Basic do this?
Although VB Scripts can be written using
any text editor, the Mastercam V9.1 VB
Script editor has been developed to make the
process easier. The Mastercam VB Script
Editor offers many options to help you
develop your Mastercam scripts quickly and
effortlessly. Some of the options include:
• Syntax Highlighting - Similar to the
macros in MS Word, Mastercam's color
syntax highlighting helps to identify
spelling mistakes that lead to syntax errors.
Highlight Mastercam-specific functions, VBspecific
functions, and reserved words to
make your code easier to read.
• Intellisense - Mastercam's Intellisense
gives you access to a drop-down list of
available Mastercam functions, classes, and
constants. This feature is great for new
Mastercam programmers to become familiar
with all the available functions. Currently
there are more than 200 functions available.
• Bookmarks - Bookmarks can be used to
mark lines of code in the editor so that you
can easily return to them later.
• Commenting - Code can be commented
out or uncommented by selecting the lines
you want and clicking the applicable menu
item.
• Advanced search and replace - Search up
and down, by word, or by expression and
replace. Or search for a specific line.
For a more detailed document covering the
use of the Mastercam VB Script editor, visit
www.mastercam.com/VBScript.

PeterCharles
11-27-2007, 04:43 PM
My understanding is that VB sort of comes in three versions
1) Visual Basic (VB). A programming language that enables you to create stand alone programs (exe's also dll's), some of which can interact with other programs. I've created a VB exe that uses MS Word to create the end user document, and a VB dll that interacts with Inventor.
2) Visual Basic for Applications (VBA). This is the MS macro language incorporated into Word, Excel etc. It's also used by other mainstream software, ACAD and Inventor to name just two. Generally the syntax is similar to VB, but not identical as it runs within an application, but does not create stand alone applications.
3) Visual Basic Script (VBS). A scripting language, again with syntax similar to VB. But it is what it says, just a scripting language more limited in use than VBA. Frequently used for Internet applications as an alternative to JavaScript. http://msdn2.microsoft.com/en-us/library/ms950396.aspx

If Mastercam includes VBS then they should have covered it in the help files.

cansucuoglu
11-27-2007, 05:08 PM
Thanks,

They do cover some stuff but more confusing then actually helping though. Having their strange methods... I feel as if it is not flexable and really stiff.

I am trying to attach the help file.If you guys would like to see...

PeterCharles
11-28-2007, 01:12 PM
I noticed this in your file -
If you need to view documentation regarding the VB Script language itself, please refer to SCRIPT56.CHM in the ‘Help’ sub-directory of your Mastercam installation.

Does this help file contain any real help?

cansucuoglu
11-28-2007, 01:45 PM
That one is the microsofts VB manual.... The same as the website posted in one of the previous posts.
I was happy when I saw it.
Well actually, i think i got the problem:
MasterCam has a very dominant GUI and any command I give it pops up a window. And I cant figure out how to access without windows. (AutoCad with do if you type things with a - in front). So script stops al the time to ask things it allready knows, and doesnt transfer lets say selection to my geometryOperationsEditor...

If anyone knows about this, it would be so great

Lars
12-06-2007, 08:01 AM
I would probably recommend that you posted your question in the Mastercam section on this forum, there are some very smart people on this forum who know a great deal about Mastercam, they might just not be looking in this section.

HTH
Lars