ActiveDesignFile

Hello,

I have written some add-ins for Microstation v8i. I just switched to the newest version and now my code is not recognizing <ActiveDesignFile> as a property of <Application>

I'm not sure if it is even in the same dll. Has anyone else had this experience or know how I might resolve it?

This is the code I've been using for years:

Imports Bentley.Interop.MicroStationDGN

Imports Bentley.MicroStation.InteropServices

Dim ActiveUstn As New MicroStationDGN.Application

Dim myDGNActive As MicroStationDGN.DesignFile

myDGNActive = ActiveUstn.ActiveDesignFile

Dim str_ActivePath As String

str_ActivePath = myDGNActive.Path

Now I get the error that <new> in the 2nd dim statement cannot be used on an interface and when I remove it Application is not recognized as a property of Bentley.Interop.MicroStationDGN even though it shows it as a readonly property in the object browser.

Thanks

Dave

Parents
  • Hi Dave,

    a couple of notes and questions:

    Unknown said:
    I just switched to the newest version

    What does it mean? Do you moved to the newest V8i version, which is SELECTseries 4, or you mean the latest MicroStation CONNECT Edition?

    Unknown said:
    This is the code I've been using for years:

    Please use Syntax Highlighter tool (yellow pencil icon in advanced editor) to post any code plus choose coorect language, so it will be nicely formatted and colored.

    Unknown said:
    I have written some add-ins for Microstation v8i.

    In my opinion what you posted is not MicroStation addin code (class inherited from Adapter class and run "in" MicroStation), but code using Automation through interop to access and control MicroStation (and running "outside" MicroStation).

    Unknown said:
    Has anyone else had this experience or know how I might resolve it?

    In my opinion the first step should be to specify what version (build number) do you use.

    With regards,

      Jan

  • Unknown said:
    What does it mean? Do you moved to the newest V8i version

    The Newest Version (Release) of Promis.e V8i (Select Series 8) .08.11.13.57

    Unknown said:
    Please use Syntax Highlighter tool

    Imports Bentley.Interop.MicroStationDGN
    Imports Bentley.MicroStation.InteropServices
    
    Dim ActiveUstn As New MicroStationDGN.Application 'This is the line I'm getting an error in. See note 1
    
    Dim myDGNActive As MicroStationDGN.DesignFile
    
    myDGNActive = ActiveUstn.ActiveDesignFile
    
    Dim str_ActivePath As String
    
    str_ActivePath = myDGNActive.Path
    
    

    Note 1: The error I'm getting says "New" cannot be used on an interface


    Unknown said:
    In my opinion what you posted is not MicroStation addin code (class inherited from Adapter class and run "in" MicroStation), but code using Automation through interop to access and control MicroStation (and running "outside" MicroStation).


    You are probably correct about this. Software development is not my core job so I may not have all the jargon down and truthfully I have a very limited idea of the distinctions your making in this quote. I wrote several "Plug-ins" for Promis.e using the instructions in the "Creating Promis.e V8i Plug-ins" page in one or the Bentley Communities


    http://communities.bentley.com/products/electrical___instrumentation/w/electrical_and_instrumentation__wiki/3593.creating-promis-e-v8i-plug-ins


    I'm going to convert all of these to Add-ins using the VBAddin examples you wrote, but for now I have to get all these working again on the new release as soon as possible.

    I did find a way to get the Active design file using the ECT.ECAD.API.LT and the drawingtool, but now even after following all the instructions on the link above I cannot get any of my Plug-ins to load.

    This is the error I'm getting:





    Any help is greatly appreciated. And also Thank you very much for the reply.

    Dave

  • Hi Dave,

    Unknown said:
    The Newest Version (Release) of Promis.e V8i (Select Series 8) .08.11.13.57

    Ok, so it's not MicroStation but Promis.e ... which changes the game a bit. I don't know Promis.e in detail, but I guess it's based on MicroStation engine, so a majority of features are the same, but there is still a threat something can behave differently.

    Unknown said:
    The error I'm getting says "New" cannot be used on an interface

    I guess it should be

    Dim ActiveUstn As New MicroStationDGN.ApplicationClass

    Unknown said:
    I have a very limited idea of the distinctions your making in this quote.

    With some simplification: Accessing an application using Application object allows an external application (external process) to start and control another application (MicroStation or Promis.e in this case) through COM Automation interface. It's old Microsoft widely used technology with own specific features: E.g. it's possible to start an application at background without displaying GUI, but it does not allow to start and control more the same applications in parallel.

    In my opinion the biggest problem, if talking about MicroStation development, is such application runs outside MicroStation as external process, so it requires specific code in some situations. It's described e.g. in "Accessing data and other applications" and "Connecting to MicroStation from a Separate Process" chapters in MicroStation VBA help.

    If a managed code (NET) application is written as MicroStation add-in, it's started by MicroStation and runs inside, which allow better and tight integration including some extra features (command table...). But because it's MicroStation application, MicroStation (or other hosting application) has to be started first.

    I am not familiar with Promis.e, so I don't know if it's possible to create "real addin" or Automation interface is the only way. In my opinion it's better to create add-in, but it's not always possible because of a specific product limitation or specific requirements (e.g. to call MicroStation from Excel and to create a drawing based on Excel data).

    Unknown said:
    I did find a way to get the Active design file using the ECT.ECAD.API.LT and the drawingtool

    Because it's not part of standard MicroStation, I cannot help here.

    With regards,

      Jan

  • I really appreciate your help. I'm going to be working on this throughout the week and I'm sure I'll have more questions. Once again you are correct

    Dim ActiveUstn As New MicroStationDGN.ApplicationClass

    is the correct code. The ECT.ECAD.API.LT and the drawingtool did appear to work initially, because I was able to return an Application to assisn to ActiveUstn, but it was the Proms.e Application not the Microstation Applicatin.

    Once again thanks for the help.

    Dave

Reply
  • I really appreciate your help. I'm going to be working on this throughout the week and I'm sure I'll have more questions. Once again you are correct

    Dim ActiveUstn As New MicroStationDGN.ApplicationClass

    is the correct code. The ECT.ECAD.API.LT and the drawingtool did appear to work initially, because I was able to return an Application to assisn to ActiveUstn, but it was the Proms.e Application not the Microstation Applicatin.

    Once again thanks for the help.

    Dave

Children
No Data