capture text element content (string) and re-use to attach ref

Hello,

Question with moving old V8i MicroStation Basic to Connect Edition VBA (or macro recorder).

Starting from a DGN that has a rectangular matrix (mesh/ grid?) over the map of the country. In each case (box) of the DGN matrix we have a text element (e.g. 511S1).

The VBA should allow to manually select the text in one box (click), save that text in a variable and then attach the corresponding raster ref file which is the topographical Map matching that specific box.

So the macro should in this example attach raster ref "511S1.tif"  (not intercative)., which is the text string captured by the selection + the ".tif" string.

I searched a lot but can not find the trick to save that text content in a var in VBA.

Thank you very very much in advance for your help,

Best regards,

Nicolas Tobbackx

Parents Reply
  • Thank you very much indeed Jon, and Jan :)

    Sorry for the delay -doing too many things at the same time - I succeeded in getting my VBA to work. Now it works fine on the text elements I select (Datapoint) on text in my active file. But the text from reference files do not not get selected when clicking on it. While the MicroStation select function works OK, so all refs have locate on.

    How can I make the VBA also select text (datapoint) from the reference files. Searching for doc about this seems only to activate one single ref.

    Thank you very much in advance for your advice,

    Best regards,

    Nico

Children
  • How can I make the VBA also select text (datapoint) from the reference files

    Assuming that you've written a class that Implements ILocateCommandEvents, then you can modify the _Start method.  You can see this example (Analyze Arc) in VBA help...

    Private Sub ILocateCommandEvents_Start()
      Dim lc As LocateCriteria
      '  Since this command does not modify the original element,
      '  set the locate criteria to allow  read-only elements.
      Set lc = CommandState.CreateLocateCriteria(False)
      CommandState.SetLocateCriteria lc
    
      ShowCommand "Analyze Arc Example"
      ShowPrompt "Select an arc"
    End Sub
    

    The relevant part is LocateCriteria.  Reference attachments are read-only, so copy this code to do what you want.

     
    Regards, Jon Summers
    LA Solutions