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:

Post Questions (V9)


Recommended Posts

Are there any functions in MP to parse strings? i.e. Instr(), Mid(), Replace() etc.

 

Is there a way to count ALL operations during posting the current MC9 file, even if some ops are set NOT to post?

 

Also, I see things like

 

fexist(sfilename2)

and

remove(sfilename2)

and

ex

 

I can guess what they're for (well, cept for EX), but are there more? Are they listed in my (extremely old) Post book that I haven't unpacked since the move?

 

 

Thanks!

Link to comment
Share on other sites

I'd contact you dealer about getting a v9 post proc cd. (Searchable pdfs, yeah) They're probably giving them away now that X is out.

 

As for parsing you could probably fake it with:

strstr -> is basically instring.

brksps -> will break a string into two strings at a position.

 

Bryan smile.gif

Link to comment
Share on other sites

Thanks Bryan. Took me a few tries to get the syntax right, but it's working now.

 

code:

	spathnc = brksps(strstr(sncf, spathnc), spathnc)

cheers.gif

 

Is there anything close to instrrev() ??

 

Any other tidbits? Or are they listed in the CD?

 

[ 04-22-2006, 01:12 PM: Message edited by: Rekd ]

Link to comment
Share on other sites

There is not direct "replace that with this", but you can do it in a multi-step process using the MP string formulas; strstr and brksps

 

The code example below shows the addition of the pfixpath postblock (into the MPFAN.PST) which removes ‘soldstring’ from the ‘soriginalpath’ and replaces it with ‘snewstring’.

 

Resulting in this output ---

--------------

soriginalpath -> C:MCAMXCUSTOMERSNC FILESJob-680T.NC

--------------

snewpath -> C:MCAMXCUSTOMERSSETUP SHEETSJob-680T.NC

--------------

 

code:

soriginalpath  "C:MCAMXCUSTOMERSNC FILESJob-680T.NC"

snewpath ""

srepstring "SETUP SHEETS"

soldstring "NC FILES"

stempstr1 ""

stempstr2 ""

indexpos : 0

 

pfixpath

indexpos = strstr(soldstring, soriginalpath)

if indexpos <> 0,

[

# First part of string is now in ‘soriginalpath’

stempstr1 = brksps(indexpos, soriginalpath)

# Second part of string is now in ‘stempstr2’

stempstr2 = brksps(strlen(soldstring)+1, stempstr1)

# Stich ‘em all together

snewpath = soriginalpath + srepstring

snewpath = snewpath + stempstr2

]

 

 

psof$ #Start of file for non-zero tool number

 

"--------------", e$

"soriginalpath -> ", ~soriginalpath, e$

pfixpath

"--------------", e$

"snewpath -> ", snewpath, e$

"--------------", e$

Ah... I see you wanted this for v9

Just remove all the '$' (dollar signs) and it should work for v9.

Link to comment
Share on other sites

Roger, using

 

code:

pfixpath

indexpos = strstr(soldstring, soriginalpath)

if indexpos <> 0,

[

# First part of string is now in ‘soriginalpath’

stempstr1 = brksps(indexpos, soriginalpath)

# Second part of string is now in ‘stempstr2’

stempstr2 = brksps(strlen(soldstring)+1, stempstr1)

# Stich ‘em all together

snewpath = soriginalpath + srepstring

snewpath = snewpath + stempstr2

]

Gives me this error...

 

"Variable not defined: if"

 

(it's on the "if indexpos <> 0" line)

 

confused.gif

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