VERICUT Users' Forum

Due to relentless spammers, we are no longer automatically accepting new forum registrations. If you wish to register for this forum, please send an e-mail to: info@cgtech.com

You are not logged in.

#1 2012-08-13 01:11:58

Verifun
Senior Member
From: U.S.
Registered: 2005-03-31
Posts: 351
Website

String parsing in Vericut

Hi folks,

Well, we're now having to deal with Mazaks and their tool registers, that are composed of the physical tool number followed by the offset number (This is one of the several possibilities in Mazatrol)

By the way: We're using the most recent Mazatrol e series from Vericut 7.1.6 library.

Well, it happens that we have our tool calls set-up like this:

T01.01 M6
...
T01.02 M6
...
T01.65 M6
...
T02.02 M6
...
T02.67 M6
...
T02.03 M6

Throught the T number register in the control we store the tool number in a variable, and each example above is stored in this variable like this when parsed:

01,01
01,02
01,65
02,02
02,67
02,03

The number at the left side of the comma is the Tool ID in the tool manager, and the trailing numbers are the driven point number, which is not implemented in my control to be treated like driven points - And that's what I want to do...

I want to add support for this, so I wonder if you guys could share some ideas about how I could store only the trailing values in a variable... what are the string manipulation functions or techniques I could use in my tool change sub-routine to do this?

For example, once we store the value 01,65 in the variable (This is already implemented), how can I store only the 65 value into another variable?

Look forward to hear from you,

Daniel


Daniel Santos

Offline

#2 2012-09-06 15:37:59

GavinP
VERICUT Specialist
From: UK
Registered: 2004-10-14
Posts: 58
Website

Re: String parsing in Vericut

Hi Daniel

We've done a few things to customise what is done with this type of format, this one rotates "spindle" A axis but could easily be adapted to just change driven points, possibly without the use of subroutine at all. Some of this is a bit out of date now, ChangeSubSystem would likely use ProcessCompNameValue etc.

Hopefully this will give you some ideas which will progress you.

Have fun,

Gavin

06-09-201216-32-08.jpg

(********** CGTech Vericut Toolchange Subroutine **********)
CGT_INSUB=1
IF [CGT_SPINDLE_TOOL EQ #4320] GOTO 99
(********** Out of normal machine limits**********)
(**********switching limit checking off**********)
CGTECH_MACRO "TurnOnOffTravelLimits" "" 0
G53 X700.
G53 Z0.
G53 Y-238.
CGTECH_MACRO "ChangeSubSystemID" "TC"
G53 X460.
CGTECH_MACRO "RestoreChangeSubSystemID" ""
G53 X-3.44
G53 Z-985.
(********** Reset A Before Change **********)
CGTECH_MACRO "AAxisMachineMotion" "" 0
CGTECH_MACRO "ProcessMotion" ""
CGT_CURRENT_OFFSET=0
M6
G4X5.
G53 Z0.
CGT_SPINDLE_TOOL = #4320
CGTECH_MACRO "ChangeSubSystemID" "TC"
G53 X0.
CGTECH_MACRO "RestoreChangeSubSystemID" ""
(**********switching limit checking back on**********)
CGTECH_MACRO "TurnOnOffTravelLimits" "" 1


N99
(**********Below Section Change Tool Orientation Only**********)
(**********Removed from Word Address**********)
IF [CGT_CURRENT_OFFSET EQ #3020] GOTO 999

IF [#3020 EQ 2] GOTO 2
IF [#3020 NE 1] GOTO 998
CGTECH_MACRO "AAxisMachineMotion" "" 0
CGTECH_MACRO "ProcessMotion" ""
GOTO 3
N2
CGTECH_MACRO "AAxisMachineMotion" "" 180
CGTECH_MACRO "ProcessMotion" ""
(**********Common Below**********)
N3
CGTECH_MACRO "ProcessMotion" ""
CGTECH_MACRO "GageOffsetDrivenPoint" ""
CGTECH_MACRO "ToolCutterComp" ""
#104120=0
CGT_CURRENT_OFFSET = #3020
GOTO 999
N998
CGTECH_MACRO "MessageMacro" "No Tool Orientation Set From Tool Code, Check NC Program" 2
N999
CGT_INSUB=0
M99

Offline

#3 2012-09-06 22:51:19

Verifun
Senior Member
From: U.S.
Registered: 2005-03-31
Posts: 351
Website

Re: String parsing in Vericut

Gavin,

Thank you very much... actually we got a very nice solution from CGTech to support this... I believe they made it the best way possible for now...

Of course the goal with this post was to apply this technique to this particular issue, but my originl intent was to really manipulate strings in Vericut... for general purposes, and not this one exclusively...

Anyway, thank you very much for chiming in - If you have more ideas, please let us know...

Tks
Daniel


Daniel Santos

Offline

#4 2012-12-20 19:23:30

Chigishev
Beta User
From: Moscow, RUSSIA
Registered: 2008-10-21
Posts: 51
Website

Re: String parsing in Vericut

If you need your own parser - use CME API. You can get a current NC-block as string, and - you can divide, find substring, more and more.
For example, when I try to simulate

FN 28: TABWRITE 5/"DIAM, RADIUS, LENGTH" = Q23  - I use CME API
big_smile

Offline

#5 2012-12-22 12:24:51

Chigishev
Beta User
From: Moscow, RUSSIA
Registered: 2008-10-21
Posts: 51
Website

Re: String parsing in Vericut

I want to show you my example.

1. I add to register "T" my own CME-macro VERICUT_FORUM_CME  - see pic1
2. I add my DLL to project see pic2
3. After T1.65M6 new variable TOOL_VAR will be created - see pic3
4. I add FileSummary - try it! (I cannot to upload filesummary , 256k filesize only, send me your e-mail and I will send you zip-file )

Yuri.

P/S/ = my exampe for x64 platform.

Offline

#6 2012-12-22 15:18:28

Chigishev
Beta User
From: Moscow, RUSSIA
Registered: 2008-10-21
Posts: 51
Website

Re: String parsing in Vericut

Or - I have uploaded DLL, you can add this DLL to your VERICUT project - use Configuration->Adv. Options... CME\API
Then add to register "T" new macro VERICUT_FORUM_CME and after it any values after dot (T1.65M6, T1.3.141591M6) will be assign  to variable TOOL_VAR

Mary Christmas!

Yuri
smile

Offline

#7 2012-12-22 17:31:58

Verifun
Senior Member
From: U.S.
Registered: 2005-03-31
Posts: 351
Website

Re: String parsing in Vericut

Yuri.

I could not thank you enough. That was a classy and helpful response: it opened a new world for me.

Thank you, very much!!!!

Daniel


Daniel Santos

Offline

#8 2012-12-22 18:07:18

Chigishev
Beta User
From: Moscow, RUSSIA
Registered: 2008-10-21
Posts: 51
Website

Re: String parsing in Vericut

Thank you! Happy New Year and Mary Chrismas!

My DLL - little present from Santa Klaus for you!

Offline

Board footer