We develop a C# application which also interacts with Microstation, eg. by displaying (and reading) simple objects (shapes, text etc). The objects are stored in an sql database. At the moment I have an external (ie. not an Add-in) where the methods are implemented. The methods take such arguments as a list of objects to be displayed and the display parameters (colour, level, line style etc). These objects and display parameters are then transformed in the method into Bentley objects and displayed. Below is a code snippet
using BIM = Bentley.Interop.MicroStationDGN;
//the main method managing display
public void displayOnMap(IEnumerable<IGraphicElement> objectsToDisplay, DisplayParams displayParameters)
{
this.displayParams = displayParameters;
BIM.Level lvl = msHandler.assertLevelExists(displayParameters.levelName); //checks if specifies level exists and if not adds one to MS
elems = new Element[objectsToDisplay.Count()];
for (int i = 0; i < elems.Length; i++)
{
IGraphicElement obiekt = objectsToDisplay.ElementAt(i);
elems[i] = createOneBentleyElement(obiekt);
elems[i].Level = lvl;
elems[i].Color = getCADDisplayColour(displayParameters.CADColourAsInt);
elems[i].LineStyle = msapp.ActiveDesignFile.LineStyles.Find(this.displayParams.lineStyleName);
elems[i].LineWeight = this.displayParams.lineThickness;
i++;
}
msapp.ActiveModelReference.AddElements(ref elems);
}
//----- sample method creating a Bentley ShapeElement
private BIM.ShapeElement createShapeElement(IPolygon polygon, MsdFillMode fillMode)
{
Point3d[] points = new Point3d[polygon.vertices.Length];
for (int i = 0; i < polygon.vertices.Length; i++)
{
Point3d point;
point.X = polygon.vertices[i].X;
point.Y = polygon.vertices[i].Y;
point.Z = polygon.vertices[i].Z;
points[i] = point;
}
BIM.ShapeElement shapeElem = msapp.CreateShapeElement1(null, ref points, fillMode);
return shapeElem;
}
My question is, how can I make this dll an add-in and pass arguments as such to the method?. From what I could find, after making an add-in, the way to run it is through key-ins and they only take string arguments.
Marek