Community
PowerMill Forum
Welcome to Autodesk’s PowerMill Forums. Share your knowledge, ask questions, and explore popular PowerMill topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help to modify macro for MTD Collision check

0 REPLIES 0
Reply
Message 1 of 1
rajesh.kanna
519 Views, 0 Replies

Help to modify macro for MTD Collision check

Kindly find the below macro for gouge and collision check for all toolpath.

 

I would like to modify the macro to check gouge and collision if the tool axis is not vertical. Means 4 or 5 toolpath only.

 

Also, need to add by highlighting collisions using .mtd file simulation for 4 and 5 axis toolpath.

 

 

 

// Gouge Check and Collision Check ALL toolpaths
// First define the Gouge Check and Collision Check paramaters. I used a 1mm / 0.04 Inch clearance for the
// holder and ZERO for the shank. Change this if necessary! Change any of the other collision/gouge checking parameters to suit Integrity!


// Ask for the Holder Clearance
bool $err = 0
real $Holder_Clearance = 0

do {
$Holder_Clearance = INPUT "Enter Tool Holder Clearance"
$err = ERROR $Holder_Clearance
if $err {
message error "Value must numerical. Please try again."
} elseif ($Holder_Clearance <= 0) {
message error "Value must be greater than 0. Please try again."
}
} while ($err or $Holder_Clearance <= 0)


// Ask for the Shank Clearance
real $Shank_Clearance = 0

do {
$Shank_Clearance = INPUT "Enter Tool Shank Clearance"
$err = ERROR $Shank_Clearance
if $err {
message error "Value must numerical"
} elseif ($Shank_Clearance < 0) {
message error "Value must be greater than or equal to 0.0"
}
} while ($err or $Shank_Clearance < 0)


// All parameters are now defined. Now we can loop through all toolpaths and perform the collision check!

FOREACH $tp IN FOLDER('toolpath') {
// Only bother to do this toolpath if it is calculated!
IF ($tp.computed) AND (Segments('toolpath',$tp.name) != 0) {
ACTIVATE TOOLPATH $tp.name

// Check = Collisions (Ensure holder/shank collision checking.)
EDIT COLLISION TYPE COLLISION

// Check Against = Models
EDIT COLLISION STOCKMODEL_CHECK N

// Split Toolpath = OFF
EDIT COLLISION SPLIT_TOOLPATH N

// Verification Thickness = OFF
EDIT PAR 'Verification.UseVerificationThickness' 0

// Collision options... Replace Tool = NONE
EDIT COLLISION USE_TOOL " "

// Adjust Tool = OFF
EDIT COLLISION ADJUST_TOOL N

// Define a boolean variable to set the Holder/Shank collision safety status.
BOOL $HolderTick = TRUE
// Define a boolean variable to set the gouge safety status of the toolpaths tool.
BOOL $GougeTick = TRUE

// If any of the following verification parameters are = "unknown", then there
// cannot be a green tick. Or, if the Shank/Holder clearance values have changed,
// then we must do a holder check again!

IF $entity('toolpath',$tp.name).Safety.Holder.Links.Status == "unknown" {
$HolderTick = FALSE
} ELSEIF $entity('toolpath',$tp.name).Safety.Holder.Leads.Status == "unknown" {
$HolderTick = FALSE
} ELSEIF $entity('toolpath',$tp.name).Safety.Holder.Cutting.Status == "unknown" {
$HolderTick = FALSE
}

IF $entity('toolpath',$tp.name).Safety.Tool.Links.Status == "unknown" {
$GougeTick = FALSE
} ELSEIF $entity('toolpath',$tp.name).Safety.Tool.Leads.Status == "unknown" {
$GougeTick = FALSE
} ELSEIF $entity('toolpath',$tp.name).Safety.Tool.Cutting.Status == "unknown" {
$GougeTick = FALSE
}

// There may now be a HolderTick, but if the user has changed the Holder or Shank clearance values
// then we must do a Holder/Shank check again!

IF $Holder_Clearance != $tp.verification.clearance.holder {
$HolderTick = FALSE
} ELSEIF $Shank_Clearance != $tp.verification.clearance.shank {
$HolderTick = FALSE
}

// We now know if the toolpath is collision unknown and/or gouge unknown

// Do the Holder Check if it is unknown:
IF NOT($HolderTick) {
// Switch off ERRORS AND WARNINGS to prevent the macro pausing. It will be switched back on at the end
DIALOGS MESSAGE OFF
// Define the tool holder/shank clearance values
EDIT COLLISION TYPE COLLISION
EDIT COLLISION HOLDER_CLEARANCE $Holder_Clearance
EDIT COLLISION SHANK_CLEARANCE $Shank_Clearance
// All Collision Checking parameters are now set... Do the HOLDER/SHANK collision check!
EDIT COLLISION APPLY
// Switch on ERRORS AND WARNINGS
DIALOGS MESSAGE ON
}

// Do the Gouge Check if it is not already safe:
IF NOT($GougeTick) {
// Switch off ERRORS AND WARNINGS to prevent the macro pausing. It will be switched back on at the end
DIALOGS MESSAGE OFF
// Check = Gouge
EDIT COLLISION TYPE GOUGE
// Do the Gouge check!
EDIT COLLISION APPLY
// Switch back on ERRORS AND WARNINGS
DIALOGS MESSAGE ON
}
}
}

 

Labels (1)
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report