Invert Selection [VBA] [V8i]

Good morning,

I would like to select the unselected elements and, vice versa, deselect the selected ones.

Is it possible, and, if yes, how?

Thanks a lot,

Paolo

  • Hi Paolo,

    Is it possible

    I think there is no such function in MicroStation (both user tool and in API). Did you search for similar questions? I found several discussions (surprisingly not too many), but without solution or workaround.

    if yes, how?

    When you need it, yo have to write your own code. To do the selection set inversion in active model should be quite simple, but on the other hand, to cover all options (like the same element from nested reference attached and displayed several times) requires more complex code. But still, it's "only" about recursive iteration existing attachments.

    Regards,

      Jan

  • Using the 'Selector' tool, you can use 'Invert' (4th icon in the bottom row) and place a fence - this will select the unselected elements, and de-select the selected ones. Is that what you are looking to do?

    I recorded a simple example - selected some items in a fence, did 'Invert' and placed a fence to invert the elements. The code is shown below.

    SetCExpressionValue "powerSelectInfo.prefs.currMode", 0, "PSELECT"

    CadInputQueue.SendCommand "POWERSELECTOR MODE NEW"

    point.X = startPoint.X + 26.8213001950855
    point.Y = startPoint.Y + 24.6794164464499
    point.Z = startPoint.Z
    CadInputQueue.SendDataPoint point, 1

    point.X = startPoint.X + 39.9777199590256
    point.Y = startPoint.Y + 15.6472588809966
    point.Z = startPoint.Z
    CadInputQueue.SendDataPoint point, 1

    SetCExpressionValue "powerSelectInfo.prefs.currMode", 3, "PSELECT"

    CadInputQueue.SendCommand "POWERSELECTOR MODE INVERSE"

    point.X = startPoint.X - 1.84316991861962
    point.Y = startPoint.Y + 1.84459555914188
    point.Z = startPoint.Z
    CadInputQueue.SendDataPoint point, 1

    point.X = startPoint.X + 40.0412775424263
    point.Y = startPoint.Y + 28.305000821315
    point.Z = startPoint.Z
    CadInputQueue.SendDataPoint point, 1