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: 

Macro to create a pattern with text pulled from the toolpath folder name

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
john_lute
485 Views, 3 Replies

Macro to create a pattern with text pulled from the toolpath folder name

My folder name looks like this  

437172-P13_S2_ej,EJ_BACKWORK_2~H4~Aluminum_6061~437172_DT02_EJECTOR_CAVITY~

 

The first 6 digits are the shop order number.

I am able to create a string that includes the shop order number.

What I want to do now is import that string into a pattern so that I can create a pattern toolpath for engraving.

My code errors when use a variable.

 

My code:
// active folder
string activefolder = active_folder()

// Splits up folder name
string LIST Tokens = tokens($activefolder,'-')

// Pulls specific value from name and places into variable
string MSR = replace($tokens[0],"Toolpath","")

// Sets up Pattern name
string engrave = new_entity_name('Pattern')

// Defines the next toolpath name for pattern finishing
string patternpath = new_entity_name ('Toolpath')

// Create pattern
CREATE PATTERN ;

// Edit pattern
EDIT PATTERN $engrave CURVEEDITOR START
CURVEEDITOR MODE TEXT_HORIZONTAL

// Edit font size
CURVEEDITOR TEXT FONT_SIZE ".125"

// Variable is built to in include the desired number
//string text = '"\V{1}\F{Tahoma;TT}\C{ffffffff}\H{0.125}\S{0}\B{0}\I{0}\U{0}' + $MSR + '"'

// Variable is set for the exact text
string text = "\V{1}\F{Tahoma;TT}\C{ffffffff}\H{0.125}\S{0}\B{0}\I{0}\U{0}437171"

// Prompt to select engraving location
Macro Pause "select Location"


// When I use this line in the macro it works, it is flagged out for testing
//CURVEEDITOR TEXT SET_TEXT "\V{1}\F{Tahoma;TT}\C{ffffffff}\H{0.125}\S{0}\B{0}\I{0}\U{0}437171"

// When I attemtp to use a variable, it does not.
CURVEEDITOR TEXT SET_TEXT $text

CURVEEDITOR FINISH ACCEPT

Labels (3)
3 REPLIES 3
Message 2 of 4
TK.421
in reply to: john_lute

try it using DOCOMMAND:


STRING text = "'\V{1}\F{Tahoma;TT}\C{ffffffff}\H{0.125}\S{0}\B{0}\I{0}\U{0}437171  " + $MSR + "'"
STRING $myCommand = 'CURVEEDITOR TEXT SET_TEXT ' + $text
DOCOMMAND $myCommand

CURVEEDITOR FINISH ACCEPT
--------------------------------------
the numbers never lie
Message 3 of 4
john_lute
in reply to: TK.421

I was thinking about that command, but I wasn't sure if that worked in this case, but it worked, thanks for you help. Why do you define your variables using the dollar sign, just curious.

Message 4 of 4
TK.421
in reply to: john_lute

normally i dont. that piece of code was copied and pasted years ago from an old post when i was learning how to do that. some people do that some dont

--------------------------------------
the numbers never lie

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report