# HELP! Trying to split roomboundary into separate polycurves separated by doors

Here’s what I have so far:

I’m able to get the the room boundary and split it at the doors just fine, but I’m having trouble figuring out how to separate the lists of lines into contiguous lines between doors.
Separately, I’m running into “polycurves may not be branching category” when I try to combine the lines into a polycurve.

Hi Bryan,
Could you share the .rvt file and .dyn file? I will have a look at it later

Why you use the walls and not the “room” elements geometry to get the room boundry?
I think it would be easyer.

That final big code is partly so long as I’m using it to explore different ways of getting to my goal. Here’s the code:

tCv=tCv;

tCc=[Imperative]
{ OUT={};
n=0;

for(i in GetKeys(tCv))
{ OUT[0][i][0][0]=tCv[i].StartPoint.X;
OUT[0][i][0][1]=tCv[i].StartPoint.Y;
OUT[0][i][0][2]=tCv[i].StartPoint.Z;
OUT[0][i][1][0]=tCv[i].EndPoint.X;
OUT[0][i][1][1]=tCv[i].EndPoint.Y;
OUT[0][i][1][2]=tCv[i].EndPoint.Z;

``````  for(j in GetKeys(OUT[0]))
{	OUT[1][i][j][0]=
OUT[0][i][0][0]==OUT[0][j][0][0];
OUT[1][i][j][1]=
OUT[0][i][0][1]==OUT[0][j][0][1];
OUT[1][i][j][2]=
OUT[0][i][0][2]==OUT[0][j][0][2];
OUT[1][i][j][3]=
(i!=j)&&
(OUT[1][i][j][0]&&
(OUT[1][i][j][1]&&
OUT[1][i][j][2]));
};
for(j in GetKeys(OUT[0]))
{	OUT[2][i][j][0]=
OUT[0][i][1][0]==OUT[0][j][1][0];
OUT[2][i][j][1]=
OUT[0][i][1][1]==OUT[0][j][1][1];
OUT[2][i][j][2]=
OUT[0][i][1][2]==OUT[0][j][1][2];
OUT[2][i][j][3]=
(i!=j)&&
(OUT[2][i][j][0]&&
(OUT[2][i][j][1]&&
OUT[2][i][j][2]));
};
for(j in GetKeys(OUT[0]))
{	OUT[3][i][j][0]=
OUT[0][i][0][0]==OUT[0][j][1][0];
OUT[3][i][j][1]=
OUT[0][i][0][1]==OUT[0][j][1][1];
OUT[3][i][j][2]=
OUT[0][i][0][2]==OUT[0][j][1][2];
OUT[3][i][j][3]=
(i!=j)&&
(OUT[3][i][j][0]&&
(OUT[3][i][j][1]&&
OUT[3][i][j][2]));
};
for(j in GetKeys(OUT[0]))
{	OUT[4][i][j]={i,j};
};
for(j in GetKeys(OUT[0]))
{	OUT[5][i][j]=
(OUT[1][i][j][3]||
(OUT[2][i][j][3]||
OUT[3][i][j][3]));
};
for(j in GetKeys(OUT[0]))
{	if(OUT[5][i][j]==true)
{	OUT[6][i][j]={i,j};
};
OUT[7][i][j]=
((OUT[6][i][i][0]||
OUT[6][i][i][1])==
(OUT[6][i][j][0]||
OUT[6][i][j][1]));
};
``````

};
return=OUT;
};

Here’s the .dyn and the .rvt.
Divide Room Boundary by doors.dyn (47.6 KB)
Test_R18.rvt (2.9 MB)