I have this code below working in an MS_INITAPP for MicroStation CONNECT edition update 15, but running it in MicroStation V8i in an entirely new project for.NET 3.5, I am seeing the following error:
No design file is active at Bentley.Interop.MicroStationDGN.Application.OpenDesignFile(String DesignFileName, Boolean ReadOnly, MsdV7Action V7Action)
Source code:
private Bentley.Interop.MicroStationDGN.Application app; protected override int Run(string[] commandLine) { app = Bentley.MicroStation.InteropServices.Utilities.ComApp; app.Visible = false; ... ... DesignFile designFile = app.OpenDesignFile(document.Path, true, MsdV7Action.UpgradeToV8); ... }
The C# .NET35 project for the MicroStation V8i project has all the dll references to the V8i versions as seen below which differs from the CONNECT Edition:
Bentley.Genral.1.0
bentley.interop.microstationdgn
bentley.microstation
Bentley.MicroStation.General
bentley.microstation.interfaces.1.0
ustation
Hi Jan,
Thanks for the reference. I was able to figure out why V8i was not opening the file - To start MicroStation I originally had the command:"ustation.exe -WAaddinName"
But, due to the fact that I was not opening a drawing file, V8i was sending that error back of "No design file is active".
Adding a drawing file to the command it seems to be working now
"ustation.exe -WAaddinName <path to file>"
There was a comment in that post that mentioned - if there is no file active in MicroStation V8i, it will exit.
Answer Verified By: Robert Hook
HI Mervin,
Mervin Bowman said:I have this code below working in an MS_INITAPP for MicroStation CONNECT edition update 15
I recommend to do not share V8i and CE code, even "mentally" only. They are different products with different APIs, so it's better to think about V8i version as about newly written, for different product ;-)
Mervin Bowman said:Source code:
It does not tell everything. How Addin attributes are defined?
I recommend to start with some working example (e.g. provided in this discussion, but I remember it was discussed and code shared several times) and step by step to modify it to meet your requirements.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi Jon,
Yes, it is 32-bit. The dll loads fine as a mdl MS_INITAPP
Jon Summers said:MicroStation V8 is a 32-bit app. Are you building your Viz Studio DLL for a 32-bit processor?
VS 2019
Jon Summers said:Which version of Viz Studio are you using?
Yes, I only want read-only
Jon Summers said:You're attempting to open the file read-only: is that what you want?
Yes this is a valid file path and the file exists
Jon Summers said:Is document.Path a valid file?
document.Path
The error is occurring as soon as this line runs:
DesignFile designFile = app.OpenDesignFile(document.Path, true, MsdV7Action.UpgradeToV8);
First, some basics...
Mervin Bowman said:I am seeing the following error
When do you see that error? If you attach the Viz Studio debugger to the MicroStation executable, step through until you see an exception. Perhaps the Viz Studio tracer can reveal the problem.
Regards, Jon Summers LA Solutions