Automatic first toolpath activation

Automatic first toolpath activation

petanhavran
Contributor Contributor
239 Views
1 Reply
Message 1 of 2

Automatic first toolpath activation

petanhavran
Contributor
Contributor

Hi, i would like to ask if there is any possible solution, that if i open existing powermill project, that i can automatically activate first toolpath without touching anything? Even if i close powermill and relaunch it once again, than open the same project i always want to have first toolpath activated. Because i want to read few parametres from first toolpath and use it to macros. Thank you, Petr. 

240 Views
1 Reply
Reply (1)
Message 2 of 2

Y.Mahran
Contributor
Contributor

Hi Petr,

 

One way you can do it is to simply use (pmstartup.mac) macro.

 

 

Another way to do it is to open PowerMill then launch the project through the macro, and then run any commands you want.

 

FUNCTION Main() {
 
	// Opening the file select dialogue & activating the 1st toolpath
	CALL OpenProject_ActivateFirstToolpath()
	
	// Commands to do
	...
	
	// Commands to do
	...
}

FUNCTION OpenProject_ActivateFirstToolpath() {
 
	// Opening the file select dialogue
	STRING ProjectPath  = ''
	STRING DirectoryName = ''
	$ProjectPath = FILESELECT "Select the (.pmlprj) file in you project"
	$DirectoryName = dirname($ProjectPath)
	PROJECT OPEN PROJSELECTOR $DirectoryName
	
	// Activating 1st toolpath
	STRING LIST MyToolpaths = extract(folder('Toolpath'), 'name')
	If (is_empty(MyToolpaths)) {
	  MESSAGE ERROR "Cannot activate 1st toolpath, Toolpaths folder is empty!"
	  MACRO ABORT
	} ELSE {
	  DEACTIVATE TOOLPATH
	  ACTIVATE TOOLPATH $MyToolpaths[0]
	}
}

 

 

 

Hope that I understood your question well and that my reply is helpful to you.

 

0 Likes