Announcements
Notice: Upload of PDF documents is currently unavailable across the Community due to an ongoing issue.

NEED HELP! Fixture offset for all toolpaths within nc program

NEED HELP! Fixture offset for all toolpaths within nc program

johnc4668
Advocate Advocate
1,225 Views
4 Replies
Message 1 of 5

NEED HELP! Fixture offset for all toolpaths within nc program

johnc4668
Advocate
Advocate

Macro noob here! I am trying to create a macro that creates an nc program for all toolpaths within the project and use a fixture offset to sink them in the z axis. I am having trouble finding a command to select all toolpaths in the nc program window. Any help would be great!

 

Heres my macro so far....

 

CREATE NCPROGRAM ; EDIT NCPROGRAM ; QUIT FORM NCTOOLPATH
RENAME NCPROGRAM "1" "SINK_TRODE-.025"
NCTOOLPATH ACCEPT FORM ACCEPT NCTOOLPATHLIST FORM ACCEPT NCTOOLLIST
EDIT NCPROGRAM ; APPEND TOOLPATH ALL
EDIT NCPROGRAM "SINK_TRODE-.025" QUIT FORM NCTOOLPATH
EDIT NCPROGRAM 'SINK_TRODE-.025' SELECT\r 1 SERIES      <<<<<< NEED A DIFFERENT COMMAND HERE TO SELECT ALL TOOLPATHS IN NCPRG
EDIT NCPROGRAM 'SINK_TRODE-.025' ITEM SELECTED COMPONENT SELECTED FIXTUREOFFSET "2"
EDIT NCPROGRAM "SINK_TRODE-.025" QUIT FORM NCTOOLPATH
ACTIVATE NCPROGRAM "SINK_TRODE-.025" KEEP NCPROGRAM ; YES
NCTOOLPATH CANCEL FORM ACCEPT NCTOOLPATHLIST FORM ACCEPT NCTOOLLIST

 

 

Accepted solutions (1)
1,226 Views
4 Replies
Replies (4)
Message 2 of 5

TK.421
Advisor
Advisor

this will pull all the names from the nc program that is active:

 

STRING ncProg = entity('ncprogram','').name
STRING LIST ncP_toolpaths = extract(entity('ncprogram', ncProg).nctoolpath, 'Name')

FOREACH tp IN ncP_toolpaths {
put your commands here
}

 

for more clarification, you can read this thread


the numbers never lie
0 Likes
Message 3 of 5

johnc4668
Advocate
Advocate

TK.421

 

Thanks for your help, Im almost there but its still not doing what i want to do yet. It is still only selecting 1 toolpath in the nc program window and not all of them. Heres my updated macro

 

CREATE NCPROGRAM ; EDIT NCPROGRAM ; QUIT FORM NCTOOLPATH
RENAME NCPROGRAM "1" "SINK_TRODE-.025"
NCTOOLPATH ACCEPT FORM ACCEPT NCTOOLPATHLIST FORM ACCEPT NCTOOLLIST
ACTIVATE NCPROGRAM "SINK_TRODE-.025"
EDIT NCPROGRAM ; APPEND TOOLPATH ALL
EDIT NCPROGRAM "SINK_TRODE-.025" QUIT FORM NCTOOLPATH
STRING ncProg = entity('ncprogram','').name
STRING LIST ncP_toolpaths = extract(entity('ncprogram', ncProg).nctoolpath, 'Name')

FOREACH tp IN ncP_toolpaths {
EDIT NCPROGRAM 'SINK_TRODE-.025' ITEM SELECTED COMPONENT SELECTED FIXTUREOFFSET "2"

}
EDIT NCPROGRAM "SINK_TRODE-.025" QUIT FORM NCTOOLPATH
ACTIVATE NCPROGRAM "SINK_TRODE-.025" KEEP NCPROGRAM ; YES
NCTOOLPATH CANCEL FORM ACCEPT NCTOOLPATHLIST FORM ACCEPT NCTOOLLIST

  

 

2018-02-26_13-07-29.jpg

0 Likes
Message 4 of 5

TK.421
Advisor
Advisor
Accepted solution

try this:

 

CREATE NCPROGRAM "SINK_TRODE-.025"
EDIT NCPROGRAM ; APPEND TOOLPATH ALL

 

INT item_num = 0

INT comp_num = 0
STRING ncProg = entity('ncprogram','').name
STRING LIST ncP_toolpaths = extract(entity('ncprogram', ncProg).nctoolpath, 'Name')

FOREACH tp IN ncP_toolpaths {
     IF !is_empty(components(entity('ncprogram',''))) {
          IF components(entity('ncprogram',''))[0].RootType == 'nctoolpath' {
               EDIT NCPROGRAM ; ITEM $item_num COMPONENT $comp_num FIXTUREOFFSET "1"
               }

          }

     $item_num = $item_num + 1

     $comp_num = $comp_num + 1000

}

ACTIVATE NCPROGRAM $ncProg KEEP NCPROGRAM ; YES

 

 

changing settings for toolpaths in an nc program is kind of goofy. try the above and see how that works - i think it should.  I also cleaned up some stuff that you dont need


the numbers never lie
Message 5 of 5

johnc4668
Advocate
Advocate

worked beautifully! cheers!

0 Likes