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!
Solved! Go to Solution.
Solved by cfastNJWK6. Go to Solution.
Solved by rafael.sansao. Go to Solution.
You can get the Active Boundary like this:
STRING $ActiveBoundary = ""
$ActiveBoundary = entity_exists(entity('Boundary', ''))
IF entity_exists('boundary', '') AND entity_exists('boundary', 'BOUNDARY_3') {
do etc...
} ELSE {
do etc...
}
Rafael Sansão
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.
Try:
IF entity_exists('boundary', '') {
IF $entity('boundary', '').Name == 'BOUNDARY_3' {
MESSAGE INFO "BOUNDARY_3 Active"
} ELSE {
MESSAGE INFO "Other"
}
}
Rafael Sansão
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."
@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.