Tool Swap Macro help.

Tool Swap Macro help.

Scoobyvroom
Advocate Advocate
1,052 Views
7 Replies
Message 1 of 8

Tool Swap Macro help.

Scoobyvroom
Advocate
Advocate

We just recently had our POST changed. It used to be setup that all thread mills ran CW. After the change it looks at the RPM and if the RPM is negative is runs CW and positive runs CCW.  Problem is our old programs, if you run them the thread mill it post out as running the spinlde CCW. Most of our thread mills are CW cutting. So I was trying to make this Macro to look at all the toolpaths in a Folder. Then if it sees a drill type listed as Thread_mill, and the spindle speed is greater than 0 it will ask you what tool to use to replace the current tool. Replace it and recalculate it. I think my issue is the $Selected_Tool is a list, and I'm trying to pull information as an Entity?? If someone could poke me in the right direction that would be great.

 

STRING $FolderName = active_folder()

IF $FolderName == '' {
MESSAGE ERROR "There is no active folder. Please activate a folder and try again."
MACRO ABORT
}


FOREACH tl IN FOLDER(FolderName) {

IF tl.Drill.Type == 'thread_mill' {   
					IF tl.SpindleSpeed.Value > 0 {
					ENTITY LIST $Selected_Tool = INPUT ENTITY MULTIPLE TOOL "Select Replacement Tool"
					ACTIVATE TOOLPATH $tl.Name
					ACTIVATE TOOL $Selected_Tool.Name
					EDIT PAR 'CutDirection' 'conventional'
					EDIT TOOLPATH $tl.Name CALCULATE




											}		
						}	
}
0 Likes
Accepted solutions (1)
1,053 Views
7 Replies
Replies (7)
Message 2 of 8

rafael.sansao
Advisor
Advisor
Accepted solution
STRING $FolderName = active_folder()
IF $FolderName == '' {
	MESSAGE ERROR "There is no active folder. Please activate a folder and try again."
	MACRO ABORT
}

FOREACH tl IN FOLDER(FolderName) {
	IF tl.Drill.Type == 'thread_mill' {   
		IF tl.SpindleSpeed.Value > 0 {
			ACTIVATE TOOLPATH $tl.Name
			ENTITY $Selected_Tool = INPUT ENTITY TOOL "Select Replacement Tool"
			INVALIDATE TOOLPATH NOQUERY ;
			ACTIVATE TOOL $Selected_Tool.Name
			EDIT PAR 'CutDirection' 'conventional'
			EDIT TOOLPATH $tl.Name CALCULATE
		}
	}
}

Rafael Sansão

OptiNC - www.optinc.tech

EESignature

Message 3 of 8

rui_rita
Advocate
Advocate

hi @Scoobyvroom

 

try this

 

STRING $Selected_Tool = INPUT ENTITY TOOL "Please select a Tool."

ACTIVATE TOOL $Selected_Tool



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
Message 4 of 8

Scoobyvroom
Advocate
Advocate

Got the macro working 99% the way I want. The only issue I am still having is upon importing tools from the database it has a query box pop up. I have Dialog, and Message set to OFF. Anything else I can do to stop this pop up? I am importing multiple tools at one time. I also tried NOQUERY.

 

Any ideas?

0 Likes
Message 5 of 8

rui_rita
Advocate
Advocate

Hi @Scoobyvroom

 

try "NOQUIBBLE"

 

 

TOOLDB RESULTS_LIST CREATE NOQUIBBLE SELECTED



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
Message 6 of 8

Scoobyvroom
Advocate
Advocate

Thank you! works perfect now. Can I ask where you find this information? 

0 Likes
Message 7 of 8

ramaprasad_narayan
Enthusiast
Enthusiast

Hai

could you please share the final macro

Thanks

0 Likes
Message 8 of 8

artur.boszczyk
Advocate
Advocate

if the tool is of the same type, diameter you can replace the tool without invalidating the toolpath:

 

STRING Cmd= "EDIT TOOLPATH '" + $tpName + "' REPLACE_TOOL '" + $RTools[$I] + "'"

DoCommand $Cmd
0 Likes