Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Verify if part of a boundary is selected by the user

hugo_wy
Contributor

Verify if part of a boundary is selected by the user

hugo_wy
Contributor
Contributor

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.

0 Likes
Reply
498 Views
7 Replies
Replies (7)

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

Rafael Sansão

OptiNC - www.optinc.tech

EESignature

0 Likes

hugo_wy
Contributor
Contributor

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.

0 Likes

urizenYHS3W
Advocate
Advocate

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

0 Likes

cfastNJWK6
Advisor
Advisor

Try it with single quotes:

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

hugo_wy
Contributor
Contributor

Hi.

 

Still doesn´t work.

 

Maybe is like you said.

Don´t work with PowerMill 2015.

 

But thanks anyway.

0 Likes

cfastNJWK6
Advisor
Advisor

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

0 Likes

hugo_wy
Contributor
Contributor

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

 

The code work.

 

 

 

0 Likes