ComfyUI > Nodes > ComfyUI_Lam > 条件选择器

ComfyUI Node: 条件选择器

Class Name

LamSwitcherCase

Category
lam
Author
Lam Yan (Account age: 3065days)
Extension
ComfyUI_Lam
Latest Updated
2025-03-06
Github Stars
0.02K

How to Install ComfyUI_Lam

Install this extension via the ComfyUI Manager by searching for ComfyUI_Lam
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI_Lam in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

条件选择器 Description

Facilitates conditional execution based on switcher value, supports 0-19 cases for dynamic path selection in workflows.

条件选择器:

The LamSwitcherCase node is designed to facilitate conditional execution within a workflow by selecting a specific case to execute based on the value of a switcher. This node is particularly useful when you have multiple potential execution paths and need to dynamically choose one based on certain conditions or inputs. The node supports a range of cases from 0 to 19, allowing for a broad spectrum of conditional logic to be implemented. By leveraging this node, you can streamline complex decision-making processes within your AI art generation workflows, ensuring that the appropriate actions are taken based on the current context or input values.

条件选择器 Input Parameters:

switcher

The switcher parameter determines which case will be executed. It can be an integer, a string, or a list of integers or strings. The value of switcher directly influences the node's behavior by selecting the corresponding case to execute. If the switcher is a list, multiple cases can be executed in sequence. This parameter is crucial for directing the flow of execution and must be set correctly to ensure the desired outcome. There are no explicit minimum or maximum values, but it should correspond to the available cases (0-19).

case0

The case0 parameter represents the first potential execution path. It is a lazy-loaded input, meaning it is only evaluated if selected by the switcher. This parameter allows you to define specific actions or data to be used when switcher is set to 0. It is essential for setting up the initial conditional logic within the node.

case1

The case1 parameter is similar to case0 but corresponds to the second potential execution path. It is also lazy-loaded and is only evaluated if the switcher selects it. This parameter is used to define the actions or data for when switcher is set to 1, providing flexibility in the conditional logic setup.

case2 to case19

These parameters are hidden by default and represent additional execution paths that can be selected by the switcher. Each case is lazy-loaded and only evaluated if chosen. These parameters allow for a wide range of conditional logic, enabling complex decision-making processes within your workflow.

条件选择器 Output Parameters:

?

The output parameter, represented as ?, provides the result of the selected case execution. It returns a tuple containing the result of the chosen case, allowing you to use this output in subsequent nodes or processes. The output is crucial for continuing the workflow based on the conditional logic defined by the switcher.

条件选择器 Usage Tips:

  • Ensure that the switcher value corresponds to a valid case number (0-19) to avoid execution errors.
  • Use lists in the switcher parameter to execute multiple cases in sequence, which can be useful for batch processing or complex workflows.
  • Define clear and distinct actions or data for each case to maximize the node's effectiveness in decision-making processes.

条件选择器 Common Errors and Solutions:

Invalid input type for 'switcher'

  • Explanation: This error occurs when the switcher parameter is not an integer, string, or list of integers/strings.
  • Solution: Ensure that the switcher is set to a valid type, such as an integer, string, or list, and corresponds to the available cases.

Case not found

  • Explanation: This error happens when the switcher value does not match any defined case.
  • Solution: Verify that the switcher value is within the range of defined cases (0-19) and that the corresponding case is properly set up.

条件选择器 Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_Lam
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.