unsafe public static CuttingScheme ConvertLayout(_Layout * layout, ParametersCollection parameters, Sheet sheet)
	    {
		    CuttingScheme result = new CuttingScheme();
            result.Sheet = sheet;
            result.Parameters = parameters;
		    CuttingResultBuilder builder = new CuttingResultBuilder();
		    builder.LoadSections(layout, result);
		    return result;
	    }
	unsafe private void Recursive(_Layout * input, Section output)
	{
        CutType cutType = input->along == 0 ? CutType.Vertical : CutType.Horizontal;
		m_result.MakeSureEdgeEven(ref output, cutType);

        for (uint i = 0; i < (uint)input->num_elements; i++)
        {
            if (input->elements[i].type == (int)ElementType.Cut)
                continue;
            else if (input->elements[i].type == (int)ElementType.Remain)
                continue;
            var this_sec = m_result.Cut(output, _GuillotineApi.FromScaled(input->elements[i].size), cutType, out output);
            if (input->elements[i].type == (int)ElementType.Rect)
            {
                m_result.MarkAsPart(this_sec);
            }
            else if (input->elements[i].type == (int)ElementType.SubLayout)
            {
                Recursive(input->elements[i].layout, this_sec);
            }
        }
	}
 unsafe public static extern void free_layout(_Layout * layout);
 unsafe public static extern Int32 new_layout2d(
     _LayoutRect* rects, UInt32 num,
     Scalar sheet_x, Scalar sheet_y, Scalar cut_size,
     _Layout ** result);
	unsafe public void LoadSections(_Layout * input, CuttingScheme output)
	{
		m_result = output;
		Recursive(input, output.RootSection);
	}