Hi,
Thank you all for nice discussion. I have managed to remove sub-element from cell both ways, with InterOp and with out it.
I did everything right when using DGNPlatformNET except one crucial thing and then was disposing ElementCopyContext after using it
Documentation is clear about this and I read it but for some reason forgot to use it.
This works fine:
IList<Element> list = new List<Element>(); ElementCopyContext copier = new ElementCopyContext(Session.Instance.GetActiveDgnModelRef()); copier.WriteElements = false; copier.DisableAnnotationScaling = true; for (int i = 0; i < oComponents.Count(); i++) { if (oComponents.ElementAt(i).ElementId == element.ElementId) continue; Element newE = copier.DoCopy(oComponents.ElementAt(i)); list.Add(newE); } copier.Dispose(); DPoint3d origin; cell.GetTransformOrigin(out origin); CellHeaderElement newCell = new CellHeaderElement(Session.Instance.GetActiveDgnModel(), "cell", origin, DMatrix3d.Identity, list); newCell.ReplaceInModel(cell);
best regards
Nenad