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: 

[MACRO ] how to remove toolpaths from NC PROGRAM

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
edm15G7FN
345 Views, 5 Replies

[MACRO ] how to remove toolpaths from NC PROGRAM

Hey there, 

 

I need help with the following Macro. 

 

What is the macro command to select all toolpath in a current/ activated NC program and to delete them without deleting the NC program. 

 

Any help would be greatly appreciated 

 

 

5 REPLIES 5
Message 2 of 6
ondrej.mikulec
in reply to: edm15G7FN

Hi
I couldn't figure out any direct command so there is a macro.

INT $index = 0
WHILE $size($components($entity('NcProgram',''))) > 0 {
	EDIT NCPROGRAM ; REMOVE ITEM $index
	$index = $index + 1
}

 

Message 3 of 6
edm15G7FN
in reply to: ondrej.mikulec

Thank you so much ! this is exactly what I was looking for 🙂 

Message 4 of 6
icse
in reply to: ondrej.mikulec

I dont understand why this works,

if you got a ncProgramm with 3 items in it, the first iteration removes the item at index 0,

then the size of the ncProgramm is 2 the next removed item is index 1,

then the size of the ncProgramm shoud be 1 and the next removed item is at index 2...

 

The code actually works as intended and removes all items, do i miss something?

 

this would be my approach:

int $index = size($components($entity('NcProgram','')))

WHILE $index > 0 {
	$index = $index - 1
	EDIT NCPROGRAM ; REMOVE ITEM $index	
}

 

Message 5 of 6
icse
in reply to: ondrej.mikulec

I also dont understand why following does NOT work but i think it sould:

WHILE size($components($entity('NcProgram',''))) > 0 {
	EDIT NCPROGRAM ; REMOVE ITEM 0	
}

 

Message 6 of 6
ondrej.mikulec
in reply to: icse

Exactly, that was my first attempt but it didn't work. Then my second version was to get the components' count and go from 0 to the count value. That also didn't work because if some of the toolpaths were deleted manually before, the others kept their original indexes. So, my final solution is to just go from 0 while the count of the components is > 0.

I am assuming that the number value is not an index of the components array, but some value that was assigned as a component property and that value stays the same. But that property is not shown in the macro debugger.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report