Community
HELLO EVERYONE
I WOULD LIKE TO ADD A CONDITION TO MY MACRO 'CHECK_COLLISION'(SEE ATTACHMENT)
AND I DON'T KNOW HOW TO DO IT SO I WILL NEED YOUR HELP.
HERE IS THE CONDITION.
I WOULD LIKE, IF A COLLISION IS DETECTED, THAT THE PROBLEMATIC TOOLPATH BE RENAMMED
'TOOLPATH NAME + _COLLISION' WITHOUT THE MACRO BEING STOPPED.
THANK YOU FOR YOUR HELP AND TIME. IT IS REALLY APPRECIATED!
try this:
FOREACH tp IN folder('Toolpath') {
IF NOT tp.Computed {
ACTIVATE TOOLPATH $tp.Name
EDIT TOOLPATH $tp.Name CALCULATE
}
}
FOREACH tp IN folder('Toolpath') {
ACTIVATE TOOLPATH $tp.Name
ACTIVATE StockModel "P#01 - STM_Blank milling_1"
EDIT COLLISION TYPE COLLISION
EDIT COLLISION STOCKMODEL_CHECK Y
EDIT COLLISION STOCKMODEL "P#01 - STM_Blank milling"
EDIT COLLISION SCOPE ALL
EDIT COLLISION SPLIT_TOOLPATH N
EDIT COLLISION MISS_OUTPUT N
EDIT PAR 'Verification.UseVerificationThickness' 0
EDIT COLLISION HEAD_CLEARANCE "600.0"
EDIT COLLISION HOLDER_CLEARANCE "1.0"
EDIT COLLISION SHANK_CLEARANCE "0.3"
EDIT COLLISION DEPTH Y
EDIT COLLISION ADJUST_TOOL N
UNDRAW COLLISION
EDIT COLLISION APPLY
EDIT STOCKMODEL ; INSERT_INPUT TOOLPATH $tp.Name LAST
EDIT STOCKMODEL "P#01 - STM_Blank milling_1" CALCULATE
if Safety.Holder.Cutting.Status == 'collides' or Safety.Holder.Leads.Status == 'collides' or Safety.Holder.Links.Status == 'collides' or Safety.Tool.Cutting.Status == 'collides' or Safety.Tool.Leads.Status == 'collides' or Safety.Tool.Links.Status == 'collides' {
string $newName = $tp.Name + "_COLLISION"
if entity_exists('toolpath',$newName) {
$newName = new_entity_name('toolpath',$newName)
}
RENAME Toolpath ; ${newName}
}
}
DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK
did not tested it...
this should work
FOREACH tp IN folder('Toolpath') {
IF NOT tp.Computed {
ACTIVATE TOOLPATH $tp.Name
EDIT TOOLPATH $tp.Name CALCULATE
}
}
FOREACH tp IN folder('Toolpath') {
ACTIVATE TOOLPATH $tp.Name
ACTIVATE StockModel "P#01 - STM_Blank milling_1"
EDIT COLLISION TYPE COLLISION
EDIT COLLISION STOCKMODEL_CHECK Y
EDIT COLLISION STOCKMODEL "P#01 - STM_Blank milling"
EDIT COLLISION SCOPE ALL
EDIT COLLISION SPLIT_TOOLPATH N
EDIT COLLISION MISS_OUTPUT N
EDIT PAR 'Verification.UseVerificationThickness' 0
EDIT COLLISION HEAD_CLEARANCE "600.0"
EDIT COLLISION HOLDER_CLEARANCE "1.0"
EDIT COLLISION SHANK_CLEARANCE "0.3"
EDIT COLLISION DEPTH Y
EDIT COLLISION ADJUST_TOOL N
UNDRAW COLLISION
EDIT COLLISION APPLY
EDIT STOCKMODEL ; INSERT_INPUT TOOLPATH $tp.Name LAST
EDIT STOCKMODEL "P#01 - STM_Blank milling_1" CALCULATE
if $tp.Safety.Holder.Cutting.Status == 'collides' or $tp.Safety.Holder.Leads.Status == 'collides' or $tp.Safety.Holder.Links.Status == 'collides' or $tp.Safety.Tool.Cutting.Status == 'collides' or $tp.Safety.Tool.Leads.Status == 'collides' or $tp.Safety.Tool.Links.Status == 'collides' {
string $newName = $tp.Name + "_COLLISION"
if entity_exists('toolpath',$newName) {
$newName = new_entity_name('toolpath',$newName)
}
RENAME Toolpath ${tp.Name} ${newName}
}
}
DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK
Can you explain the problem a bit more.
Does the macro stop at a certain point?
I just tested the renaming part ive added.
For me the code of my last post works fine...
here with all collision checking removed:
foreach $tp in filter(folder('toolpath'),'this.RootType == "toolpath"') {
if $tp.Safety.Holder.Cutting.Status == 'collides' or $tp.Safety.Holder.Leads.Status == 'collides' or $tp.Safety.Holder.Links.Status == 'collides' or $tp.Safety.Tool.Cutting.Status == 'collides' or $tp.Safety.Tool.Leads.Status == 'collides' or $tp.Safety.Tool.Links.Status == 'collides' {
string $newName = $tp.Name + "_COLLISION"
if entity_exists('toolpath',$newName) {
$newName = new_entity_name('toolpath',$newName)
}
RENAME Toolpath ${tp.Name} ${newName}
}
}
Here is the macro rewritten as I think I understood it.
Did I make a mistake? Am I forgetting something?
It's still the same result. It is read to the end without problem,
but the toolpath which is in collision is still not renamed.
Thanks again for your help. It is more than appreciated.
try running only this:
foreach $tp in filter(folder('toolpath'),'this.RootType == "toolpath"') {
if $tp.Safety.Holder.Cutting.Status == 'collides' or $tp.Safety.Holder.Leads.Status == 'collides' or $tp.Safety.Holder.Links.Status == 'collides' or $tp.Safety.Tool.Cutting.Status == 'collides' or $tp.Safety.Tool.Leads.Status == 'collides' or $tp.Safety.Tool.Links.Status == 'collides' {
string $newName = $tp.Name + "_COLLISION"
if entity_exists('toolpath',$newName) {
$newName = new_entity_name('toolpath',$newName)
}
RENAME Toolpath ${tp.Name} ${newName}
}
}
i just added my code at the end of your macro
if this works heres the complere macro:
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK
FOREACH tp IN folder('Toolpath') {
IF NOT tp.Computed {
ACTIVATE TOOLPATH $tp.Name
EDIT TOOLPATH $tp.Name CALCULATE
}
}
FOREACH tp IN folder('Toolpath') {
ACTIVATE TOOLPATH $tp.Name
ACTIVATE StockModel "P#01 - STM_Blank milling_1"
EDIT COLLISION TYPE COLLISION
EDIT COLLISION STOCKMODEL_CHECK Y
EDIT COLLISION STOCKMODEL "P#01 - STM_Blank milling"
EDIT COLLISION SCOPE ALL
EDIT COLLISION SPLIT_TOOLPATH N
EDIT COLLISION MISS_OUTPUT N
EDIT PAR 'Verification.UseVerificationThickness' 0
EDIT COLLISION HEAD_CLEARANCE "600.0"
EDIT COLLISION HOLDER_CLEARANCE "1.0"
EDIT COLLISION SHANK_CLEARANCE "0.3"
EDIT COLLISION DEPTH Y
EDIT COLLISION ADJUST_TOOL N
UNDRAW COLLISION
EDIT COLLISION APPLY
EDIT STOCKMODEL ; INSERT_INPUT TOOLPATH $tp.Name LAST
EDIT STOCKMODEL "P#01 - STM_Blank milling_1" CALCULATE
}
foreach $tp in filter(folder('toolpath'),'this.RootType == "toolpath"') {
if $tp.Safety.Holder.Cutting.Status == 'collides' or $tp.Safety.Holder.Leads.Status == 'collides' or $tp.Safety.Holder.Links.Status == 'collides' or $tp.Safety.Tool.Cutting.Status == 'collides' or $tp.Safety.Tool.Leads.Status == 'collides' or $tp.Safety.Tool.Links.Status == 'collides' {
string $newName = $tp.Name + "_COLLISION"
if entity_exists('toolpath',$newName) {
$newName = new_entity_name('toolpath',$newName)
}
RENAME Toolpath ${tp.Name} ${newName}
}
}
DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK
Can't find what you're looking for? Ask the community or share your knowledge.