AnsweredAssumed Answered

SubGroup Issue

Question asked by AdamDavis on Feb 7, 2020
Latest reply on Sep 18, 2020 by jbarrette-esristaff

If I create a group at the layout level and then create elements in that group then all OK.

When creating a named group within a group - elements are not correctly placed in the named group - they are placed directly on the layout instead. If I don't set the name then all OK.

Layout layout = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault()?.GetLayout();
            GroupElement groupElement = LayoutElementFactory.Instance.CreateGroupElement(layout);
            CIMElement cimGroupElement = groupElement.GetDefinition();
            cimGroupElement.Name = "First Level Group";
            groupElement.SetDefinition(cimGroupElement);
            GroupElement groupElement2 = LayoutElementFactory.Instance.CreateGroupElement(groupElement);
            CIMElement cimGroupElement2 = groupElement2.GetDefinition();
            cimGroupElement2.Name = "Second Level Group";
            groupElement2.SetDefinition(cimGroupElement2);

            for (int i = 0; i < 100; i++)
            {
                List<Coordinate2D> lineCoordinates = new List<Coordinate2D> { new Coordinate2D { X = i, Y = 0 }, new Coordinate2D { X = i, Y = 100 } };
                Polyline polylineTic = PolylineBuilder.CreatePolyline(lineCoordinates);
                CIMLineSymbol lineSym = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlackRGB, 1.0, SimpleLineStyle.Solid);
                GraphicElement lineElm = LayoutElementFactory.Instance.CreateLineGraphicElement(groupElement2, polylineTic, lineSym);
                CIMElement cimElement = lineElm.GetDefinition();
                cimElement.Name = "Line" + i;
                lineElm.SetDefinition(cimElement);
            }

 

Adam

Outcomes