var api = HpdApi.GetInstance();
api.Init();
var project = api.OpenProject("...");
var wsp = project.GetVariants().FirstOrDefault()?.GetWorkspaces().FirstOrDefault(w => w.Name == "...");
wsp.Open(false, false);
// assume we placed a cable with conductive shield to the workspace before
var end1 = wsp.GetAllOccurrences().OfType<OccWsShieldEnd>().FirstOrDefault();
var end2 = wsp.GetAllOccurrences().OfType<OccWsShieldEnd>().LastOrDefault();
var cn3 = wsp.GetAllOccurrences().FirstOrDefault(o => o.Name == "...");
var pin1 = cn3.Children.OfType<IPinBase>().First();
var specComponent = wsp.GetAllOccurrences().FirstOrDefault(o => o.Name == "...") as IPinBase;
wsp.ConnectShield(end2, specComponent);
wsp.ConnectShield(end1, pin1);
// conductive shield is now connected to a pin and special component
wsp.Save();
wsp.Close();