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:

How to post every operation to another NC-file?


MCHulk
 Share

Recommended Posts

Does anybody here know, how to post automaticly every selected operation in the operation manager to a unique NC-file?

For example, if i have 10 operations in the operation-manager, i need 10 NC-files.

How should i modify my post, so that i get the files?

 

Thanks in advance,

MCHulk smile.gif

Link to comment
Share on other sites

This script will iterate all operations in current drawing and post. I believe SP2 is required to run this script.

 

code:

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

'//

'// Author: Mick George [email protected]

'// Date: 11/11/2003 09:34 PM

'// File Name: NC for each OP.vbs

'//

'// Description:

'//

'// Comments: I should be playing threewave...

'//

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

 

Const DEF_MY_POST = "MPFAN.PST"

 

 

' -- Start Script

Call Main()

 

 

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

' Sub Declaration

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

Sub Main()

 

 

Dim intOpsCount, intThisOp

Dim strPost

 

' -- Pass a null string to tell MC we want this files ops

intOpsCount = GetOperationCount(vbNullString)

 

' -- Any operations?

If intOpsCount > 0 Then

 

' -- Set our post

strPost = GetPathFromExtension("PST") & DEF_MY_POST

Call SetPostName(strPost)

 

' -- Iterate our operations

For intThisOp = 1 To intOpsCount

' -- Post each operation

If Not RunPost(intThisOp, GetOperationNameFromID(vbNullString, intThisOp), False) Then

ShowString "Failed to create NC for operation " & intThisOp

End If

Next

 

Else

ShowString "Nothing to post"

End If

 

 

End Sub

Link to comment
Share on other sites

Ok Mick sorry to come in late here BTW cool script. Could you just use the neat script for Folder calls to defalut to the post area to grab the post you want for the post and have both scripts tied together or is that to complicated.

 

I am thinking I would like to be able to make a button script like the toolbar that look likes this. CrazyPost.jpg then I could just do things from here I know it would have to do this in such a way as too go from ops but I guess more wishful thinking than anything.

 

Crazy Millman teh VB is on my things to do list.

Link to comment
Share on other sites

Here it is..

 

code:

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

'//

'// Author: Mick George [email protected]

'// Date: 15/12/2002 11:00 AM

'// File Name: Calling VB DLL Example

'//

'// Description: Shows how to call a VB ActiveX Project (DLL)

'//

'// Comments: You will need to install and register the ActiveX DLL in order to use it.

'// e-mail me if you need help doing this. Place the DLL in the same folder as this script.

'// This script shows how to load a dialog and take user input and get it for this script.

'// Open the VB Project and run it, then run this script from Mastercam to see how this works.

'//

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

 

 

' -- Start Script

Call Main()

 

 

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

' Sub Declaration

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

Sub Main()

 

On Error Resume Next

 

Dim objExampleDLL

Dim FSO

Dim fsoFile

Dim strText

Dim blnCheck

Dim blnOption

 

 

' -- Create an instance of our DLL

Set objExampleDLL = CreateObject("mcTestClass.CMainFrontEnd")

 

' -- Make sure we are OK to go

If Err Then

If objExampleDLL Is Nothing Then

ShowString "Could not load DLL"

Err.Clear

Exit Sub

Else

ShowString "An error has occured " & Err.Description

Err.Clear

' -- Refresh the screen

Call RepaintScreen(True)

Exit Sub

End If

End If

 

If Not ClearScreen() Then

' -- Refresh the screen

Call RepaintScreen(True)

Exit Sub

End If

 

' -- Clear memory

Call NewMC(False)

 

' -- Show the dialog

With objExampleDLL

 

Call .RunMain

 

' -- Make sure we are ok to go

If .OkToProcess Then

 

' -- Refresh the screen

Call RepaintScreen(True)

 

Set FSO = CreateObject("Scripting.FileSystemObject")

 

If FSO.FileExists("C:CMainFrontEnd.txt") Then

 

Set fsoFile = FSO.OpenTextFile("C:CMainFrontEnd.txt")

 

strText = fsoFile.ReadLine

blnCheck = fsoFile.ReadLine

blnOption = fsoFile.ReadLine

 

fsoFile.Close

 

' -- Safely unload the dll

.ShutDown

 

ShowString "Text = " & strText

 

If blnCheck = 1 Then

ShowString "Checkbox was selected"

Else

ShowString "Checkbox was NOT selected"

End If

 

If blnOption = "True" Then

ShowString "Checkbox was selected"

Else

ShowString "Checkbox was NOT selected"

End If

 

 

Else

ShowString "Could not find file C:CMainFrontEnd.txt"

Exit Sub

End If

 

Else

' -- User cancelled?

End If

 

End With

 

If Err Then

ShowString "Error raised in Sub Main() " & Err.Description

End If

 

' -- Clean up

Set objExampleDLL = Nothing

Set fsoFile = Nothing

Set FSO = Nothing

 

 

End Sub

 

 

 

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

' Function Declaration

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

Function ClearScreen()

 

ClearScreen = True

 

' -- See if there is a drawing active

If ChainAll(False,False,mcCHAIN_ALL_NUMBERED_LEVELS , mcCHAIN_ALL_NAMED_LEVELS) = True Then

 

' -- Ask to clear screen

If Not askYesNo("Current drawing will be cleared, do you want to continue?") Then

ClearScreen = False

End If

End If

 

 

End Function

It's in your "/VB/Visual Basic Example" folder

 

'Rekd

Link to comment
Share on other sites

Ok cool beans Rekd I left you a voice message need to come by to check this bad boy out. I am now getting the why didnt we do this 6 months ago and wow it is fast and holly sh?t how did it changes tools that fast. It rocks I have also set the pst up to do G154.1 which is now the new G110 so when I do 1 in the work offset I get G154.1 P1 and so on and son I am using the Mpmaster and have the G187 you showed my ealrier in the post I am now going to put all the Canned cycles like the Engraving and other things in here see where they kick but on here. I will say I am suprised about this machine it rocks.

 

Crazy Millman

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