MicroStation .NET: Managing References

  • Products
  • Services
  • All Publications
  • CONNECT Publications
  • Links
  • WishList
  • LA Solutions
  • LA Solutions Home Page
LA Solutions
tel: +44 1398 361 800
DgnPlatformNet

Introduction

This article is for C# developers who want to write an AddIn for MicroStation CONNECT. It is an introduction to the coding required to manage reference attachments in a DGN model.

Be Communities

If you want to ask questions about C# development for MicroStation CONNECT, post your question to the MicroStation Programming Forum.

Reference Manager

A DGN model is a container. It contains graphic elements, such as lines, arcs and shapes, and reference attachments. The Reference Example project shows how to attach and detach a reference. It is implemented in C# using the DgnPlatformNET and MstnPlatformNET APIs.

The class that does most of the work is the ReferenceManager in the downloadable project.

DgnDocumentMoniker

A mystery of the .NET attachment process is that it requires a DgnDocumentMoniker …

DgnDocumentMoniker

The DgnDocumentMoniker is created from a file specification and is required when creating an attachment.

Commands

This MicroStation AddIn has a command table, in file Commands.xml. The command handlers are in class KeyinCommands. You can key-in the commands below in MicroStation's key-in dialog. Commands are not case-sensitive …

Reference Example Command Table
Command Sub Command 1 Sub Command 2 Comment
REFERENCEEXAMPLE HELP VERSION Show the version of this AddIn
REFERENCEEXAMPLE REFERENCE ATTACH Pops a File Open dialog to locate a file to attach. Optionally, pass a logical name for the attachment
REFERENCEEXAMPLE REFERENCE DETACH Pass a logical name to detach

Attachment Logical Name

DGN attachments can be assigned a logical name. This example lets you attach a reference, optionally specifying a logical name for the new attachement. When you invoke the DETACH command, you must provide a logical name, which the code uses to identify the reference to be detached.


Download

Download the Reference Example project

You can download the Reference Example Visual Studio project. The project is built using Visual Studio 2015 and .NET Framework 4.6.2 as required by MicroStation CONNECT.

The project is complete: it includes all source code, the command table XML file, the Visual Studio solution file and is set up to build a DLL. The DLL is placed in your ..\MicroStation\mdlapps folder. It's similar, in that respect, to the .NET examples delivered with the MicroStation CONNECT SDK.

Build the project, which will place file ReferenceExample.DLL in your ..\MicroStation\mdlapps folder. Start MicroStation and open the key-in window (from the Utilities ribbon group). Key-in
mdl load ReferenceExample
You should see a message confirming that the application is loaded. Next key-in the command shown above.

Questions

Post questions about MicroStation programming to the MicroStation Programming Forum.


Bentley Technology Partner

Trademarks

All trademarks are acknowledged. Trademarks may be registered in some jurisdictions.
e-mail Contact LA Solutions using this enquiry form.

Home
Home
Updated on 15-Nov-2021 Copyright © 2021…2025 Jon Summers