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:

MULTI_POST Questions for Direction of Files


crazy^millman
 Share

Recommended Posts

Ok all the VB and Post experts I am stummped. confused.gifconfused.gif

 

I have added Questions to the Mulit_Post to get it to ask me where to put the files. Asking the questions of where they need to be going is great. I have used this post in the unmodifed way perfect. I now would like to be able to have the dialog come up that give you the option to go the place in the network and put the files where you want and also where to put the setup sheet where you want without having to always go in and changed the post. We have our file done in a that we use the Job numbers in a c:/2003_mc9/2344_mc9 then depending which machine we DNC from could be one of three choices with the same directiory set-up on these DNC computers. Needless to say alot of editing that would not be needed if I can get this to automate a little. Being I suck at VB and think it may invole some of that code I am asking for help.

 

Here is what I did to the Multi_post to this point.

code:

# --------------------------------------------------------------------------

# DEBUG/PROGRAM SWITCHES, debugging and program switches

# --------------------------------------------------------------------------

sNETWORK "WHERE DO YOU WANT THE NC FILE TO GO?"

sSETUP "WHERE DO YOU WANT THE SET-UP SHEET?"

 

 

# --------------------------------------------------------------------------

# Question format statements

# --------------------------------------------------------------------------

fq 1 sNETWORK WHERE DO YOU WANT THE NC FILE TO GO?

fq 2 sSETUP WHERE DO YOU WANT THE SET-UP SHEET?

 

# --------------------------------------------------------------------------

# Misc. Output

# --------------------------------------------------------------------------

pcollect # Collect info

q1

q2

# END_HEADER$

# --------------------------------------------------------------------------

pheader # File header

pcollect

sPOST1 "MPMASTER_FADALRDB.PST"

sPOST2 "HTML2.SET"

#sPOST3 "MPA2100E.PST"

 

# Define the desired output folder for each Post

sFOLDER1 "sNETWORK" #This is where the NC file will go

sFOLDER2 "sSETUP" #This is where the Setup Sheet will go

#sFOLDER3 "C:MCAM9MILLNC"

 

# These strings will hold the built up command parameter strings (done further down)

sPARAMS1 # Declare a string varible to hold command parameter line 1

sPARAMS2 # Declare a string varible to hold command parameter line 2

As with anything I put up here i know it is freaking big and i am sorry for that but appericate anyone being able to help me to get this going in the right direction.

 

Crazy Millman

 

[ 10-07-2003, 02:16 AM: Message edited by: Millman^Crazy ]

Link to comment
Share on other sites

Are you saying your method does not work?

Or you would like a more sophisticated method of inputting the data path (using a dialog box)

 

code:

sFOLDER1  "sNETWORK" #This is where the NC file will go

sFOLDER2 "sSETUP" #This is where the Setup Sheet will go

Note that the above definitions of sFOLDER1 and sFOLDER2 are not want you want.

 

sFOLDER1 "sNETWORK"

 

will load the literal string "sNETWORK" into the string variable sFOLDER1, not the contents of the sNETWORK string variable from the answer supplied by the user input of Question #1

Link to comment
Share on other sites

Ok let me if I can explain it better. I can use the Multi_Post like it was originally with no probelm. It will post the 2 programs I have listed and put the NC program in the place I tell it and it will put the HTML setup sheet where I want it. I have 100's of different places I can put both and I with the way the post is have to modify the Multi_post everytime I want to change their placement accordingly.

 

I created the questions in the hopes that if I put them there it would allow me a little more flexability. It did not work cause I don't know any of the syntax varaibles. I also do not know how to get the windows dialog box to come up for placement of NC code. I was wanting to incorprate the questions as a completion of the answer to put that path back into the place of the post variable I created and finish it from there.

 

I know i can always do it through my web browser over the network and cut and paste the path accordinly just was hoping there was a way to incorporate the great mulit_post with this type of functionality is all. I have still not got my Post CD Yet so I do all of this through trial and error not by having any of the correct definitions to go by infront of me. I have figured all of my post modification and changed ot things like the HTML just by trial and error. I wish had some books on what all the variables are suppose to mean. I just learned yesterday what spathnc, snamenc, and sextnc each will do when called and they are not even defined in my post. Great tool but if you dont have anything to go by how are you suppose to know what they are and do.

 

I did try different ways of using the question answer method I have here before posting this question and I ended as some weird places on the internet at one point.

 

Thanks Again and if this is one of those things I am suppose to go to my dealer with tell me I will just it is so much fun trying to figure this stuff out and love the challage just I dont have all the tools I need.

 

Crazy Millman over and out. biggrin.gifbiggrin.gifcheers.gifcheers.gif

 

[ 10-07-2003, 09:50 AM: Message edited by: Millman^Crazy ]

Link to comment
Share on other sites

Millman^Crazy,

 

If I understand correctly you want to do the following with a toolpathed drawing opened in Mastercam.

 

 

1. Prompt user for folder to output NC to

2. Set active post to MPMASTER_FADALRDB.PST

3. RunPostAll to selected folder

 

 

