Hi, Im relatively new to Microstation VBA and this is my first time posting here. My company recently upgraded from Microstation V8i (Select Series 4) to Microstation Connect Edition (Update 14). Code that includes the CreateDesignFile Method will run in V8i but returns a "File not found" error message in Microstation Connect. Any ideas as to what could be causing this error?
Regards
Tim
CreateDesignFile "Seed3d", "C:\Microstation Files\Test", False
Hi Timothy,
I guess the problem is in the used seed file. Does the file "Seed3d.dgn" exist and is the used workspace configured properly, so it can be found by MicroStation?
In MicroStation CE, the seed file "seed3d.dgn" is not delivered, so if you want to use it (e.g. because it contains company specific settings), you have to add it to your workspace. Or to use some from seed files, delivered with MicroStation CE.
And one more comment: I guess to use "C:\Microstation Files\Test" is incorrect, because as described in MicroStation VBA help, MicroStation does not add extensions. So I guess the right format is "C:\Microstation Files\Test.dgn".
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Thanks for the help Jan, It seems that is the issue, I replaced "Seed3d.dgn" with the full file path in my code and it worked.
Hi Tim,
Timothy Russell said:I replaced "Seed3d.dgn" with the full file path in my code and it worked.
be aware such solution is wrong for more reasons!
As mentioned in the method description: "The name of the seed file. Should not include a path. The default extension is ".dgn". "
And it's general software development rule: No code is allowed to contain hard coded path. Never. Otherwise it's dirty and potentially buggy.
Your code has to follow MicroStation standards. A location of seed files is defined by configuration variable (MS_SEEDFILES) and all used seeds have to be there. So the only acceptable solution is to use properly configured workspace, where seed files are at location where MicroStation expects them.
Regards,
Hi Jan, My workspace and MS_SEEDFILES configuration variables are set up by our survey department. The config variable is just a folder path with two seed files in the folder "seedsishenlocal2d.dgn" and "seedsishenlocal3d.dgn", if I use "seedsishenlocal3d.dgn" in the CreateDesignFile Method it works, although I feel this is also bad practice as it is using a specific file name on the network.
Is there still something missing or incorrect in my setup, like I said before I could just use "Seed3d" when running the code with V8i.
Timothy Russell said:My workspace and MS_SEEDFILES configuration variables are set up by our survey department.
If there is an application, used in company, the workflow has to support it and to be configured properly.
Fortunately there are more ways (places) how configuration variable can be defined. Not only on system level, but e.g. using own application cfg file, or, in the worst case, in .ucf file.
Timothy Russell said:although I feel this is also bad practice as it is using a specific file name on the network.
There is no difference whether files are on network or on local drive.
Seed file is important when pre-configured to contain specific settings, even when with increasing usage of dgnlibs a number of settings in seed file is decreasing.
So based on why the new file is created, a proper seed file should be used. And when it's not important, probably the best is to use some from seed files delivered with MicroStation itself.
Timothy Russell said:Is there still something missing or incorrect in my setup, like I said before I could just use "Seed3d" when running the code with V8i.
Compare used workspace (or generate msdebug files for V8i and CE) to find what is set differently.
Thank you for the help Jan. I checked some older files, prior to Connect our V8i projects were setup with a seed file called "Seed3d" that they put on our c drive's with the Config variable containing the local path. Now they use "seedsishenlocal3d.dgn" on the network drive.
Timothy Russell said:Our V8i projects were setup with a seed file called "Seed3d" that they put on our c drive's with the Config variable containing the local path
There are a number of MicroStation configuration variables concerning seed files.
The two that are relevant to you are:
MS_SEEDFILES
MS_DESIGNSEED
In a configuration file your CAD admin can write something like this:
MS_SEEDFILES = //NetworkServer/Common Files/MicroStation/Seed Files/ MS_DESIGNSEED = seedsishenlocal3d.dgn
You can write VBA code to get those configuration variable values...
Dim seedFileFolder As String seedFileFolder = ActiveWorkspace.ConfigurationVariableValue("MS_SEEDFILES") Dim defaultSeedFile As String defaultSeedFile = ActiveWorkspace.ConfigurationVariableValue("MS_DESIGNSEED") Dim seedFileName As String seedFileName = seedFileFolder & seedFileName
Now you don't have to hard-wire your seed file name or location into your code.
Regards, Jon Summers LA Solutions