Closed asmwarrior closed 5 years ago
This is a bug in the latest git head which cause endless loop when drawing closed polyline:
bool CPolyLine::getDraw( s_dxf_draw& draw )
{
if( 0 > draw.index || draw.index == (int)m_VertexCount )
return false;
if( draw.index == (int)m_VertexCount )
return false;
if( draw.index == (int)m_VertexCount-1 )
{
if( ! myfClosed )
{
return false;
}
else
{
draw.x1 = x[draw.index];
draw.y1 = y[draw.index];
draw.x2 = x[0];
draw.y2 = y[0];
}
}
else
{
draw.x1 = x[draw.index];
draw.y1 = y[draw.index];
draw.index++;
draw.x2 = x[draw.index];
draw.y2 = y[draw.index];
}
draw.rect->ApplyScale( draw.x1, draw.y1 );
draw.rect->ApplyScale( draw.x2, draw.y2 );
return true;
}
I think the index should be increased in this brace:
{
draw.x1 = x[draw.index];
draw.y1 = y[draw.index];
draw.x2 = x[0];
draw.y2 = y[0];
}
Fixed. ( I would assign the issue back to you for testing, but you forgot to assign it to me. )
It works OK now, so I think this issue can be closed, thanks!
Hi, I see currently, the code does not draw closed polyline. For a reference, POLYLINE (DXF) | Search | Autodesk Knowledge Network, which says that for a default polyline, the group code 70 = 0, while for group code 70 = 1, we can simply connect the first point and last point, thus make a closed polyline.
This code may be updated with some if condition for the m_PolyLineFlag field check.
Thanks.