KitchenDraw SDK 2
Show / Hide Table of Contents

Property Textures

Textures

Gets the list of textures that are set for the object via the "Object|Attributes" dialog.

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

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

A texture discription is returned as the character string in the following format: RGB,S;RGB,O, for example 157125089,10205;157125089,@1, where R defines amount of red (000-255), G defines amount of green (000-255), B defines amount of blue (000-255). S and O hold special value determining the type of texture used for filling or outlining respectively. The values @1-@9 are special values that mean Full, Invisible, ===, |||, ///, \\\, +++, xxx, and Transparent respectively. Other values are just texture codes either from Textures Standard or from Texture Palette catalogs.

You can use Scene.Object.Texture class to parse this character string and access individual elements from it.

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