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:

André Lapointe@In-House Soluti

In-House Solutions
  • Posts

    125
  • Joined

  • Last visited

Posts posted by André Lapointe@In-House Soluti

  1. inside the control definition file look into the Files tab and make sure you have in the posting error file section all error message to file as message option.

    This should get rid of the display of reinitializing you see in the posting status bar.

    As for why running the debugger seeme to fixed it I don't know.

  2. Hi Todd,

    I can confirm to you that what you want to do is possible. All you have to do is to call from the ppost$ block, the command that launch the execution of the mp.dll and give the second post you want to be run.

     

    If I'm not clear let me know and I'll try to gather a quick example.

     

    Andre

  3. Thanks Roger,

    The main reason why I wanted the VBS instead of the Nethook is because I didn't want to support the Nethook at every new release of Mastercam.

    The VBS allow me to just copy and pste to the new folder, I put it in the post folder so I don't even have to change the path in the post for it to work in a more recent version.

     

    As for the window I was refering to in Mastercam, yes it is the file select/open dialog box.

     

    Thanks for looking at it I really appreciate it!

     

    I guess I'll discuss with the customer to see what he prefers, starting on the desktop or in the sub folder with no possibility to go higher in the root.

    Thanks again.

  4. Hi!

    my first try to do a vbscript and I'm almost to where I'd like to.

    Here is the project, I'd like to browse for a folder but I don't want to start from the desktop everytime. I'd like to start from a predefine folder but I would alos like to keep the possibility to go up some level. As I have been able so far to get the the starting folder I wanted but I can't go higher in the root...

    Also if I could get a window format with the favorites (like the Win7 browser window for example) it would be great! (I've read there is something about the browseinfo function or command but I don't understand how to use it exactly)

     

    So basically I'd like to either one of these 2 solutions:

    - Start to a predefined folder but with the possibility to go up the root or even change completely the location.

    or

    - use a browser window like the mastercam one or the WinXP or Win7 browser with the favorites or special folder on the left side for quick selection.

     

    Any help is appreciated

     

    thanks in advance

     

    PS Note that I'm calling this script from a post so that is why I write the selected folder into a text file.

     

    André

     

    here is the code I'm using right now.

     

    '///////////////// My Constants /////////////////
    
    
    
    
    
    
    
    '///////////////// My Global Variables //////////
    
    
    
    
    
    
    
    ' -- Start Script
    
    Call Main()
    
    
    
    
    
    ' ////////////////////
    
    ' Sub Declaration
    
    ' ////////////////////
    
    Sub Main()
    
    
    
    ' ***************************************************
    
    ' * This function will open the NC file for the nest
    
    ' ***************************************************
    
    
    
    Dim strOutputFolder
    
    Dim FSO, fsoMCX, fsoFiles, fsoNCFile
    
    
    
    Set FSO = CreateObject("Scripting.FileSystemObject")
    
    
    
    ' -- Get MCX folder 
    
    strOutputFolder = BrowseForFolder("Select folder containing MCX files")
    
    If FSO.FolderExists(strOutputFolder) Then 
    
    
    
                   Set fsoMCX = FSO.GetFolder(strOutputFolder) 
    
                   'strOutputFolder = BrowseForFolder("Select folder for NC Output files")
    
                   'If FSO.FolderExists(strOutputFolder) Then 
    
                   '               Set fsoFiles = fsoMCX.Files
    
                                   ' -- Iterate all files per folder 
    
                    '              For Each fsoMCX In fsoFiles   
    
                   ' -- Only looking for MCX files
    
        '          If Right(ucase(fsoMCX.Name), 3) =  "MCX" Then
    
                   ' -- Open it
    
         '         Call NewMC(false)
    
          '        Call OpenMC(fsoMCX)
    
                                                   ' -- Post it
    
                                   'Call RunPostAll(strOutputFolder, false)
    
                   'End If
    
                   'Next
    
       'End If
    
       FSO = WriteFileText(strOutputFolder)
    
    End If
    
    
    
    ' -- Clean up
    
    Set fsoNCFile = Nothing
    
    Set fsoFiles = Nothing
    
    Set FSO = Nothing
    
    
    
    End Sub
    
    
    
    
    
    
    
    ' //////////////////////////////////////////
    
    ' Function Declaration
    
    ' Returns vbNullString if no folder selected
    
    ' //////////////////////////////////////////
    
    
    
    Function BrowseForFolder(strPrompt)
    
    
    
       On Error Resume Next
    
    
    
       Dim objShell, objFolder, intColonPos, objWshShell
    
       Dim FSO, varTemp
    
       Const sFilestart = "C:\Users\Andre Lapointe\Documents\my mcamx5\Mill\NC"
    
    
    
       ' -- Create our all important objects
    
       Set objWshShell = CreateObject("WScript.Shell")
    
       Set objShell = CreateObject("Shell.Application")
    
       Set FSO = CreateObject("Scripting.FileSystemObject")
    
    
    
       Set objFolder = objShell.BrowseForFolder(&H0&, strPrompt, &H1&, sFilestart)
    
    
    
       ' -- Initialize to failure
    
       BrowseForFolder = vbNullString
    
    
    
       ' -- Did the user Cancel?
    
       If Not objFolder Is Nothing Then
    
    
    
           Select Case objFolder.Title
    
    
    
                  ' -- Did the user select Desktop?
    
                  Case "Desktop"
    
                      BrowseForFolder = objWshShell.SpecialFolders("Desktop")
    
    
    
                  Case Else
    
                       ' -- Get the folder selected
    
                       varTemp = objFolder.ParentFolder.ParseName(objFolder.Title).Path
    
    
    
                       ' -- If the user does not select a folder or cancels out an error is raised
    
                       If Err Then
    
    
    
                          Select Case Err.Number
    
                                 ' -- Probably root drive selected e.g. (C:)
    
                                 Case 91, 424
    
                                       ' -- Check for Root
    
                                       intColonPos = InStr(objFolder.Title, ":")
    
    
    
                                       If intColonPos > 0 Then
    
                                          BrowseForFolder = Mid(objFolder.Title, intColonPos - 1, 2) & "\"
    
                                       End If
    
    
    
                                  Case Else
    
    
    
                           End Select
    
    
    
                           Err.Clear
    
    
    
                       Else
    
                           ' -- If we get this far make sure the folder exists
    
                           ' -- selecting a network folder may result in an invalid folder
    
                           If FSO.FolderExists(varTemp) Then BrowseForFolder = varTemp
    
                       End If
    
    
    
            End Select
    
       End If
    
    
    
       ' -- Check for an error of any kind
    
       If Err Then
    
          BrowseForFolder = vbNullString
    
          ShowString "Error selecting folder: " & Err.Description, vbExclamation, "BrowseForFolder"
    
          Err.Clear
    
          Exit Function
    
        End If
    
    
    
    ' -- Clean up
    
    Set objWshShell = Nothing
    
    Set objShell = Nothing
    
    Set objFolder = Nothing
    
    Set FSO = Nothing
    
    
    
    
    
    
    
    End Function
    
    
    
    
    
    '-------------------------------------------------------------------------------
    
    ' WriteFileText - Used to write an item to a file in a folder.
    
    ' Parameters:
    
    '   sFile - The file to read
    
    '
    
    ' Returns:
    
    '   A string containing the content of the file.
    
    '-------------------------------------------------------------------------------
    
    Function WriteFileText(sText)    'sFilepath --> path du fichier texte   sText---> path que je veux
    
       Dim objFSO 'As FileSystemObject
    
       Dim objTextFile 'As Object
    
    
    
       Const ForReading = 1
    
       Const ForWriting = 2
    
       Const ForAppending = 8
    
       Const sFilePath = "C:\test.txt"
    
    
    
       Set objFSO = CreateObject("Scripting.FileSystemObject")
    
       Set objTextFile = objFSO.CreateTextFile(sFilePath, True)
    
    
    
       ' Write a line.
    
       objTextFile.Write (sText)
    
    
    
       objTextFile.Close
    
       'objTextFile.Close
    
    
    
    End Function
    
    
    

  5. the problem I assume comes from the fact that your pretract block may be called from your ptlchg postblock. Therefore when you get into your phsmoff block, you are looking at the wrong value of the mi5. What you could do is to simply use an intermediate value like sav_mi5 or last_mi5 taht will save the mi5 value after each toolchange (at the end of the ptlchg block) and refer to this value in your phsmoff block.

     

    This shoudl do the trick inmy opinion.

     

    HTH

  6. You shouldn't have big issues using Mastercam to program a Mazak MSY type of lathe. Where people mostly complaints is about machines like Integrex or any multi-turret and multi-spindle and the difficulty for now in Mastercam to properly synchronize the work of both turret at the same time. But for a 4 axis lathe with a sub spindle spindle you should be able to do what you need with a Lathe level1 add-on and the proper post. You may start from mplmaster but it may need some modifcations to better suits the Matrix control.

     

    HTH

  7. The Wear comp does a mix of computer comp as the coordinates are already compensated for the tool radius by the software, but it also calls the G41/G42 command to be able to compensate for the tool wear (the difference between the tool radius programmed and the real tool radius). As Chris mentionned the reverse wear works the same way but for machine that doesn't accept negative offset.

     

    HTH

  8. The problems comes from the fact that the back and bottom tool plane have the X+ direction to the left as the TOP and front have the X+ direction to the right.

    To make sure you always have good coordinates and no error message you need to proceed like you did. Create yourself 2 new sets of plane by rotating the TOP plane by 90 and 180 to match the back and bottom plane and rogram off these.

    On a vertical Machine you shoud almost never have to use the bottom and back plane because when using the rotay axis you need to have the toolpane vectorof the rotary axis (in this case X) always oriented in the same direction to avoid errors.

     

    HTH

  9.  

    I have a question for everyone. What about when there is a rev change? Super easy to update in SW, but then you have to import in a new model into Mcam and redo all of your toolpaths? As it is now with a rev change I can just modify my geometry and regen.

     

     

    you can use the change recognition feature in Mastercam to make the change to an already program part who just had a revision on it. it will let you know what has changed between the 2 drawing and will allows you to see and change the toolpath that are going to be affected by the changes.

     

     

  10. I would recommend to use wear comp instead of control. You will get the same coordinate output as the computer comp but with the compensation code call as well so that you compensate on the control itself only for the tool wear instead of the complete diameter. This allows you to use smaller lead-in/out and generate a lot less compensation error related to arc radius.

     

    Note that you generally need to use a linear move (longer or equal to the value you will compensate for in the control) to let the machine take his compensation and avoid to call this G41/G42 code on an arc move.

  11. Hi

    If you want it to be done automatically inside the post look for this line to not have a pound sign (#) in front of it

    pwrtt$      # Write tool table, scans entire file, null tools are negative
              if rotaxis$ > 0 | rotary_type$ > 0 | mill5$ <> 0,
                [
                sav_rot_on_x = rot_on_x
                output_z = no$
                ]
              if vmc = 0 & tlplnno$ <> 2, sav_rot_on_x = rot_on_x
              if vmc = 1 & tlplnno$ > 1, sav_rot_on_x = rot_on_x
              sav_rot_on_x = rot_on_x    #Uncomment this line to output rotary axis value even when it's not used     <<<---------      
              t$ = wbuf(4,wc4)        #Buffers out tool number values
              if tool_table = 1, ptooltable
              if tool_table = 2, ppredtool
              if tool_table = 3, pmetatool
              if t$ >= zero, tcnt = tcnt + one
              ptravel
              pwritbuf5
    

     

    This should do the trick.

     

    HTH

  12. What's interesting with the numerical question prompts is that the default value showed into the prompt is the value the variable has been assigned to:

    So if you have 3 programmers working off their local computer, you can put the programmer variable initialized to the number 1, 2 or 3 and have it set localy for each user. This way when the question comes up, they would just need to press enter to confirm, but they still would be able to change on the spot the value if they are not currently working on their own computer.

    
    programmer : 1   #1=John,  2= Henry,  3=Mark
    
    

     

    HTH

  13. What you can do also is create a while condition in the pheader section that would keep asking the question as long as they don't enter a valid answer.

    something like this:

    while (programmer < 1 | programmer > 3),  #while the answer to the question is smaller than 1 or bigger than 3 it repeats the questions
     [
     q1
     ]
    
    

     

    HTH

  14. Hi John,

    I think it may be a post configuration issue.

    If you look inside the PST file and search for the following line:

    frc_cinit : yes$ #Force C axis reset at toolchange
    

    try changing its value to no$ so this way it won't reinitialize itself for the angle calculation at the toolchange. therfore getting rid of the unwanted 360 degres move.

     

    HTH

  15. Paul is right, doing this while posting is a pain, I had to do this once and it was not as easy as it looked like at the beginning!

     

    It was for tool life management along with a cell management system. Not only is it a pain to calculate it right, but to have it at the beginning of the NC it means that you need to output the G codes into a sub file while you calculate the time based on each moves and then at the end you need to bring everything back into the main NC file to have the time at the beginning instead of the end of the file. Also you need to find a way to store each tool time separatly and to add to each of them if the tool is re-used later in the program.

  16. The tooltable$ variable only indicates to the MP that you want it to read and the info into the pwrtt$ block, you need to have the tool table output logic built inside the post to take advantage of it. Like Gcode said, look into mplmaster to see where it's coming from.

     

    The pwrtt$ block is called to read or pre-process the NCI to allow you to store some info (like tool numbers, offset and name among others, ...) to force the MP.dll to get into this block you need to let it know by settings the tooltable$ variable to the proper value (in this case 3).

     

    HTH

  17. All the information that was into the post text file is now hold into the Control definition manager, mostly into the text section and into the machine cycle section for the drill cycle.

    These info can also be found at the complete end of your post.

    Look for a line that would start with

    [CTRL_MILL...

    or [CTRL_LATHE...

    or [CTRL_MT_LATHE... for a 3+ axis lathe post

    HTH

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