I have a toolpath inside a setup and Im looking for the pathname.
I am able to do this with a toolpath inside a toolpath folder, but I am not able to inside a setup.
Solved! Go to Solution.
Solved by john_lute. Go to Solution.
Solved by rafael.sansao. Go to Solution.
Thankyou for the suggestions, but that was not successful.
Here are some examples of my setup and toolpath folders.
In the command window when I type
Next is the toolpath folder example
Im looking for the location of the toolpath. The folder/setup name the toolpath is located in sets up my post options.
I'm not sure I understand what you need. This should help you:
STRING $tpName = "1"
IF NOT entity_exists(entity("Toolpath",$tpName)) {
MESSAGE WARN "Toolpath does not exist"
MACRO ABORT
}
STRING $folder = ""
FOREACH set IN FOLDER("Setup") {
FOREACH ent IN components($set) {
IF lcase(ent.RootType) == 'toolpath' {
IF $ent.Name == $tpName {
$folder = dirname(pathname('setup',$set.Name))
STRING $msg = "Setup pathname: " + $folder + CRLF + "Setup name: " + $set.Name + CRLF + "Toolpath name: " + $tpName
MESSAGE INFO $msg
BREAK
}
}
}
}
IF $folder == "" {
$folder = dirname(pathname('Toolpath',$tpName))
STRING $msg = "Toolpath pathname: " + $folder + CRLF + "Toolpath name: " + $tpName
MESSAGE INFO $msg
}
Rafael Sansão
Why you use the lowercase function in the if statement?
IF lcase(ent.RootType) == 'toolpath' {
is the root type in some cases different?
Thank you for you feedback, but that is not what I'm after.
When I have a toolpath selected using explore select, I need to know which folder the toolpath is located in. Here is the code that works when the toolpath is in a toolpath folder. When I place inside a Setup, the code does not work.
Try this:
EXPLORER SELECT TOOLPATH ROOT
Macro Pause "Select Desired Toolpaths"
IF is_empty(explorer_selected_entities()) {
Macro Pause "Make sure to select your toolpaths"
}
// Loops Through Toolpaths
FOREACH item_z IN explorer_selected_entities() {
ACTIVATE Toolpath $item_z
STRING $folder = ""
FOREACH set IN FOLDER("Setup") {
FOREACH ent IN components($set) {
IF lcase(ent.RootType) == 'toolpath' {
IF $ent.Name == $item_z.Name {
$folder = dirname(pathname('setup',$set.Name))
STRING $msg = "Setup pathname: " + $folder + CRLF + "Setup name: " + $set.Name + CRLF + "Toolpath name: " + $item_z.Name
MESSAGE INFO $msg
BREAK
}
}
}
}
IF $folder == "" {
$folder = dirname(pathname('Toolpath',$item_z.Name))
STRING $msg = "Toolpath pathname: " + $folder + CRLF + "Toolpath name: " + $item_z.Name
MESSAGE INFO $msg
}
}
@icse
I don't think so (maybe in older versions?). My memory is bad and I copied this excerpt from the manual 😃
Rafael Sansão
Thank you, I used a portion of your example to solve my problem.
When you shared your fix on this forum, what method did you use to show the work. Is it and attached Notepad++ Document, or another method.
Here is what I used, thanks again.
Can't find what you're looking for? Ask the community or share your knowledge.