Need Help with rearranging toolpaths in the NCProgram

Need Help with rearranging toolpaths in the NCProgram

Anonymous
Not applicable
988 Views
12 Replies
Message 1 of 13

Need Help with rearranging toolpaths in the NCProgram

Anonymous
Not applicable

Hello Guys,

I would really appreciate it, if someone could help me rearrange the toolpaths in the ncprogram, so Rough_1, Rough_2, Rough_3, Finishing 1, 2, and 3 would come after my duplicate toolpath: Rough_3_1.   This is what I have so far:

 

EDIT TOOLPATH "Rough_3" CLONE

ACTIVATE NCPROGRAM

EDIT NCPROGRAM; INSERT TOOLPATH Rough_3_1 AFTER ITEM 1

EDIT NCPROGRAM; ORDER ITEM 2 AFTER ITEM 9

 

So basically the above code is inserting my duplicate toolpaths after SemiRough and then my plan is to have the rest of roughing and finishing toolpaths inserted afterwards. I know that the item number will vary according to the amount of toolpaths in the ncprogram. How can i get the item numbers and then order them after my clone toolpath Rough_3_1. Thank you in advance. 

0 Likes
Accepted solutions (1)
989 Views
12 Replies
Replies (12)
Message 2 of 13

awagner4M2AR
Contributor
Contributor

 

Have you tried using a count to rename the toolpaths?  Something like this...

 

 

INT $COUNT = 1
STRING $TPNM = ""
STRING $NEWNM = ""

DEACTIVATE TOOLPATH
CREATE NCPROGRAM ;

FOREACH $T IN FOLDER('Toolpath') {
ACTIVATE TOOLPATH $T
EDIT TOOLPATH ; CLONE
$TPNM = $Toolpath.Name
$NEWNM = $TPNM + "_" + $COUNT
RENAME Toolpath # $NEWNM
$COUNT = $COUNT + 1
}

0 Likes
Message 3 of 13

Anonymous
Not applicable

Thank you. but I tried your method and I am actually looking to put particular toolpaths which are already in the existing ncprogram and changing their order. I don't want to create a new ncprogram. I just want to get the item number of the toolpaths and then change their order. 

0 Likes
Message 4 of 13

urizenYHS3W
Advocate
Advocate

Instead of AFTER ITEM 1 try using AFTER TOOLPATH 'blah'

 

0 Likes
Message 5 of 13

Anonymous
Not applicable

Actually I tried  inputing the toolpath name AFTER  TOOLPATH, but powermill gave me unsupported feature and command. 

0 Likes
Message 6 of 13

urizenYHS3W
Advocate
Advocate

AFTER TOOLPATH should work. What is the full command are you issuing? And what is the exact error you get?

 

0 Likes
Message 7 of 13

Anonymous
Not applicable

Now for some reason Im unable to activate ncprogram. This is the error, I get: ERROR_20180829072526.876_X.jpg

0 Likes
Message 8 of 13

Anonymous
Not applicable

How can I activate the current ncprogram without powermil giving me that error. 

0 Likes
Message 9 of 13

awagner4M2AR
Contributor
Contributor
Accepted solution

There's this way that activates the first program in the NCprograms folder.  

 

STRING $NCNM = (FOLDER('NCProgram')[0]).Name 

ACTIVATE NCProgram $NCNM

 

Or, this activates the most recently created NCProgram

 

ACTIVATE NCProgram #

0 Likes
Message 10 of 13

Anonymous
Not applicable
Thank you. I am going to try your suggestion, once i arrive to my office.
0 Likes
Message 11 of 13

Anonymous
Not applicable

Yes. Thank you so much. It activated the ncprogram. 

0 Likes
Message 12 of 13

Anonymous
Not applicable

Yes, so adding the toolpath name after the command AFTER TOOLPATH, I was able to rearrange toolpaths in the NCProgram. method does work, I guess not activating the current ncprogram was the real issue.  Thank you. 

0 Likes
Message 13 of 13

Anonymous
Not applicable

There seem to be another issue with this macro. I can't seem to order the Rough_3_1 clone toolpath AFTER TOOLPATH Rough_2. Down below is my current order:

 

STRING $NCNM = (FOLDER('NCProgram')[0]).Name

ACTIVATE NCProgram $NCNM

EDIT NCPROGRAM; INSERT Toolpath 3_2_ax_Finishing_3 AFTER TOOLPATH 3_2_ax_Finishing_2 

EDIT NCPROGRAM; INSERT Toolpath 3_2_ax_Finishing_2 AFTER TOOLPATH 3_2_ax_Finishing_1

EDIT NCPROGRAM; INSERT Toolpath 3_2_ax_Finishing_3 AFTER TOOLPATH 3_2_ax_Roughing_3

EDIT NCPROGRAM; INSERT Toolpath 3_2_ax_Roughing_3 AFTER TOOLPATH 3_2_ax_Roughing_2 

EDIT NCPROGRAM; INSERT Toolpath 3_2_ax_Roughing_2 AFTER TOOLPATH 3_2_ax_Roughing_1 

EDIT NCPROGRAM; INSERT Toolpath 3_2_ax_Roughing_1 AFTER TOOLPATH 3_2_ax_Rough_3_1

// Then here below is where the order messes up

EDIT NCPROGRAM; INSERT Toolpath Rough_3_1 AFTER TOOLPATH Rough_2  

// Instead of putting Rough_3_1 after Rough_2, the macro puts it before Rough_2. Any help would be deeply appreciate. Thank you. 

0 Likes