im trying to scale all elements within a model about 0,0,0 point.
then i run it, it scales most of the elements. I put a try catch with in the element loop to see what elements it was failing to transform. and it was always either a Grouped Hole element or a Smart Solid/Surface element. all listed as a CellHeader type. how should i handle transforming these elements? my example code is below.
ModelElementsCollection graphicalElements = curModel.GetGraphicElements();
foreach (Bentley.DgnPlatformNET.Elements.Element curElement in graphicalElements)
DTransform3d dTransform3D = DTransform3d.Scale(newScale);
Bentley.DgnPlatformNET.TransformInfo transformInfo = new TransformInfo(dTransform3D);
catch (Exception e)
Exception error = e;
EDIT: forgot to put what the error is:
John Drsek said:and it was always either a Grouped Hole element or a Smart Solid/Surface element. all listed as a CellHeader type
In API, neither Groupe Holes nor SmartSolid elements, are not cells!
Yes, they are stored in DGN file as "special" cell elements, but it's technical detail, because API abstraction understand these objects not as cells (because in underlying native API, every "MicroStation element" has own ElementHandler).
John Drsek said:what elements it was failing to transform.
I see the same issue with SmartSolid (BrepCellHeaderElement class), but GroupedHole (GroupedHoleElement class) is scaled fine.
John Drsek said:how should i handle transforming these elements?
I do not know why specifically SmartSolid raises this exception, but you can use this workaround:
DgnModel model = Session.Instance.GetActiveDgnModel();
ModelElementsCollection elements = model.GetGraphicElements();
DTransform3d scale = DTransform3d.Scale(scaleValue);
TransformInfo tInfo = new TransformInfo(scale);
foreach (Element element in elements)
using (Element original = model.FindElementById(element.ElementId))
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: John Drsek
thanks that did the trick!