create relative associations to elements. with vba

How to I get this selection chosen by vba or key-in command

"Enable to create relative associations to elements"

Recording the macro makes changes to the association lock only

I need "relative associations to elements" or is there a way to

manipulate the dialog window somehow. I am creating a macro

that places to cells. One of them is an cell describing an instrument  with item attached

Other is label pointing to that cell. It works only if

"Enable to create relative associations to elements" is chosen

  • What is the exact version no. (e.g. v10.x.y.z) of MicroStation that you are using? Use key-in VERSION to see the version no. in the MicroStation Message Center, or Help→About MicroStation in the backstage.

    See this blog that shows you how to obtain MicroStation's version number.

    If you're using an additional product (e.g. ProjectWise, OpenXxx) let us know about that too!

    How to I get this selection chosen by vba or key-in command

    One approach is to record a VBA macro.  Sometimes the recording reveals details of the application variable that is modified when you click in the user interface.

     
    Regards, Jon Summers
    LA Solutions

  • I am using the latest Microsoft CONNECT edition update 17 Version 10.17.01.62

    Recording the macro does not help in this situation. Recording the macro either does not give anything or it will give something like tcb->assocLockMask, 16. This will manipulate the association lock it does not manipulate the "Enable to create relative associations to elements".

    It would by helpful if I could set this on from preferences or what not. Every time the dgn-fie is reopened Microstation will forget this setting and set it off. The setting once set manually will stay open for the duration of a single use only even if settings are saved. 

  • Hi Petri,

    Recording the macro either does not give anything

    Unfortunately it looks like the tool does not follow MicroStation best practices (better to say developers does not implemented it right): Whenever possible, all tool parameters should be accessed by "set item toolsettings" key-in, but it does not work with the discussed tool. And also the tool probably does not publish all internals, so the recorder is not able to monitor them.

    or it will give something like tcb->assocLockMask

    assocLockMask is opaque 16bit mask with no further details available, so the only thing that is clear is that 5th bit controls "Enable to create relative associations to elements" switch.

    What bit (and if) controls the 2nd switch is not described and unfortunately it seems macro recorder is not able to monitor such task right. It's possible (using C-expression) try all bit in the mask, but it's a bit time consuming and risky.

    It would by helpful if I could set this on from preferences or what not.

    It is solely the responsibility of the tool itself, MicroStation itself does not control/manage whether tools store their settings. So if you would like to enhance this tool in this way, I recommend to create a new idea in MicroStation community.

    With regards,

      Jan

  • Hi  ,

    As  mentions unfortunately the Place Label Tool Settings are not able to be recorded and filing an MicroStation (product) Idea is a good idea.

    Though Place Label does not record well for playback at this time; the Place Label tool does provide all the (placelabel) key-ins needed to accomplish what you need; where you could send key-ins (even all on one line separated by ";") similar to this:

    e.g.

    • attach library geompa
    • placelabel cellname GEOM12
    • placelabel withlabelleader on
    • placelabel associationstate on
    • placelabel relativeassociationstate on
    • placelabel dialog

    HTH,
    Bob



    Answer Verified By: Petri Haikola 

  • Thank you Robert and Jan,

    I just tested it and your solution does work

    Like you suggested I Added these lines to my macro

        CadInputQueue.SendKeyin "placelabel associationstate on"
        
        CadInputQueue.SendKeyin "placelabel relativeassociationstate on"

    And was able to turn the "relative associations to elements" button on.