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

Macro Enumerate Tools, Recording Macro

1 REPLY 1
Reply
Message 1 of 2
Ibisu_nert
97 Views, 1 Reply

Macro Enumerate Tools, Recording Macro

Good evening I have a macro that executes a command that numbers the tools that would be this:

 

DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
STRING ARRAY A[] = {"Select all tools"}
INT C = "Select all tools"
if $c == 0 {
INT toolNumberMax = (100)
INT toolCount = 1
FOREACH tool IN FOLDER('tool') {
ACTIVATE TOOL $tool.Name
EDIT TOOL $tool.Name NUMBER COMMANDFROMUI $toolCount
$toolCount = $toolCount + 1
IF $toolCount == $toolNumberMax + 1 {
$toolCount = 1
}
}
}

DIALOGS MESSAGE ON
DIALOGS ERROR ON

 

But when I run it by recording a macro in PowerMachine, the executed macro becomes this code:

 

MACRO FILESELECTOR
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
STRING ARRAY A[] = {"Select all tools"}
INT C = "Select all tools"
INT toolNumberMax = (100)
INT toolCount = 1
ACTIVATE TOOL $tool.Name
EDIT TOOL $tool.Name NUMBER COMMANDFROMUI $toolCount
$toolCount = $toolCount + 1
ACTIVATE TOOL $tool.Name
EDIT TOOL $tool.Name NUMBER COMMANDFROMUI $toolCount
$toolCount = $toolCount + 1
ACTIVATE TOOL $tool.Name
EDIT TOOL $tool.Name NUMBER COMMANDFROMUI $toolCount
$toolCount = $toolCount + 1
ACTIVATE TOOL $tool.Name
EDIT TOOL $tool.Name NUMBER COMMANDFROMUI $toolCount
$toolCount = $toolCount + 1

DIALOGS MESSAGE ON
DIALOGS ERROR ON
TOOLBAR COMMANDBAR LOWER

 

HOW TO RUN THE FIRST MACRO SO THAT IT WORKS BY RECORDING OTHER MACROS

 

Sorry I'm Brazilian and I used a translator

1 REPLY 1
Message 2 of 2

I'm curious why do you need to run a macro by recording?

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

Post to forums  

Technology Administrators