KitchenDraw SDK 2
Show / Hide Table of Contents

Property ModelFinishCodes

ModelFinishCodes

Gets the list of model finish codes that are set for the object via the "Object|Finishes" dialog.

Declaration
public IList<string> ModelFinishCodes { get; }
Property Value
Type Description
IList<string>
Remarks

The list is always returned with 16 elements, although in reality, it will likely contain fewer finish codes. Empty strings indicate absent elements in that case.

Examples

The following example shows how to display the object's finishes information.

public void PrintObjectFinishesToConsole(Scene.Object obj)
{
    // Object's model code and model name
    Console.WriteLine(string.Format("Front model = ({0}) {1}",
        obj.ModelCode, obj.ModelName));

    Console.WriteLine();

    // Object's front model finishes
    for (int i = 0; i < obj.ModelFinishTypes.Count; i++)
    {
        // ModelFInishTypes, ModelFinishCodes and ModelFinishNames are
        // guaranteed to have the same Count.

        // ModelFinishTypes.Count returns maximum available model
        // finish types count. An object can have less available
        // choices. In the case, empty strings are returned for
        // rest the indexes.
        if (string.IsNullOrEmpty(obj.ModelFinishTypes[i]))
        {
            break; // No more available finish types for the object.
        }

        Console.WriteLine(string.Format("{0} = ({1}) {2}",
            obj.ModelFinishTypes[i],
            obj.ModelFinishCodes[i], obj.ModelFinishNames[i]));
    }

    Console.WriteLine();

    // Object's family finishes
    for (int i = 0; i < obj.FamilyFinishTypes.Count; i++)
    {
        // FamilyFinishTypes, FamilyFinishCodes and FamilyFinishNames
        // are guaranteed to have the same Count.

        if (string.IsNullOrEmpty(obj.FamilyFinishTypes[i]))
        {
            break; // No more available finish types for the object.
        }

        Console.WriteLine(string.Format("{0} = ({1}) {2}",
            obj.FamilyFinishTypes[i],
            obj.FamilyFinishCodes[i], obj.FamilyFinishNames[i]));
    }

    Console.WriteLine();

    // Object's configurable textures
    for(int i = 0; i < obj.Textures.Count; i++)
    {
        // Textures list contains empty string for slots that are not
        // configurable for the object. There are cases when for
        // example the slot 1 is not configurable, while the slot 2 is.
        // For this reason, an empty entries should be skipped without
        // breaking the cycle.
        if (string.IsNullOrEmpty(obj.Textures[i]))
        {
            continue; // This texture slot is not configurable for the object.
        }

        // Texture object allows to access indiviual aspects of a
        // texture.
        var texture = new Scene.Object.Texture(obj.Textures[i]);

        Console.WriteLine(string.Format("Texture{0} = fill({1},{2},{3}}", i,
            texture.Fill.Color.R, texture.Fill.Color.G, texture.Fill.Color.B));
    }
}

// -----------------------------------------------------
// The output is:
// -----------------------------------------------------
// Front model = (08) Wood frame and lacquered panel
//
// Front colour = (HB) beech / blue
// Carcase colour = (HE) beech
// Handles = (H2) H2
//
// Drawers colour = (WT) white
//
// Texture1 = 255,15,30
// -----------------------------------------------------
In this article
Back to top Generated by DocFX