KitchenDraw SDK 2
Show / Hide Table of Contents

Method TryGetFinishTypeByName

TryGetFinishTypeByName(string, out CatalogFinishType)

Tries to get finish type with given name from the finishes config.

Declaration
public bool TryGetFinishTypeByName(string finishTypeName, out Appli.CatalogFinishType finishType)
Parameters
Type Name Description
string finishTypeName
Appli.CatalogFinishType finishType
Returns
Type Description
bool
Examples

The following example shows all the available choices for the "Front colour" finish type of the object after it was placed on a scene:

public bool OnObjectPlaceAfter(int unused)
{
    // Get connection to KitchenDraw
    var appli = new Appli();

    // Get placed object
    Scene.Object placedObject = appli.CallParamsInfo.ActiveObject;

    // Parse object's finishes config string
    var finishesConfig
        = new Scene.FinishesConfig(placedObject,
            placedObject.FinishesConfigString);

    Appli.CatalogFinishType frontColorFinishType;

    // Obtain particular finish type from finishes config
    if (finishesConfig.TryGetFinishTypeByName("Front colour",
        out frontColorFinishType))
    {
        string finishesList
            = string.Join("\r\n", frontColorFinishType.Finishes);

        MessageBox.Show("Available front colours:\r\n" + finishesList);
    }
    else
    {
        // The object doesn't have a "Front colour" finish type.
        // Nothing to do here.
    }

    // Return true to indicate that the plugin execution was ok 
    // and the placement should be proceeded.
    return true;
}
In this article
  • TryGetFinishTypeByName(string, out CatalogFinishType)
Back to top Generated by DocFX