Problem with addPrimitive with a GeomLines object

Hi,
I am new to Panda3D and have hit a puzzle trying to add lines to my geom. I get this assertion error

AssertionError: cdata->_primitive_type == PT_none || cdata->_primitive_type == primitive->get_primitive_type() at line 375 of c:\buildslave\release_sdk_win32\build\panda3d\panda\src\gobj\geom.cxx

even though similar code with triangles works fine.

Any advice gratefully received,

John

The triangles below are created fine but the lines generate the error

	format=GeomVertexFormat.getV3n3cpt2()
	vdata=GeomVertexData('square', format, Geom.UHDynamic)

<< various lines removed that define vertices, Tris, Lines etc >>

	room = Geom( vdata )
	for T in Tris :
		tri=GeomTriangles(Geom.UHDynamic)
		tri.addVertex(T[0])
		tri.addVertex(T[1])
		tri.addVertex(T[2])
		tri.closePrimitive()
		room.addPrimitive( tri )

	for L in Lines :
		line = GeomLines(Geom.UHDynamic)
		line.addVertex( L[0] )
		line.addVertex( L[1] )
		line.closePrimitive()
		room.addPrimitive( line  ) # FAILS with assert error

Worked it out.
I have to create a new Geom and add the lines to it as you cannot mix primitives in one Geom.