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:

File descriptor


Recommended Posts

Hello everyone,

   I'm trying to output the date of the MasterCam created by using FILE DESCRIPTOR info such as:

 

Created: 4/15/15 08:37AM

Modified: 4/15/15 08:37AM ===== it will show different time and date if we hit save for the next time

 

Then....

   I want to try to output DESCRIPTOR comments of which contains in the white window.

 

I looked that it is the line as:

 

      if sof & gcode$ = 1054, scomm_fx_arg = scomm$, pcomment_out  #File Descriptor

 

I try to output as this line but not succeeded, can you guys point out what I did wrong?

 

 

 

# --------------------------------------------------------------------------
#String and string selector definitions for NC output
# --------------------------------------------------------------------------
scomm_fx_arg     : ""    #Comment temp string (always set 'scomm_fx_arg' before calling pcomment_out)
 
 
pcomment_out #Check comment length, truncate/shorten if necessary
      comm_len = strlen(scomm_str + scomm_end) #Get length of comment begin and end strings
      if comment_mode < two,
        [
        scomm_out = comment_fx(maxnccomment$ - comm_len, scomm_fx_arg, comment_mode)
        scomm_str, no_spc$, scomm_out, no_spc$, scomm_end, e$ #Output truncated comment
        ]
      else, #Break comment into multiple lines of output. Must set 'max nc comment' length in CD to 256, so MP won't truncate the string
        [
         #Search 'scomm_fx_arg' for break character
        str_brk = no$ #Set breaking to zero
        if smatch <> sblank, str_brk = strstr(smatch, scomm_fx_arg)
        if str_brk, #the break character is present.
          [
          #Use this block to parse scomm_fx_arg into separate strings to output
          #The next line outputs a blank line to the NC code file, and the line after is the horizontal seperator
          
          #These IF statements set the 'scomm_type' to report on the type of comment being broken.
          # This is mostly for debugging purposes, to tell you the programmer which comment type is being broken.
          # Even if you remove the message output below with a pound sign, le          
          if gcode$ = 1005, scomm_type = "MANUAL ENTRY COMMENT"
          #if gcode$ = 1008, scomm_type = "OPERATION COMMENT"
          if gcode$ = 1051, scomm_type = "MACHINE NAME COMMENT"
          if gcode$ = 1052, scomm_type = "MACHINE GROUP COMMENT"
          if gcode$ = 1053, scomm_type = "GROUP NAME COMMENT"
          if gcode$ = 1054, scomm_type = "FILE DESCRIPTOR COMMENT"
       
          #The next two lines are just a message. Add a pound sign (#) in front of the lines to remove
          #scomm_str, no_spc$, "STRING BREAKING CHARACTER DETECTED IN A", scomm_type, no_spc$, scomm_end, e$
          #scomm_str, no_spc$, "YOUR COMMENTS HAVE BEEN BROKEN AT THE", smatch, "CHARACTER", no_spc$, scomm_end, e$
          
          #The next line converts all comments to uppercase characters
          scomm_fx_arg = (scomm_fx_arg)
          
          #The following 'while' loop breaks the comment into multiple strings, using the 'smatch' character.
          #The default 'smatch' character is the tilde (~), but you can edit the 'smatch' variable definition,
          #  if you wish to change the character used to break the string. For example, replace the "~" with "|" to use the pipe symbol.
          scomm_out = scomm_fx_arg #assign string to scomm_out
          while str_brk > zero,
            [
            stemp1 = brksps(str_brk, scomm_out) #Break string at specified position
            scomm_str, no_spc$, scomm_out, no_spc$, scomm_end, e$ #Output broken comment
            stemp2 = brksps(two, stemp1) #Remove 'smatch' character from front of string
            scomm_out = stemp2 #Set 'scomm_out' back to stemp1, so that it can be broken again
            str_brk = strstr(smatch, scomm_out)
            str_len = strlen(scomm_out)
            if str_brk = zero & str_len > zero, scomm_str, no_spc$, scomm_out, no_spc$, scomm_end, e$ #Output broken comment
            ]
            
          #These two lines output a horizontal separator, then a blank line to the NC file
          scomm_str, no_spc$, shoriz, no_spc$, scomm_end, e$
          ]
        else, #This code reads the string, and breaks using a string length parameter
          [
          comm_brk_len = comm_brk_len - comm_len #subtract comment begin/end strings
          str_len = strlen(scomm_fx_arg) #Get length of comment string
          str_brk = int(str_len / comm_brk_len) #Get number of broken output strings
          if frac(str_len / comm_brk_len), str_brk = str_brk + one #Add one more output if not even division
          scomm_out = scomm_fx_arg #assign string to scomm_out
          while str_brk > zero, #Output broken comments
            [
            stemp1 = brksps(comm_brk_len, scomm_out) #Break string at specified position
            scomm_str, no_spc$, scomm_out, no_spc$, scomm_end, e$ #Output broken comment
            scomm_out = stemp1 #Set 'scomm_out' back to stemp1, so it can be broken again in while loop
            str_brk = str_brk - one #Decrement counter
            ]
          ]
          
        ]
        scomm_out = sblank #Reset scomm_out
 
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...