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: 

Verify if part of a boundary is selected by the user

7 REPLIES 7
Reply
Message 1 of 8
hugo_wy
426 Views, 7 Replies

Verify if part of a boundary is selected by the user

Hi.

I am having trouble in making a macro that verify if the user select part of a boundary like is shown in the picture.

I know the code that verify if the user selects surfaces:

 

INT count = 0
FOREACH surf in folder('model') {
$count = $count + number_selected(surf.Components)
}

IF $count == 0 {
MESSAGE INFO "Nao existe nenhuma superficie selecionada."
RETURN
}

 

But i can´t change it to a selected Boundary.

Can someone help.

7 REPLIES 7
Message 2 of 8
rafael.sansao
in reply to: hugo_wy

IF number_selected(entity("Boundary", "")) <= 0 {
	MESSAGE WARN "Nao existe segmento selecionado."
	MACRO ABORT
}

Rafael Sansão

EESignature

Message 3 of 8
hugo_wy
in reply to: rafael.sansao

Hi.

 

The command "number_selected(entity("Boundary", "")) <= 0" don´t work.

 

It gives a Macro Error: Can´t evaluate expression

 

I am working with PowerMill 2015.

Message 4 of 8
urizenYHS3W
in reply to: hugo_wy

The number_selected() function only work on boundaries in pm2017+

Message 5 of 8
cfastNJWK6
in reply to: hugo_wy

Try it with single quotes:

IF number_selected(entity('Boundary', '')) <= 0 {
	MESSAGE WARN "Nao existe segmento selecionado."
	MACRO ABORT
}
Message 6 of 8
hugo_wy
in reply to: cfastNJWK6

Hi.

 

Still doesn´t work.

 

Maybe is like you said.

Don´t work with PowerMill 2015.

 

But thanks anyway.

Message 7 of 8
cfastNJWK6
in reply to: hugo_wy

That's odd.  It's working for me in PowerMill 2022.

Message 8 of 8
hugo_wy
in reply to: cfastNJWK6

I just try it in another computer in my company, with PowerMill 2022.

 

The code work.

 

 

 

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

Post to forums  

Autodesk Design & Make Report