// Open project
Project project = api.OpenProject(@"d:\MyProject.hxproj");
// Select and open variant
Variant variant = project.GetVariants()[0];
variant.Open(false, false);
// Select nailboard and open it.
Drawing2D drawing = variant.GetNailboards().FirstOrDefault(d => d.Name == "WH_1");
drawing.Open(false, false);
// Select a connectable object (connector, terminal, signal device etc.) excluding a ribbon connector.
BaseNbConnectableObject co = drawing.GetAllOccurrences().OfType<BaseNbConnectableObject>().FirstOrDefault(c => c.Name == "cn_00002");
// Select its fan point. It can have more than one.
IFanPoint cp = co.FanPoints.FirstOrDefault(c => c.Name == "cp_00004");
// Select its 2D view.
LibPart2DViewInfo libPartView = cp.LibraryPart.Views.FirstOrDefault(v => v.Id == "2D1");
// Prepare its position.
Transform2DProperty<LengthProperty> symbolPosition = new Transform2DProperty<LengthProperty>("13.2 mm", "-5.6 mm");
// Place the symbol.
I2DSymbol symbol = drawing.PlaceConnectableObjectSymbol(cp as BaseOccurrence, co, symbolPosition, libPartView);
// Select ribbon or inline ribbon connector.
BaseNbConnectableObject ribbonCon = drawing.GetAllOccurrences().OfType<BaseNbConnectableObject>().FirstOrDefault(c => c.Name == "cn_00004");
// Get its control point.
IOccNbRibbonConnectorPoint ribbonCp = ribbonCon.Children.OfType<IOccNbRibbonConnectorPoint>().FirstOrDefault();
// Select ID of 2D symbol or use default if one is present only.
LibPart2DViewInfo ribbonView = co.LibraryPart.Views.FirstOrDefault();
// Prepare its position.
symbolPosition = new Transform2DProperty<LengthProperty>("13.2 mm", "-5.6 mm");
// Place the symbol.
I2DSymbol ribbonSymbol = drawing.PlaceConnectableObjectSymbol(ribbonCon as BaseOccurrence, ribbonCon, symbolPosition, ribbonView);
// Save and close project.
drawing.Save();
drawing.Close();
variant.Close();
project.Close();