I am expanding my vba skills and started playing with the ILocateCommands. I started looking for a example that allows the user to select multiple elements but could not find one.
Can someone point me to an example that allows the user to select multiple elements using the ILocate Command using vba?
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Unknown said:Can someone point me to an example that allows the user to select multiple elements using the ILocate Command using vba?
AFAIK there's no example, but you can write your own class that Implements ILocateCommandEvents. In your class _Accept event, you can add the located element to the selection set. Then, restart your command, so user can continue to choose elements.
Regards, Jon Summers LA Solutions
Unknown said:I am going to assume that by "selection set" you are referring to the Element Enumerator?
No, I mean ModelReference.SelectElement. Use that in your _Accept method to add the chosen element to the selection set. You have the option to display as selected.
An alternative approach, should you wish to be more discrete about the chosen elements, would be to create a named group and add elements to that group.
Once the user has finished collecting elements, then you would get them by using GetSelectedElements to obtain an ElementEnumerator.
I have an example which implements selecting multiple elements by using IPrimitiveCommand. Please see my attachment.
Answer Verified By: Gerald Piotrowski