One of my macros doesn't work any more. Is there some one that can help me?

One of my macros doesn't work any more. Is there some one that can help me?

benettitec01
Enthusiast Enthusiast
606 Views
3 Replies
Message 1 of 4

One of my macros doesn't work any more. Is there some one that can help me?

benettitec01
Enthusiast
Enthusiast

A macro to changes tools automatically from one machine to another machine.

example: machine A (called VTR) tools, were changed with machine B (called ZEPHYR) tools one by one.

 

Now it doesn't work.

it starts the calculation queue instead of queuing the tool changing.

I don't know how to do.

 

Is there anybody that can recognize the cause please? I really don't understand why it was working and now no more.

 

 

thanks in advance to everyone for helping

 

here is the my macro with the only first couple of tools. It contains both the tools of two machines among which, if present, the tools will be replaced

 

here is the first part of the macro:

 

 

 

 

DIALOGS MESSAGE ON
DIALOGS ERROR ON

Function Main() {
ECHO OFF DCPDEBUG UNTRACE COMMAND ACCEPT

STRING $FolderName = active_folder()

IF $FolderName == '' {

} else {

STRING LIST $Split = {}
$Split = TOKENS($FolderName, "\")
IF $Split[0] != "Toolpath" {
MACRO PAUSE "vuoi attivare una cartella ?"
}
}

$FolderName = active_folder()
if $FolderName == '' {
$FolderName = "Toolpath"
}
//
FOREACH $tp IN FOLDER($FolderName) {


IF $tp.tool.name == "42R1_VTR" {

ACTIVATE TOOLPATH $tp.Name

EDIT TOOLPATH ; RECYCLE
ACTIVATE TOOL "42R1_ZEPHYR"
EDIT TOOLPATH ; QUEUE

}
IF $tp.tool.name == "12R1_VTR" {

ACTIVATE TOOLPATH $tp.Name

EDIT TOOLPATH ; RECYCLE
ACTIVATE TOOL "12R1_ZEPHYR"
EDIT TOOLPATH ; QUEUE

}
IF $tp.tool.name == "63R0_VTR" {

ACTIVATE TOOLPATH $tp.Name

EDIT TOOLPATH ; RECYCLE
ACTIVATE TOOL "63R0_ZEPHYR"
EDIT TOOLPATH ; QUEUE

}

}


DIALOGS MESSAGE ON
DIALOGS ERROR ON

 

0 Likes
607 Views
3 Replies
Replies (3)
Message 2 of 4

jarryd_barrJ32M9
Explorer
Explorer

Try replacing all the IF statements with this loop

FOREACH tp IN FOLDER($Folder) {

    ACTIVATE TOOLPATH $tp.name

    STRING LIST toolCheck = TOKENS($tool.name, "_")

    IF $toolCheck[1] == "VTR" {

        STRING newName = $toolCheck[0] + "_ZEPHYR"

        EDIT TOOLPATH ; RECYCLE
        ACTIVATE TOOL $newName
        EDIT TOOLPATH; QUEUE
        
    }
}
0 Likes
Message 3 of 4

benettitec01
Enthusiast
Enthusiast

I am sorry, I tried but don't understand.

And it gives me the following message in image 3.png

I am ugly in pyton language

anycase I say you

best week

greetings

danny

 

0 Likes
Message 4 of 4

jarryd_barrJ32M9
Explorer
Explorer

Replace the $Folder with either $FolderName or the actual name of the folder.

The script was just a placeholder example of how to loop through it all instead of using an IF statement for every tool instance.

0 Likes