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: 

Question About Set Named Parameter

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
tecnico
664 Views, 5 Replies

Question About Set Named Parameter

Hello,
using old projects for new jobs I often need to edit all the toolpaths.

For example, I set a block and then select all the paths to which I want to change the block, right click, set named parameter and type BLOCK: in this way I apply that block to all the selected toolpaths.

I need to do the same thing with the parameter AreaClearance.Rest.Active (for roughing) and with StockEngagement.MachineStockOnly (for finishing) setting them to 0.

How can I proceed?

Thank you and I hope I have explained myself.

Translated with www.DeepL.com/Translator (free version)

Labels (1)
5 REPLIES 5
Message 2 of 6
Sean570
in reply to: tecnico

I have a macro that I use to remove all the old stock model references. You may have to change a few things if it doesn't suit your needs perfectly, but it should be close to what you need.

 

FUNCTION MAIN() {

	// Turn off dialogs and graphics
	GRAPHICS LOCK
	DIALOGS MESSAGE OFF

	// Loop through all toolpaths
	FOREACH tp IN FOLDER('Toolpath') {
		// Only modify toolpaths that are not calculated to avoid screwing up toolpaths on accident 
		IF NOT $tp.computed {

			// Call function to remove the stock model reference
			// Pass in the current toolpath entity
			CALL RemoveStockModel($tp)

			// Activate toolpath
			ACTIVATE TOOLPATH $tp.name

			// Apply changes made to active toolpath
			EDIT TOOLPATH ; REAPPLYFROMGUI
        }
	}

	// Turn dialogs and graphics back on
	GRAPHICS UNLOCK
	DIALOGS MESSAGE ON

}

// This function removes the stock model reference from any toolpath passed in as an argument.
FUNCTION RemoveStockModel(ENTITY tlpth) {

	SWITCH $tlpth.strategy {
		CASE "raster_area_clear"
		CASE "offset_area_clear"		
		CASE "profile_area_clear"		
		CASE "raster_flat"		
		CASE "offset_flat"
		CASE "curve_profile"			
		CASE "curve_area_clear"			
		CASE "adaptive_area_clear"
			EDIT PAR 'AreaClearance.Rest.Active' '0'
			BREAK	
		
		// If Toolpath isn't an AreaClearance toolpath, default to this.
		DEFAULT
			EDIT PAR 'StockEngagement.MachineStockOnly' 0	
			BREAK
	}
}

 

Message 3 of 6
tecnico
in reply to: tecnico

Thank you very much, I will try and let you know.

 

And happy new year 😁

Message 4 of 6
Sean570
in reply to: tecnico

Happy New year to you as well. The only thing you might want to change is that my macro will only remove references from uncalculated toolpaths to avoid accidentally uncalculating certain toolpaths. Let me know if you want me to change that and I can.

Message 5 of 6
dames99
in reply to: tecnico

Here's another one:

 

Function Main() {
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK

      bool err = 0 
      $err = ERROR $entity('stockmodel','').name
      if err { 
         MESSAGE ERROR "Activate stockmodel before running the macro"
         MACRO ABORT
      }

   UNLOCK STOCKMODEL ; 

   FOREACH $tp IN folder('Toolpath') {
      IF NOT tp.Computed {
         ACTIVATE Toolpath $tp.name
         EDIT PAR 'StockModelState.StockModel' " "
         EDIT TOOLPATH ; REAPPLYFROMGUI
      }
   }

   DELETE STOCKMODEL ;

GRAPHICS UNLOCK
DIALOGS MESSAGE ON
DIALOGS ERROR ON
}

 

David

Message 6 of 6
urizenYHS3W
in reply to: tecnico

You don't need to do anything special here

$AreaClearance.Rest.Active = 0
$StockEngagement.MachineStockOnly = 0
EDIT PAR SELECTED 'AreaClearance.Rest.Active'
EDIT PAR SELECTED 'StockEngagement.MachineStockOnly'


The reason this works is because the value of 'AreaClearance.Rest.Active' is ignored by finishing toolpaths, and 'StockEngagement.MachineStockOnly' is ignored by areaclearance ones.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report