MicroStation V8 default behavior is to save changes to the file w/o need to use File > Save.
Knowing each element is saved dynamically your VBA code can use the IChangeTrackEvents interface (see example code in help file) to react to each element at the time of it being saved. Your code should quickly try to filter out any element types, properties, or conditions you are not interested in to minimize any impact on performance. If IChangeTrackEvents does not help, you may want to let us know what condition you are specifically concerned about monitoring (maybe why) that you want your code to react to.
HTH,
Bob
RE: Run Code each time when Save Command is triggered
RE: Run Code each time when Save Command is triggered
Hi Robert,
thanks for your idea!
Your suggestion makes clear that my description was not very good ...
We are using Speedikon Architecture together with Microstation (for some users we use PowerDraft instead of Microstation - but I think that this should not make a difference here).
[quote user="Robert Hook"]Knowing each element is saved dynamically ...[/quote]
This is correct - but only for Microstation elements, not for Speedikon Objects. If you do some drawings with Speedikon & Microstation (ie. place Speedikon Objects and some Microstation elements like line elements), exit the drawing without saving the changes and open it again you will see that the Microstation things are still here while the Speedikon Objects are missing.
Therefore our users are told to save when they are leaving a drawing (unless they do want to discard their changes to the Speedikon model).
My Code should be triggered each time a user clicks "file > save" or leaves the drawing and clicks "Yes" when the question to save the changes appears.
I hope that this makes my intention clearer!
RE: Run Code each time when Save Command is triggered
[quote user="quasi_modo"]We are using Speedikon Architecture together with MicroStation (for some users we use PowerDraft instead of MicroStation - but I think that this should not make a difference here).[/quote]
Unfortunately it will make a difference. Jan's analysis is correct: you can't do what you want with VBA but it's easy to implement with MDL. However, a native-code MDL application won't run on a Power platform without a special key. The key must be obtained from Bentley Systems to enable the MDL app. to work with PowerDraft.
[quote user="quasi_modo"]Exit the drawing without saving the changes and open it again you will see that the Microstation things are still here while the Speedikon Objects are missing[/quote]
Speedikon must be doing something unusual for their graphic elements not to be made a permanent part of the DGN file. A long-term solution would be to persuade Speedikon to follow MicroStation's idiom of saving all graphic elements automatically.
RE: Run Code each time when Save Command is triggered
At this time I am not familiar with Speedikon (product and code) to be able to provide an indication of what is available. At a higher and more common level I can make 2 suggestions.
1. Try recording a MicroStation VBA macro to see if it can trap Speedikon's File Save dialog. Recording the macro has the potential of providing you with template code you may be able to use/reuse to resolve your file save concern. The recorded macro may provide you with stub code showing how to create event interests in MicroStation-based (MicroStation and other MDL in-process application) dialog box open events and taking action on those dialog boxes based on their title bar text. If Speedikon File Save functionality is implemented via an in-process MDL application this may help of the dialog text (and active command) is unique enough to react to.
2. Whether #1 is of help (and even if not), I agree with Jon's statement that you should consider placing an enhancement request with Speedikon's support group to provide a configuration option that allows users/administrators to override the current default behavior requiring users (in all cases) to manually save Speedikon objects having the option to override that behavior.
[quote user="Jon Summers"] A long-term solution would be to persuade Speedikon to follow MicroStation's idiom of saving all graphic elements automatically.[/quote]
HTH,
Bob
RE: re: CONNECT SDK & Windows 10
[quote user="Alan Orchard"]Has anybody had any success in comping any of the CONNECT SDK examples inside a Windows 10 environment?[/quote]
What is not working on Windows 10? When you attempt to build the SDK examples from the SDK build shell, what messages do you see?
RE: Automation Error with TAG.Value when reading from Excel
Automation Error with TAG.Value when reading from Excel
I am writing an application to read MS tags from excel, something I have done many many times over the years but I get the following error message when obtaining the value of the tag - Run-time error '-2147417847(80010108) Automation error, The object invoked has disconnected from its clients.
before I extract the Tag.value I have found, via the watch utility (screen shot provided), that the tag.value has an 'automation error'. I have read that there maybe an issue with MS variant and newer versions of office. I am using Office365 and MS SS3 Version 08.11.09.292.
RE: [CONNECT C++] empty TextBlock
[quote user="Zhen Li"]I tried to create a text element. I got a return value which says"it did not have the force text node flag".[/quote]
If you look in header file ...\SDK\include\DgnPlatform\TextBlock\TextAPICommon.h you can read the comment about #define TEXTBLOCK_TO_ELEMENT_RESULT_Empty: An element was not created because an empty TextBlock was provided (and it did not have the force text node flag).
Perhaps your TextBlock is empty?
RE: [CONNECT C++] empty TextBlock
Hi,
it´s difficult to answer without knowing how textBlock is defined in your example.
Here is a small example to create an empty textnode. The underlying textBlock here contains just a Linebreak:
DPoint3dCR point = { 0, 0, 0 }; DgnModelP model = ISessionMgr::GetActiveDgnModelP(); TextBlockPropertiesPtr tbProps = TextBlockProperties::Create(*model); ParagraphPropertiesPtr paraProps = ParagraphProperties::Create(*model); RunPropertiesPtr runProps = RunProperties::Create(*DgnTextStyle::GetActive(), *model); TextBlockPtr textBlock = TextBlock::Create(*tbProps, *paraProps, *runProps, *model); textBlock->SetProperties(*tbProps); textBlock->SetUserOrigin(point); textBlock->AppendLineBreak(); EditElementHandle textElm; if (TEXTBLOCK_TO_ELEMENT_RESULT_Success == TextHandlerBase::CreateElement(textElm, NULL, *textBlock)) { textElm.AddToModel(); }
I hope this example helps?
Best regards,
Artur
RE: [CONNECT C++] empty TextBlock
[quote user="Artur Goldsweer"]if (TEXTBLOCK_TO_ELEMENT_RESULT_Success != TextHandlerBase::CreateElement(...))[/quote]
Typo?
RE: [CONNECT C++] empty TextBlock
It´s corrected now
RE: re: CONNECT SDK & Windows 10
MicroStation CONNECT Edition is certified for Windows 10, so there is no reason to expect SDK will not work in Windows 10.
As Jon wrote, without knowing what problem do you have (error message etc.) and MicroStation SDK version (original one or Update 2) it's hard to provide any advice.
With regards,
Jan
RE: Drop Element
I assume there is no such option, but to be sure you have to specify what language/API do you use and in what MicroStation version.
With regards,
Jan
RE: Drop Element
You can set the option using VBA
SetCExpressionValue("dropOptions.strings",-1,"DROP")
or using the BASIC editor
' Set a variable associated with a dialog box
MbeSetAppVariable "DROP", "dropOptions.strings", -1&
I did not try this, but it should work. Also, I am sure there is something available in MDL but I do not know if off the top of my head
RE: Drop Element
[quote user="Maury"]SetCExpressionValue("dropOptions.strings",-1,"DROP")
I am sure there is something available in MDL...[/quote]
VBA SetCExpressionValue is a wrapper around MDL's mdlCExpression_api. Probably mdlCExpression_setValueForApp would do the trick.
Many of MicroStation's settings are published in the header files, so you can twiddle the bits directly using MDL. However, an increasing number of commands is implemented as separate apps. where the header files are not published. Our recourse is to do as you advise: record a VBA macro and translate the result into MDL.
Drop Element
When selecting the 'Drop Element' command in a MicroStation session, the tool settings box offers a selection of element types for the command to operate on. By default, complex and shared cells are selected. To issue this command programmatically is not an issue, but I would like to also change the default selection types (Include linestrings & shapes). Is there structure available to set these selections automatically before issuing the command??
LMD
RE: [CONNECT C++] mdlTag_freeValue not in library files
[quote user="Frode Tørresdal"]I would rather not have any memory leakage[/quote]
Me neither! I notice that there is a tag value class DgnTagValue, declared in header DgnPlatform.r.h. That class is richer than the TagValue struct in V8i, as it includes methods as well as data.
There is method DgnTagValue.ClearCurrentValue(). Help tells us that it 'clears the current value'. That could mean that it frees string and binary memory. But it would be nice to know for sure. If so, that would make mdlTag_freeValue redundant.
mdlTag_create and mdlTag_extract both take a DgnTagValueP rather than a TagValue*.
RE: [CONNECT C++] mdlTag_freeValue not in library files
For migration purposes this case is (hinted and) handled in: ..\MigrationTools\0811to1000Published.remap:340:\bAttrValue\b!DgnTagValue
The MDL C API has been internally converted to use the new DgnTag classes and as Jon suggests; mdlTag free functions are redundant and not necessary when migrating MDL C API code, but prefer to use the MDL C++ APIs whenever possible.
The defect Artur filed and referenced above will make sure to remove unnecessary existing library and header references, and make mention there is no need to free in the mdlTag create documentation.
HTH,
Bob
[CONNECT C++] mdlTag_freeValue not in library files
Hi
I have som old code that I try to compile on MicroStation CONNECT Edition. This code uses the mdlTag_freeValue function. But I cannot find this function in the library files. Is this missing from the library or am I missing something obvious here?
regards
Frode Tørresdal
RE: re: CONNECT SDK & Windows 10
On my new Xeon workstation, I put Windows 10 Pro [10.0.14393], MicroStation CONNECT 10.02.00.39, MicroStation SDK CONNECT 10.02.00.39 and Visual Studio 2013 ultimate on a different drive [D:] to the Operating System. I thought I followed the Bentley distractions.
I then tried to compile one of the samples BasicDialogBox.
Error: Dependence not found line 48 BasicDialogBox.mki
$(genSrc)basiccmd.h : $(BaseDir)basiccmd.r
You both have answered my question, it must be me.
Between posting my question and this reply, that computer has been re-built without CONNECT or any Bentley SDK’s. It just has ss4.
As my life has now been taken over with more pressing family issues. The issue is over for me and if I can, I will delete my post, a thank you very much for your time.