I would like to write a tool which is similar to place smart line which has endless points to click unless you click rest or close element. In place smart line tool, you can use Ctrl + Z and then continue with your existing location. However, when you are in IPrimitive Event, using Ctrl + Z will directly interrupt it and the IPrimitive Event will no longer workable. Any examples / measures to solve this? Moreover, in CONNECT Edition, I see this problem is still existing.
Hi,
Unknown said:I would like to write a tool which is similar to place smart line
COM API used in V8i for managed code has plenty of limitations, not only the discussed one. Some features used by MicroStation tools require native C/C++ code.
Unknown said:However, when you are in IPrimitive Event, using Ctrl + Z will directly interrupt it and the IPrimitive Event will no longer workable.
What you can try is to register key event handler using Bentley.Interop.MicroStationDGN.Application.AddWindowsKeyMessageEventsHandler method and to try to handle (block) the key event (Ctrl+Z), so it will be consumed by your addin and not by MicroStation. I am not sure if it will work, maybe MicroStation handles the key before it's passed to addin, but it's the simplest way I know how to consume key events in IPrimitiveCommandEvent code.
Unknown said: Moreover, in CONNECT Edition, I see this problem is still existing.
I guess it's more VBA API feature than the bug, because it's how VBA API was designed. In addition to that, in COM API is not treated anymore as the primary managed API and is replaced by DgnPlatformNet. Using this new API, you can implement DgnPrimitiveTool that offers OnUndoPreviousStep, which I guess is the way how to handle undo steps inside own tool. You can see e.g. ManagedToolsExample delivered with MicroStation SDK CONNECT Edition.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: clever_anthony
Thank you very much. I will try it.
And here are the useful keyin references linked for readers:
1. IPrimitiveCommandEvents_Keyin
2. Keyin-Event on IPrimitiveCommandEvents
3. [CONNECT C# Addin] Detect key press inside Dynamic input