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:

Character counts


Recommended Posts

Hello everyone,
    I have about couple hundred programs which contains LOOOOONG notes, is there away that I can make the post auto split the OPERATION COMMENTS into 2 or three lines so it won't get alarmed on the control?  As you guys already know, LOOOOONG operation note can cause the control alarm.   Does MasterCam2019 have that feature for me to add it in the post? 



Please help,
   Big thanks....


======================================
N1( .6250, 5/8 SPOTTER, HSS, 90.DEGS,)
(2FLTS .313LOC, .50STO)
G0 G17 G40 G49 G80 G90
G91 G28 Z0 M19
/G28 Y0.
T1 M6(SPOT 4X DOWEL PINS FOR STOCK LINE UP, ENSURE THESE HOLES ARE WITHIN .0002, CUT#1) ====================================>  NOTE IS TOO LONG.... and it should be...
T1 M6(SPOT 4X DOWEL PINS FOR STOCK LINE UP)   ====================================>  and it should be...
(, ENSURE THESE HOLES ARE WITHIN .0002, CUT#1) ====================================>  and it should be...

G90 G54 S4500 M3
X6.75 Y6.625 T2(NEXT TOOL)
G43 H1 Z1.(DOC= Z-.125)
M8 Z.125
(4X SPOTS, .25'CSINK SIZE)
G99 G81 Z-.125 R.125 F10.
Y-6.375
X6.25 Y-7.125
X1.75
G80 Z1.

Link to comment
Share on other sites

The Generic Haas 4X Mill Post has some logic I added to either shorten or truncate long comments. You could use that logic as a "base", and modify it to split the comments into multiple lines. The "trick" would be figuring out where to break the comment, so it breaks properly on a "space" character, and not in the middle of a "word".

  • Thanks 1
  • Like 1
Link to comment
Share on other sites
  • 7 months later...

Is there logic built in to look through a string and be able to truncate the string when it encounters a certain character? I see you wrote "trick". Not sure if that is an indication it isn't easily done?

We have a machine that requires a line at the beginning that has 16 characters max. I would like to extract part of the part number and the entire revision and operation. 

 

For example:

NC file name: 980-1000001258-56286_A_OP1.NC

would like the line at the beginning of the program to show: 980-100000_A_OP1

 

Link to comment
Share on other sites
23 minutes ago, cncgotoguy said:

Is there logic built in to look through a string and be able to truncate the string when it encounters a certain character? I see you wrote "trick". Not sure if that is an indication it isn't easily done?

We have a machine that requires a line at the beginning that has 16 characters max. I would like to extract part of the part number and the entire revision and operation. 

 

For example:

NC file name: 980-1000001258-56286_A_OP1.NC

would like the line at the beginning of the program to show: 980-100000_A_OP1 

 

I may be misunderstanding, but it appears from your example that you just want the first 16 characters of the string.

 

If you're using Mastercam 2019 you can use a regex to only grab up to the first 16 characters in a string, below is a simple example

^.{1,16}

 

Prior to 2019 you cancheck the length of the stringwith the strlen function.  If the string is less than 16 characters do nothing, if it's greater than 16, use the  brksps function to break the string 16 places in.

Link to comment
Share on other sites

Thanks Jeff,

I actually want to get a certain number of characters in the beginning and then capture the revision and the operation.

I was going to set a specific way (fixed character length) to name the operation number and revision, so there would be a left over number of characters for the PN.

I would need it to go to the first underscore and grab the characters after up until the next underscore and save that as the revision, then grab the characters after the next underscore and store it as the operation. 

Link to comment
Share on other sites

A minimally tested post block using regular expressions below.  Keep in mind that the regex function is only in Mastercam 2019 and beyond

sinput : "980-1000001258-56286_A_OP1.nc"
sregex : "^(.{0,16}).*?_(.*?)_(.*?)\."

spart_number : ""
srevision    : ""
soperation   : ""

pparse_string
      spart_number = regex(sregex, sinput, 10)
      srevision = regex(sregex, sinput, 20)
      soperation = regex(sregex, sinput, 30)

      "The first 16 characters of the part number is:", e$
      "  ", "->", spart_number, e$
      *e$

      "The revision is:", e$
      "  ", "->", srevision, e$
      *e$

      "The operation number is:", e$
      "  ", "->", soperation, e$
  
 //Output:
 //  The first 16 characters of the part number is:
 //    -> 980-1000001258-5
 //
 //  The revision is:
 //    -> A
 //
 //  The operation number is:
 //    -> OP1

 

  • Thanks 2
  • Like 2
Link to comment
Share on other sites
On 4/29/2019 at 5:43 AM, jeff.D said:

A minimally tested post block using regular expressions below.  Keep in mind that the regex function is only in Mastercam 2019 and beyond


sinput : "980-1000001258-56286_A_OP1.nc"
sregex : "^(.{0,16}).*?_(.*?)_(.*?)\."

spart_number : ""
srevision    : ""
soperation   : ""

pparse_string
      spart_number = regex(sregex, sinput, 10)
      srevision = regex(sregex, sinput, 20)
      soperation = regex(sregex, sinput, 30)

      "The first 16 characters of the part number is:", e$
      "  ", "->", spart_number, e$
      *e$

      "The revision is:", e$
      "  ", "->", srevision, e$
      *e$

      "The operation number is:", e$
      "  ", "->", soperation, e$
  
 //Output:
 //  The first 16 characters of the part number is:
 //    -> 980-1000001258-5
 //
 //  The revision is:
 //    -> A
 //
 //  The operation number is:
 //    -> OP1

 

 

 

This is great valuable info.  Thank you Jeff.D

Link to comment
Share on other sites
On 4/29/2019 at 5:43 AM, jeff.D said:

A minimally tested post block using regular expressions below.  Keep in mind that the regex function is only in Mastercam 2019 and beyond


sinput : "980-1000001258-56286_A_OP1.nc"
sregex : "^(.{0,16}).*?_(.*?)_(.*?)\."

spart_number : ""
srevision    : ""
soperation   : ""

pparse_string
      spart_number = regex(sregex, sinput, 10)
      srevision = regex(sregex, sinput, 20)
      soperation = regex(sregex, sinput, 30)

      "The first 16 characters of the part number is:", e$
      "  ", "->", spart_number, e$
      *e$

      "The revision is:", e$
      "  ", "->", srevision, e$
      *e$

      "The operation number is:", e$
      "  ", "->", soperation, e$
  
 //Output:
 //  The first 16 characters of the part number is:
 //    -> 980-1000001258-5
 //
 //  The revision is:
 //    -> A
 //
 //  The operation number is:
 //    -> OP1

 

How did you define "regex"????

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