Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Could any of ArcObjects guru tell me, what are these green lines on my Page Layout and what to do, or not to do, so they do not appear? See image attached.

I do used ArcObjects from Python. My script is converting data frame grids and graticules into graphics. As result I receive Group Element from which I need to extract single elements (text, lines etc.) in order to play with them. However, after this operation (which is carried out for 3 separate grids) I receive those mysterious green lines, which are not part of GraphicContainer. Actually, green lines appear only after conversion and extraction from one- graticule (WGS).

There is some guidance here about how to get rid of them, which works (cut and paste or delete and undelete all page elements). However, I would still like to avoid them in the first place. Also, after some configurations of cutting and pasting I figured that green lines do vanish when those 3 image elements (lower right corner) are deleted and restored.

Code suspected to be responsible for this:

pGCL.Reset() #reset graphics containere
pElem = pGCL.Next()
while pElem:
 pEP3 = CType(pElem, esriCarto.IElementProperties3)
 if pEP3.Name == '' and pEP3.Type == 'Group':
  pGE = CType(pElem, esriCarto.IGroupElement3)
  pGE_no = pGE.ElementCount
  for i in range(pGE_no):
   if pGE.ElementCount > 0:
    pGEe = pGE.Element[0]
    pGCL.MoveElementFromGroup(pGE, pGEe, 0)
   else: break
 pElem = pGCL.Next()

I know there is some discussion going on, whether GIS.SE is appropriate place for such technical, software specific questions. I apologize for this, however, I did not found satisfactory answer anywhere else.

Green lines in page Layout

share|improve this question
Great question. For this forum. Does this line print? –  Brad Nesom Apr 14 '13 at 13:35
Suprisingly- no, they do not print. At certain level of zoom out, they may disappear, but after zoom in they are present again. I've been worried, that script did corrupt my .mxd, but after "cut-paste" or "delete-undo" operations mentioned above, they disappear for good. So I assume .mxd is not corrupted. Really, I would like to hear some explenations. –  Tomek Apr 14 '13 at 14:01
Is this reproducible on other workstations? I had a similar issue (although different cause&solution) and I had other workstations that had no issues (and some that did). gis.stackexchange.com/questions/3546/… –  Jay Cummins Apr 14 '13 at 17:21
I tried on 3 workstations with ArcGIS 10 and 10.1. Reproducible. –  Tomek Apr 14 '13 at 17:51
What do you get with Select all elements, Zoom to Selected elements? Does it zoom waaaaay out? I had an image disappear into an always inaccessible spot. I magically (non reproducibly) selected and deleted. –  gm70560 Apr 16 '13 at 20:48

2 Answers 2

up vote 4 down vote accepted

This line looks suspicious to me:

for i in range(pGE_no):

If you remove the i'th element from the group, then increment i the next element isn't really the i+1 element. This might cause confusion.

To overcome this, try looping backwards, start at pGE_no, and decrement i.


Also, since you are looping through all elements in the graphicscontainer, adding a new element to the top level of the container while you are nexting might be another cause of confusion. Instead, perhaps make a list of all grouplements, then loop through the list (instead of the graphicscontainer) calling MoveElementFromGroup . If you have nested groups things get a bit more complicated, you'll need to start with the leaves and prune those back first.

share|improve this answer
I did not check advice from update. Looping backwards didn't change anything. I'll try to loop the list instead graphicscontainer. –  Tomek Apr 15 '13 at 17:00
In deed, adding new element to the container while nexting was the cause. Thanks Kirk. –  Tomek Sep 16 '13 at 6:14
Kirk, any pointers how to extract group from group in the right way (or element form group FROM group)? Everythig is ok with any other element but group element do not want to cooperate. Any clues? –  Tomek Sep 16 '13 at 14:43

It looks similar to guides and rulers.
however it is not possible to make them stop and angled.(ray).


Does the line persist if you switch to data view?
That might tell you if it is something "on" the layout view or in your data.

data view
I have had some anomally that did something similar whan an invalid pair (coordinates) was part of a line feature.
You could try running the repair geomtery on your data to see if that removed it.


share|improve this answer
I tried to repair all geometries there are with no change. Green liness still appear. I do not think that those are releted to guidelines. I can't intereact with them at all, they just appear. –  Tomek Apr 15 '13 at 19:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.