Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: [Connect up.4 NET.API] Modify/Delete cell subelement

$
0
0

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

 

 

 


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>