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:

Recommended Posts

I am interested in learning more about Vb to automate some of my mastercam tasks but I was told by a bright guy that VB is on the way out, and that VB.net will be taking its place. He says that they do not have much in common, so I should find out which way mastercam is going before I invest in classes. I am very ignorant about VB or any programming language for that matter, so any help at all would be great. Thanks ahead of time guys

Link to comment
Share on other sites

VBS is an interpreted language and scripts can be written using Mastercam's nice VBS editor (props to Mick) or any text editor. VBS scripts usually don't have a UI (although they can if you create an OCX using another dev tool).

 

I'm not sure how much I'm allowed to say at this time, but if you want to have functionality like the C-Hooks have today, look into the .NET languages wink.gif

Link to comment
Share on other sites

somename75,

 

Good question.

 

Your friend is correct that VB6 is going the way of the dinosaur; Microsoft does not sell VB6 any longer and is offering only limited support for it for another 5 years or something close to that. VBA is still going strong and MS has yet to release Office or any of its other products (that I am aware of) using Visual Studio for Applications (VSA) that is built upon the .NET framework but you know its coming.

 

So what should you learn today? I feel that learning VB is still viable, if you are going to be doing a lot of VBA and VBS programming then the syntax for each of those languages are almost identical with a just few subtle and perhaps not so subtle differences between them. Looking forward, VB.NET would be the obvious language choice (IMHO) when your back ground is VB, this is what I did.

 

How does this all tie in with Mastercam? With version 9.1 you can write VB Scripts to automate various tasks, so if you decide to learn VB today you can jump right in and get scripting, remember to that if you need to create custom dialogs you can do this with VB6 and have a VB Script interface with it. If you will be upgrading to Mastercam X in the near future then you not only have the option of continued scripting development but also the ability to develop add-in applications (NET Hooks) using .NET, again VB.NET would be the obvious choice.

 

I believe that no matter what language you choose to learn you can’t go wrong and it will certainly not be wasted time.

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

:bump:

 

Mick, I believe it was you that mentioned SharpDevelop. I d/l it and have been roaming around in it for a couple of weeks now. I just don't get it. I was able to teach myself Basic and Visual Basic, but this is just un-clear.

 

I also don't have any samples, and the help files aren't much help. (When they decide to run without crashing that is)

 

What's the best way to figure this out? I'm fine with VB, but dang, I can't find many good resources for it.. :grumble:

 

'Rekd teh easily confused

Link to comment
Share on other sites

Rekd

 

Here is a script to call a sample SharpDevelop VBNET combine (project), the project is on the ftp in the VB_Scripts folder called SharpDevelopVBExample.zip.

 

I only spent 30 minutes or so on it so its a little rought around the edges but basically the exe gets called by Mastercam, the user makes a selection and the script echos back those selections via a text file the EXE creates on the OK button click.

 

 

code:

'////////////////////////////////////////////////////////////////////////////////

'//

'// Author: Mick George [email protected]

'// Date: 05/04/2004 04:33 PM

'// File Name: SharpTest.vbs

'//

'// Description: Calls a VB.NET exe created in SharpDevelop for .NET

'//

'// Comments:

'//

'////////////////////////////////////////////////////////////////////////////////

 

 

'///////////////// My Constants /////////////////

Const DEF_SHARPAPP = "MyTestApp.exe"

Const DEF_FILE = "C:SharpTest.txt"

'///////////////// My Global Variables //////////

 

 

 

' -- Start Script

Call Main()

 

 

' ////////////////////

' Sub Declaration

' ////////////////////

Sub Main()

 

 

Dim FSO

Dim fsoSharp

Dim strText, strCheck, strOption

Dim strEXE

 

 

Set FSO = CreateObject("Scripting.FileSystemObject")

 

' -- Build path to exe

strEXE = GetPathOfThisScript & DEF_SHARPAPP

 

If Not FSO.FileExists(strEXE) Then

ShowString strEXE " is missing"

Exit Sub

End If

 

' -- Show the EXE

Call ShellAndWait(strEXE, True)

 

If FSO.FileExists(DEF_FILE) Then

 

Set fsoSharp = FSO.OpenTextFile(DEF_FILE)

 

strText = "Text = " & fsoSharp.ReadLine

strCheck = "Checkbox was " & fsoSharp.ReadLine

strOption = "Option button was " & fsoSharp.ReadLine

 

fsoSharp.Close

 

ShowString strText & vbCrLf & strCheck & vbCrLf & strOption

 

End If

 

' -- Clean up

Set fsoSharp = Nothing

Set FSO = Nothing

 

 

End Sub

 

' ////////////////////

' Function Declaration

' ////////////////////

 

Function AddBackSlash(sPath)

 

If Right(sPath, 1) <> "" Then sPath = sPath & ""

AddBackSlash = sPath

 

End Function

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