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 for Active Boundary

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
slejeuneSZHJV
681 Views, 7 Replies

Check for Active Boundary

I am having some trouble getting this macro to work,

What I am trying to do is, check to see if "BOUNDARY_3" is active, and if it is do ect... ELSE do etc..

 

I started with this code below and it works as it should.

 

IF entity_exists('boundary', 'BOUNDARY_3') {
do etc...
} ELSE {
do etc...
}

 

Here is where I switched it up to have it check if it was active and I'm having no luck getting it to work.

 

IF active entity_exists('boundary', 'BOUNDARY_3') {
do etc...
} ELSE {
do etc...
}

 

Any suggestions would be appreciated!

Thank you!

 

7 REPLIES 7
Message 2 of 8
cfastNJWK6
in reply to: slejeuneSZHJV

You can get the Active Boundary like this:

STRING $ActiveBoundary = ""
$ActiveBoundary = entity_exists(entity('Boundary', ''))
Message 3 of 8

IF entity_exists('boundary', '') AND entity_exists('boundary', 'BOUNDARY_3') {
	do etc...
} ELSE {
	do etc...
}

Rafael Sansão

EESignature

Message 4 of 8

@cfastNJWK6 @rafael.sansao 

Thank you! , I gave both a try and seem to get the same results. 

I do have two other boundaries Im working with,  Boundary_1 , Boundary_2 , and Boundary_3 are in this part.

 

The only thing I am having issues with is,

If none of the boundaries are active it does the ELSE section of the code, and if any one of these boundaries are active it does the first section of the code , regardless of what the name of the boundary is. When it needs to be checking if the Boundary_3 is active or not. 

 

 

 

Message 5 of 8

Try:

IF entity_exists('boundary', '') {
	IF $entity('boundary', '').Name == 'BOUNDARY_3' {
		MESSAGE INFO "BOUNDARY_3 Active"
	} ELSE {
		MESSAGE INFO "Other"
	}
}

Rafael Sansão

EESignature

Message 6 of 8

@rafael.sansao   This worked perfect 

Thank you!

Message 7 of 8
cfastNJWK6
in reply to: slejeuneSZHJV

I typically don't like to hard-code entity names into my macros.  To avoid it you can do something like this to allow the user to select which boundary to use while the macro runs:

STRING $ActiveBoundary = ""
$ActiveBoundary = INPUT ENTITY BOUNDARY "Select the Boundary you would like to use."
Message 8 of 8
slejeuneSZHJV
in reply to: cfastNJWK6

@cfastNJWK6 , I will give it a try and see how things go, there are some applications where this will be very helpful. Thanks! 

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

Post to forums  

Autodesk Design & Make Report