Community
PowerMill Forum
Welcome to Autodesk’s PowerMill Forums. Share your knowledge, ask questions, and explore popular PowerMill topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Making my macro loop back to the top

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
jsweatherbie
741 Views, 5 Replies

Making my macro loop back to the top

I have a drop down menu that once selected it’ll make a drilling program but I need this to repeat cause of different sized drills and such . 
I’m not sure how to code it in powermill… is it a  forloop ,while do loop or bool loop???? 

To sum it up I just need it to go back to the top with a loop. 

Tags (2)
Labels (1)
5 REPLIES 5
Message 2 of 6
Sean570
in reply to: jsweatherbie

can you share what you have already? that will make it easier for people to help you out. But my guess is you'll want a while or foreach loop depending on how you have your macro setup

Message 3 of 6
jsweatherbie
in reply to: Sean570

//SHOWS YOU A LIST OF DRILLS

string list options={"0.531 GOLD","0.551 GOLD","0.656 GOLD","0.689 GOLD","0.812 GOLD","0.875 GOLD"}
int i = INPUT CHOICE $options "Choose your GOLD Drill?"

if $I == 0 {

FORM FEATURESELECT
MACRO PAUSE "SELECT A HOLE" + crlf

 

//531 GOLD DRILL

IMPORT TEMPLATE ENTITY TOOLPATH TMPLTSELECTORGUI "C:/Users/User/AppData/Local/Autodesk/PowerMill/My-Strategies/GOLD-DRILLS/531-G-DRILL.ptf"

RENAME TOOLPATH "1" ".531-G-DRILL"
EDIT TOOLPATH ".531-G-DRILL" CALCULATE
FORM ACCEPT SFDrilling

}
if $I == 1 {

//551 GOLD DRILL ( NEVER-USED )

 

}
if $I == 2 {

FORM FEATURESELECT
MACRO PAUSE "SELECT A HOLE" + crlf +"AND PRESS RESUME"

//656 GOLD DRILL

IMPORT TEMPLATE ENTITY TOOLPATH TMPLTSELECTORGUI "C:/Users/User/AppData/Local/Autodesk/PowerMill/My-Strategies/GOLD-DRILLS/656-G-DRILL.ptf"

RENAME TOOLPATH "1" ".656-G-DRILL"
EDIT TOOLPATH ".656-G-DRILL" CALCULATE
FORM ACCEPT SFDrilling

}
if $I == 3 {

//689 GOLD DRILL (NEVER-USED)


}
if $I == 4 {

FORM FEATURESELECT
MACRO PAUSE "SELECT A HOLE" + crlf +"AND PRESS RESUME"

//812 GOLD DRILL

IMPORT TEMPLATE ENTITY TOOLPATH TMPLTSELECTORGUI "C:/Users/User/AppData/Local/Autodesk/PowerMill/My-Strategies/GOLD-DRILLS/812-G-DRILL.ptf"

RENAME TOOLPATH "1" ".812-G-DRILL"
EDIT TOOLPATH ".812-G-DRILL" CALCULATE
FORM ACCEPT SFDrilling

}
if $I == 5 {

FORM FEATURESELECT
MACRO PAUSE "SELECT A HOLE" + crlf +"AND PRESS RESUME"

//875 GOLD DRILL

IMPORT TEMPLATE ENTITY TOOLPATH TMPLTSELECTORGUI "C:/Users/User/AppData/Local/Autodesk/PowerMill/My-Strategies/GOLD-DRILLS/875-G-DRILL.ptf"

RENAME TOOLPATH "1" ".875-G-DRILL"
EDIT TOOLPATH ".875-G-DRILL" CALCULATE
FORM ACCEPT SFDrilling
}

FEATURESELECT CANCEL

Message 4 of 6
Sean570
in reply to: jsweatherbie

I cleaned up the format a little to make it more readable, but you just needed to wrap it in a do-while loop. Let me know if that gets you close enough to what you want.

bool runAgain = false 
do {
//SHOWS YOU A LIST OF DRILLS
string list options={"0.531 GOLD","0.551 GOLD","0.656 GOLD","0.689 GOLD","0.812 GOLD","0.875 GOLD"}
int i = INPUT CHOICE $options "Choose your GOLD Drill?"

string tpName = $options[$i]

FORM FEATURESELECT
MACRO PAUSE "SELECT A HOLE" + crlf + "AND PRESS RESUME"

switch $i {
    case 0
        IMPORT TEMPLATE ENTITY TOOLPATH TMPLTSELECTORGUI "C:/Users/User/AppData/Local/Autodesk/PowerMill/My-Strategies/GOLD-DRILLS/531-G-DRILL.ptf"
        break
    case 1
        //551 GOLD DRILL ( NEVER-USED )
        break
    case 2
        IMPORT TEMPLATE ENTITY TOOLPATH TMPLTSELECTORGUI "C:/Users/User/AppData/Local/Autodesk/PowerMill/My-Strategies/GOLD-DRILLS/656-G-DRILL.ptf"
        break
    case 3
        //689 GOLD DRILL (NEVER-USED)
        break
    case 4
        IMPORT TEMPLATE ENTITY TOOLPATH TMPLTSELECTORGUI "C:/Users/User/AppData/Local/Autodesk/PowerMill/My-Strategies/GOLD-DRILLS/812-G-DRILL.ptf"
        break
    case 5
        IMPORT TEMPLATE ENTITY TOOLPATH TMPLTSELECTORGUI "C:/Users/User/AppData/Local/Autodesk/PowerMill/My-Strategies/GOLD-DRILLS/875-G-DRILL.ptf"
        break
}

RENAME TOOLPATH "1" $tpName
EDIT TOOLPATH $tpName CALCULATE
FORM ACCEPT SFDrilling
FEATURESELECT CANCEL

$runAgain = QUERY "Drill another hole?"
} while $runAgain == true
Message 5 of 6
jsweatherbie
in reply to: Sean570

I’ll check it out soon and thank you very much for condensing it cause I’m no macro programmer nor do I know the language it uses .
Message 6 of 6
jsweatherbie
in reply to: Sean570

this runs beautifully thanks for your help im very greatful!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report