4. Prompt user for folder to output NC to

5. Set active post to HTML2.SET

6. RunPostAll to selected folder

 

 

7. Set active post to MPA2100E.PST

6. RunPostAll to C:MCAM9MILLNC

 

 

If this is what you need I think it should be pretty straight forward using VBScript, I'll see if I can do it over lunch or after work tonight. In the meantime if you want a stab at it there are some examples located in mcam9VB that will help as well as a RunPostAll example on this forum.

Link to comment
Share on other sites

1.Pound out string declartion descriptions(or you can have them default to "c:progdirectory" and "c:setdirectory" then let user hit end when they pop up and fill in rest of file path.

 

sNETWORK #NC FILE destination directory

sSETUP #SET-UP SHEET destination directory

# ----------------------------------------------

# Question format statements# ---------------

 

2.Quote questions

fq 1 sNETWORK "WHERE DO YOU WANT THE NC FILE TO" fq 2 sSETUP "WHERE DO YOU WANT THE SET-UP"

# -----------------------------------------------

# Misc. Output

# --------------------------------------pcollect # Collect info

q1

q2

 

Jimmy

Link to comment
Share on other sites

Wel I have needed a driver to go pick up soem material take a part ot a customer and get soemthing from another place for about 5 days now. I guess I will have to do it myself. I will problay have to wait till tonight to tyr these thanks alot guy for your time and help it is appericated.

 

Crazy Millman ohhhh yeahhhhhhh oh what fun it is to ride in a one horse opened slay hey

Link to comment
Share on other sites

I have not tested this so there might be a bug or two, anyway have a play with it and see it it helps.

 

code:

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

'//

'// Author: Mick George [email protected]

'// Date: 07/10/2003 12:32 PM

'// File Name: Crazy Millman.vbs

'//

'// Description:

'//

'// Comments: I have not fully tested this so be prepared to tweak this script.

'//

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

 

 

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

Const DEF_POST1 = "MPMASTER_FADALRDB.PST"

Const DEF_POST2 = "HTML2.SET"

Const DEF_POST3 = "MPA2100E.PST"

 

 

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

 

 

 

' -- Start Script

Call Main()

 

 

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

' Sub Declaration

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

Sub Main()

 

Dim strPath

Dim strCurrentPost

 

If Not IsDrawing Then

ShowString "We need a drawing"

Exit Sub

End If

 

' -- Store current post

strCurrentPost = GetPostName

 

' -- Prompt user for a folder to export NC

strPath = BrowseForFolder("Choose Folder for NC Ouput")

 

If strPath = Null Then Exit Sub

 

Call SetPostName(DEF_POST1)

 

Call RunPostAll(strPath, False)

 

' -- Prompt user for a folder to export HTML

strPath = BrowseForFolder("Choose Folder for HTML Ouput")

 

If strPath = Null Then Exit Sub

 

Call SetPostName(DEF_POST2)

 

Call RunPostAll(strPath, False)

 

' -- Ouput to NC folder

Call SetPostName(DEF_POST3)

 

strPath = GetPathFromExtension("NC")

 

Call RunPostAll(strPath, False)

 

' -- Revert back to original post

Call SetPostName(strCurrentPost)

 

End Sub

 

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

' Function Declaration

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

 

Function BrowseForFolder(strPrompt)

 

On Error Resume Next

 

Dim objShell, objFolder, intColonPos, objWshShell

 

Set objWshShell = CreateObject("WScript.Shell")

 

Set objShell = CreateObject("Shell.Application")

 

 

Set objFolder = objShell.BrowseForFolder(&H0&, strPrompt, &H1&)

 

BrowseForFolder = objFolder.ParentFolder.ParseName(objFolder.Title).Path

 

If Err.Number <> 0 Then

 

BrowseForFolder = Null

 

If objFolder.Title = "Desktop" Then

BrowseForFolder = objWshShell.SpecialFolders("Desktop")

End If

 

intColonPos = InStr(objFolder.Title,":")

 

If intColonPos > 0 Then

BrowseForFolder = Mid(objFolder.Title, intColonPos - 1, 2) & ""

End If

End If

End Function

 

 

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

' Function Declaration

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

 

Function IsDrawing()

 

Dim Ret

 

Ret = StartDBSearch(mc_alive, -1)

 

IsDrawing = Ret

 

End Function

Link to comment
Share on other sites

Mick is way too fast...

 

Millman, it is possible to do it all with some simple changes to your MULTI_POST.PST (you were very close), but your input is limited to ALT-V (pasting) the desired folder path or typing the entire path for the answers to the 'fq' post prompt questions. Not the most friendly.

 

But...

If you still would like to use the MULTI_POST.PST method.

You can fire off a VBS from within the PST. This will do the 'BrowseForFolder' dialogs. Then the VBS will write these folder paths out to a text file. The PST then can open this file and read in the folder paths.

This sounds a lot uglier than it really is!

 

If anyone wants - I can upload the new MULTI_POST.PST & MULTI_POST.VBS that do this to the forum FTP.

 

BTW, 'BrowseForFolder' is a function within the VBS script. (I stole this code from one of Mick's scripts for the MULTI_POST.VBS wink.gif ) In his 'BrowseForFolder' function his is using the 'BrowseForFolder' method that is in the Microsoft Windows Scripting Host (WScript.exe) - that is why you don't find it in the VBS help.

Link to comment
Share on other sites

LoL, Roger. I routinely scrutinize people about how reading and comprehension is key.

 

So what did I do? I stole Mick's script, ran it, and didn't even look thru it to see that he created a function for BrowseForFolder using objects. rolleyes.gif

 

Feel free to kick me straight in the shin for being stupid!

 

'Rekd teh hypocrocy!

Link to comment
Share on other sites

Rekd,

 

This ones for you bud cheers.gif

 

code:

' -- Start Script

Call Main()

 

 

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

' Sub Declaration

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

Sub Main()

 

Dim strPath

Dim strMCAM9

 

' -- Get path to MC9 and preselect it in folder dialog

strMCAM9 = GetPath

 

' -- Prompt user for a folder containing dxf files

strPath = BrowseForFolder("Choose Folder", strMCAM9)

 

 

End Sub

 

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

' Function Declaration

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

 

Function BrowseForFolder(strPrompt, strDefault)

 

On Error Resume Next

 

Dim objShell, objFolder, intColonPos, objWshShell

 

Set objWshShell = CreateObject("WScript.Shell")

 

Set objShell = CreateObject("Shell.Application")

 

Set objFolder = objShell.BrowseForFolder(&H0&, strPrompt, &H1&, strDefault) '// <- Pre-Select

 

BrowseForFolder = objFolder.ParentFolder.ParseName(objFolder.Title).Path

 

If Err.Number <> 0 Then

 

BrowseForFolder = Null 'will be null of no special case applies

 

If objFolder.Title = "Desktop" Then

BrowseForFolder = objWshShell.SpecialFolders("Desktop")

End If

 

intColonPos = InStr(objFolder.Title,":")

 

If intColonPos > 0 Then

BrowseForFolder = Mid(objFolder.Title, intColonPos - 1, 2) & ""

End If

End If

End Function

Link to comment
Share on other sites

Yeha Rekd I was at Escondido Metal supply if I was close to you should have called me been gald to stop bought you a cup and chat a minute.

 

Well Guys Guess thta is what I get for opening my big mouth huh. All I can say is wow and thanks for all the help. I just got back and as always have to put out about 10 fires just wanted to see real quick what was going on in here. Mick and Roger I appericate the sharing and I will email you both what I finnaly come up with.

 

Humbley saying thanks, Crazy Millman

Link to comment
Share on other sites

Jimmy just so you know I didn't forget you in the Mix either appericate that. I have just got home so I will try all of this and see where it goes thanks.

 

Crazy Millman

 

Roger if you dont mind it would be great to see what a pro comes up with for those files. It would be cool to see which path I should have taken to get the Multi_Post to work that way I was thinking or the other if that is a better way to do it. Again thanks Alot cheers.gifcheers.gif

 

[ 10-07-2003, 11:49 PM: Message edited by: Millman^Crazy ]

Link to comment
Share on other sites

Did you try..

 

replace

 

code:

' -- Get path to MC9 and preselect it in folder dialog

strMCAM9 = GetPath

with this

 

code:

' -- Get path to MC9 and preselect it in folder dialog

strMCAM9 = "Z:Your FolderYour Sub Folder"

Where "Z" is your drive/path etc? Should work.

 

You should be able to call the dialog and use any "existing" startup folder on your computer or network.

 

'Rekd teh On Error GoTo Hell

Link to comment
Share on other sites

quote:

If anyone wants - I can upload the new MULTI_POST.PST & MULTI_POST.VBS that do this to the forum FTP.

Come to think of it.. I can think of several uses for this. Would you be so kind? biggrin.gif

 

'Rekd

 

:edit:

LoL, 3 posts in a row in the same forum. I need to go back to eMastercamer's Anon meetings.

:/edit:

 

[ 10-08-2003, 01:03 AM: Message edited by: Rekd ]

Link to comment
Share on other sites

No Jimmy that still will do it just like the way the post is in it origianl sate I just have questions to help point it is all. I like what mick had for the last VB code that was good just need to see if what Rekd suggest will go the high in the order of directory at Network Places.

I cna get Mulit_post to work perfect but just was trying to make the editing of that post everytime not have to be there is all.

 

Thanks Jimmy I appericate you getting back to me on that. I will send you a copy of what we all get figured out if you like.

 

Ok Rekd I was going at it the wrong way again my ingorance about VB. Guess I should stick with MP till got that down huh. Next time I got a road trip I will make sure to swing by and got no problem buying surley after all the help you have given me.

 

Crazy Millman

 

edited/ You trying to follow my lead I did the same thing right before you lol biggrin.gifbiggrin.gifbiggrin.gifbiggrin.gif / end edit

 

[ 10-08-2003, 01:23 AM: Message edited by: Millman^Crazy ]

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