Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Here is what I got so far. I wanted a way to change workplanes for every toolpath when I brought in a new workpiece. So far this works to switch from a workplane named "OLD" to a user input text for a different workplane. I also have it delete "OLD" workplane in the NCGLOBAL page and that works. The program I am having is getting the user input text to also change the output and model location workplane. I don't know how to enter the variable to make it automated.
Here is what I got:
//THE INTENTION OF THIS MACRO IS TO REPLACE THE WORKPLANE FOR ONLY THOSE TOOLPATHS
//USING WORKPLANE "OLD" WITH WORKPLANE NAMED BY USER INPUT PROMPT for "new workplane name"
//
//
string wpName = ""
string oldwpname = "OLD"
STRING $UserInputText= INPUT "new workplane name"
DEACTIVATE TOOLPATH
GRAPHICS LOCK
FOREACH tp IN folder('Toolpath') {
$wpName = $tp.workplane.name
IF $wpName == $oldwpname {
DEACTIVATE TOOLPATH
INVALIDATE TOOLPATH NOQUERY $tp.name
$tp.workplane = $UserInputText
ACTIVATE TOOLPATH $tp.Name
EDIT TOOLPATH $tp.Name REAPPLY
}
}
GRAPHICS UNLOCK
FORM NCGLOBAL
►►EDIT NCPROGRAM ALL MODELLOCATION ""◄◄ This is where I need help
►►EDIT NCPROGRAM ALL WORKPLANE ""◄◄ This is where I need help
NCGLOBAL APPLY
NCGLOBAL ACCEPT
DELETE WORKPLANE "OLD"
Solved! Go to Solution.