Key-in

I'm developing a routine that opens a file with opendesignfileforprogram. I cannot set a model of this file as active model reference. How can i send a key-in to this design file thru vba?

I need to send the following "reference merge all" and "reference makedirect A.dgn->B.dgn"...

I have implemented copy all elements but it looses clip boundaries...

Regards 

Parents Reply Children
  • Hi Rui,

    Unknown said:
    OpenDesignFileForProgram is much faster than OpenDesignFile.

    It's natural result of fact it's opened in "raw access mode", where direct access from code allowed, but no "user oriented features" (e.g. key-ins, some RasterManager. functionality etc.) are not initialized.

    Unknown said:
    Can anyone point me in the right direction to do this?

    In my opinion the simpelst way is to open a design file normally and to use key-ins, because you can be sure it will work exactly the same way as MicroStation. I guess a similar functionality can be implemented in VBA, but to support all scenrios correctly (merging of self attachments or nested references) is not simple task. But if you know your references will be always in some structure, check Attachment object and how to copy from attachment (and using CopyContext) in MicroStation VBA help.

    With regards,

      Jan

  • Thank you again Jan for your help.
    Is it possible to change, thru vba, an attachment from live nesting to copy attachement? I need to put all nested references as attachments in the main model...
  • Unknown said:
    Is it possible to change, thru vba, an attachment from live nesting to copy attachement?

    I guess it should be possible, but I assume there is no simple straightforward solution available. I don't know about specific key-in or VBA property or method that can be used to configure an attachment nesting mode.

    Because of that, I guess it requires to write own reattachment procedure or to try to "hack" References dialog, because the nesting mode is represented refFileInfoP->settings.nestMode CExpression value, but refFileInfoP has to be set correctly upfront.

    With regards,

      Jan

  • I have implemented copy attachement with the following routine, but i always get "file not found error" in the reattach line and i don't know what i'm doing wrong.

    Sub CopyAtt(nMdl As ModelReference, oModel As ModelReference)
    Dim Att As Attachment, Ott As Attachment, aName As String, fName As String
    For Each Att In nMdl.Attachments
    fName = ActiveDesignFile.FullName
    aName = oModel.Name
    Set Ott = Att.Copy
    Ott.Reattach fName, aName
    Ott.Rewrite
    Next
    End Sub


    - nMdl is a attachment with livenestering
    - oModel is the model where nMdl is
    - we want to "copy/move" the nested attachments in nMdl to oModel with the same settings.
    Any help will be really appreciated!

    Regards