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: 

Check explorer_selected_entities()

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
TK.421
853 Views, 3 Replies

Check explorer_selected_entities()

how can i check if the entities selected in the explorer are toolpaths or something else?

 

    INT i = size(explorer_selected_entities())  tells me how many things are selected in the explorer, but I really want to know how many toolpaths are selected
 
    INT i = size(explorer_selected_entities('Toolpath')) doesnt work... It's the end of the day and I'm at a loss.
 
thanks in advance!
--------------------------------------
Former Expert Elite Member (not enough participation in all their webinars and other "stuff", even though I beta test and regularly contribute to the betterment of the software and the PowerMill community as a whole)

the numbers never lie
3 REPLIES 3
Message 2 of 4
rafael.sansao
in reply to: TK.421

INT $i = size(explorer_selected_entities())
IF $i > 0 {
	ENTITY ent = explorer_selected_entities()[0]
	IF $ent.RootType == "toolpath" {
		MESSAGE INFO "Entity type selected: " + $ent.RootType
	}
} ELSE {
	MESSAGE WARN "No entity selected."
}

Rafael Sansão

EESignature

Message 3 of 4
TK.421
in reply to: rafael.sansao

Thanks @rafael.sansao   

 

I thought of that too, but I was hoping to do it in one line of code. 

--------------------------------------
Former Expert Elite Member (not enough participation in all their webinars and other "stuff", even though I beta test and regularly contribute to the betterment of the software and the PowerMill community as a whole)

the numbers never lie
Message 4 of 4
icse
in reply to: TK.421

you could use the filter function like this:

foreach $tp in filter(explorer_selected_entities(),'this.RootType == "toolpath"') {
	//your code
}

 

This will filter the explorer selection for toolpahts and if no toolpaths are selected the code in the loop gets skipped anyway so no size check needed.

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

Post to forums  

Autodesk Design & Make Report