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:

Feedback wanted - Mastercam VBScript


Recommended Posts

  • Replies 67
  • Created
  • Last Reply

Top Posters In This Topic

Hi Mick

 

We just saw the KCDw link to Mastercam with the help of Paul M. from CNC. Very interesting stuff, definitely needed to simplify panel processing in Mastercam. Hopefully, we will see the same compatability with Cw, CV, and 20/20 in the near future. Easy application of toolpaths to nested sheets is an absolute must and is much appreciated.

Link to comment
Share on other sites

Peter,

 

Feedback and interest for the link has been very positive. The guys at KCDw are awesome to work with and they have done an outstanding job with their software.

 

In regards to automation with other cabinet software applications, we are looking into this and will formulate a plan on whats next soon.

 

Thanks for your support.

Link to comment
Share on other sites

I just started playing with MasterCams VBscript last week. I have exp. with VB.net & use it to create all my dialogs. This combination seems to work well. I was able to create a setup sheet application in 3 days. That is includeing the time it took to get familar with MasterCams script editor.

 

With that being said, I look forward to being able to skip the middle-man "Vbscript" and have a direct link to MasterCam & vbnet via an OCX control. That would be very sweet!!! Any indication of this becomeing reality in version X?

Link to comment
Share on other sites

So dgreife good for you to have done in days what has taken me months and still have not got right.Question since you seem to be a person understanding of Vbscript how did you get the buffer to output the Max/Min correctly using the HTML tranfer protocalls to keep everything in line. I dont have any education in Vb and was wondering if you wouldn't mind sharing the tid bit of code you created to swap the buffer correctly for all the tools for a the complete nc program. Be real cool if you wouldn't mind puttting up a picture of your Set-up sheet alot of people have who have worked on them. I had mine up but my anglefire account got closed like alot of the other guys around here.

 

Crazy Millman

Link to comment
Share on other sites

Well Mick I'll put it like this. What you guys are doing with VB sounds way cool.

 

However, I will prol never take any courses or even try to learn any VB.

 

I like Mastercam "because" you don't need to know any of that stuff and a simpleton like myself can just about machine anything there is to machine.

 

And we all know if you can't draw it, you can't machine it. I think you guys have this nailed down as well.

 

In the past you guys have added lots of good stuff to Mastercam that keeps me upgrading.

The way it is right now, I could prol use Mastercam 9 for the rest of my life and not need to upgrade again.

 

'Bout the only thing that would make me want X is if you added some free stuff, like STEP, RtoV, ect.

 

Having said all that, I will prol go ahead and get X anyways as long as I still have the money. I want to keep on supporting Mastercam because it has been real good to me smile.gif

 

 

Murlin teh cheers.gif

Link to comment
Share on other sites

Crazy,

Wow! I obviously offended you. wasnt intentional, sorry. I wasnt trying to brag on myself. I was trying to brag on the combination of vb.net & scripting. Besides it sounds like your set-up sheet is alot more complicted than I needed mine to be. All I did was pull the toolnumber, Dia, ect... with a script and output it to a .txt file, fire of a .net exe wich creates the .html

 

I am not a MasterCam user. Just a amatuer .net programmmer. When I am assigned a project that I need to work with MasterCam on, I depend heavily on you guys on this forum. Somebody here always helps me. peace. biggrin.gif

Link to comment
Share on other sites

Oh no not in the least just hoping you would share code is all. biggrin.gifbiggrin.gif Sorry I seem to come across like a real arse to everyone latley been the biggest reason for me staying away. I even wnet back and made sure it didn't sound like mean talk sorry if it did come across that way.

 

Crazy Millman just cant seem to get his point across

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

Hi Mick;

 

I didn't take the time to read all the replys about your question but for me VB Script could be a very very very useful tool.

 

Were I work, we have repetive geometries models that are needed for the product we make. They are usually one of kind but always built from the same geometries but with different sizes and in different quantities and different location.

 

What I want to do is use typical stored operations in an OP9 files and use VB script to automate the process of creating the NC files with the geometries organized on different levels.

 

Since I am "fluent" in Visual Basic, my goal is to use this tool in order to cut to a very minimum the time it takes to do the operation programming.

 

My next project would be to create some parametric models in VB again for some of same geometry style but with diffrent dimensions.

 

By the way is there another source of information other than the mimimal description of the calls of the Mastercam functions available to VB Script? All I found was in the help file which fell short on some parameter description not to say the record or class description. Also I would like to understand how the geometries are "collected" or organized in the process of attaching them to operations.

Link to comment
Share on other sites

Jay,

 

We are currently in the final stages of testing our Automatic Toolpathing script add-in. There are two, one specifically to batch process jobs exported from KCDw (cabinet design software) and a 'generic' Mastercam add-in that can batch processes DXF, DWG and MC9 layered files.

 

I'll e-mail you the info Monday needed to get the current build.

Link to comment
Share on other sites

Hi Denis,

 

There are a few script examples that I have posted in this forum and I'm pretty sure there are a couple that show how to get a saved operation from an OP9 file and apply it to specific entities, there should also be some geometry creation examples here to. Do a search for script and it should yield plenty of postings. If you find that you are still missing some key information or example code please feel free to post here and I'll do my best to help. I prefer to post here so others can benefit from the examples.

Link to comment
Share on other sites

I've been reading the book "learn microsoft VBScript in a weekend", and have a pretty good idea of what I need to do for a set-up sheet, using the MC specific commands for VBS. I notice however, that there doesn't seem to be commands for getting flute length or overall length of a tool. Is there a way to do this, possibly reading the NCI code or such? I can read the lines where the tool information is stored, would need to figure out how to tell VBS to read the line numbers, then read the data between the spaces or something like that, as the data fields can vary in length.

 

John

Link to comment
Share on other sites

quote:

I can read the lines where the tool information is stored, would need to figure out how to tell VBS to read the line numbers, then read the data between the spaces or something like that, as the data fields can vary in length.


VB has a handy dandy function called Split() that tokenizes a string on a given delimeter. So to split up a line on the spaces, you could do the following:

 

code:

Dim arrTokenizedLine

 

' arrTokenizedLine becomes an array containing each otken

arrTokenizedLine = Split(strLineOfCode, " ")

From there, to get the line number, assuming that the first element in the arrTokenizedLine array begins with "N", you could extract the line number with a function like this:

 

code:

Function RetrieveNumericValue(strTextString)

Dim nX

Dim strNumericString

 

 

If Len(Trim(strTextString)) = 0 Then

Exit Function ' this is an empty string

End If

 

For nX = 1 To Len(strTextString)

Select Case Mid(strTextString, nX, 1)

Case "0" To "9", ".", "-" ' is this character a number or decimal or negative?

' add it to the string being built

strNumericString = strNumericString + Mid(strTextString, nX, 1)

End Select

Next nX

 

RetrieveNumericValue = strNumericString ' return the purged string containing only numbers and decimals

End Function

So getting the line number, assuming that we're dealing with a valid line (use the Left() function to make sure you have "N" at the beginning), would be as easy as:

 

code:

Dim nCurrLineNumber

 

nCurrLineNumber = RetrieveNumericValue(arrTokenizedLine(LBound))

Hope that's a start wink.gif

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