Already in a file with a workspace/workset, I programmatically create a new file to receive an extract from the current file.
The file is created with Application.CreateDesignFile, and I open it with Application.OpenDesignFileForProgram.
I .Close the file after writing elements to it..
When that new file is opened with Application.OpenDesignFile, it does not have any Workspace or Workset and the usual dialog is presented to the user.
I would like to have the file branded before it opens.
I guess I could prepare branded seed files for every combination of Workspace/Workset and use those when creating my extract file, but I would prefer not to use such a work-around
Lars MP said:I need a way to pre-brand new files by Workspace/Workset
The C++ MicroStationAPI has the IDgnWorkSetInfo interface. It has methods such as SetName(workset-name), SetWorkSpaceName(workspace-name) and Write(dgnFile). I think those would do what you want.
IDgnWorkSetInfo
SetName(workset-name)
SetWorkSpaceName(workspace-name)
Write(dgnFile)
However, it doesn't look like that class has been wrapped by a VBA equivalent, and I don't think there's a way to call into the MicroStationAPI from VBA.
Regards, Jon Summers LA Solutions
Hi Lars,
Lars MP said:I programmatically create
please follow this forum best practices: To specify exactly used product and its version (e.g. build number) is always required, recommended is used standard subject format.
Also, it's not clear whether your VBA is MicroStation VBA code, or external VBA (e.g. running in Excel) and accessing MicroStation using Application object.
Lars MP said:The file is created with Application.CreateDesignFile
Do you only create the file (Open parameter is False)? In such case I am not surprised the workspace/workset data are not stored in the file.
Lars MP said:I would like to have the file branded before it opens.
As Jon wrote, there is IDgnWorkSetInfo in C++ API, similar functionality seems to be also available in NET API, but not in MicroStation VBA.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Jon Summers said:However, it doesn't look like that class has been wrapped by a VBA equivalent, and I don't think there's a way to call into the MicroStationAPI from VBA.
I think (but I have not tried it) pretty anything exported from native dll can be somehow called from VBA. But in my opinion it often requires pretty big amount of detail knowledge, that such person is probably able to write native application and will not waste time with obsolete limited VBA :-)
Regards,
All,
FYI. Adding Artur Goldsweer to this conversation to see if he can confirm these behaviors and file an additional defect related to VBA and worksets besides this unrelated behavior we hope to address in or before Update 16.
Defect 1077281:VBA Projects loaded before the Backstage and opened before a workset is selected executes VBA code in an inactive workset.
HTH,Bob
Hi All,
I have tested to create new dgn files using the method .CreateDesignfile and can confirm, that the resulting new dgn file is branded only, if the used seed file (given as 1st parameter for the method CreateDesignFile) already is branded:This is different to creating new dgn files from Backstage File > New.I have filed Defect # 1098273 to address this issue.Like you mentioned earlier a workaround would be to use branded seed files, the COM object library does not provide methods to add workspace/workset info.
Best regards,Artur
Thank you very much Artur Goldsweer!
Thank you, Arthur
I believe we will use branded seed files for the time being although annoying with about 30 workspaces.
BTW impressed by the fact that you took the time to link the new defect to our company :-)
\Lars M-P