Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Macro to write Nc program with Fanuc output name?

johnc4668
Advocate

Macro to write Nc program with Fanuc output name?

johnc4668
Advocate
Advocate

I have a little time to play right now and I always wondered is there a way to create a macro button to write a nc program to a network drive folder ( in this case M:\ drive) and have it output in a way that fanuc likes it (O****). For example right now my nc programs are named 5307ET01 (the model name). The way it would need to be outputted would be O0701 ( the letter O plus the last two digits of the job number 07 plus the trode number 01. This may be too much to ask but any thoughts or help would be great, thanks!

 

2018-09-24_9-47-40.jpg

0 Likes
Reply
Accepted solutions (1)
623 Views
3 Replies
Replies (3)

rafael.sansao
Advisor
Advisor
Accepted solution

Something like:

STRING DRIVE_PATH = "D:\"
FOREACH nc IN FOLDER("NCPROGRAM") {
	STRING PATH = $DRIVE_PATH + "O" + SUBSTRING($nc.Name, 2, 2) + SUBSTRING($nc.Name, 6, 2)
	EDIT NCPROGRAM $nc.Name FILENAME $PATH
	KEEP NCPROGRAM $nc.Name
}

Rafael Sansão

OptiNC - www.optinc.tech

EESignature

johnc4668
Advocate
Advocate

@rafael.sansao awesome, worked great! Just had to change D to M:\ drive. Though sometimes he have electrodes with the same kind of name("5307ET01") but instead it's "5307CT01" (which stands for cover trode) Im not sure how to manage that issue yet???

0 Likes

rafael.sansao
Advisor
Advisor

Save to separate folders? Example:

M:\CT\....

M:\ET\....

Rafael Sansão

OptiNC - www.optinc.tech

EESignature