From 976d5d386adb5d3c42a0c76796fe3772c18c80c2 Mon Sep 17 00:00:00 2001 From: Alan Smith Date: Thu, 3 Jul 2025 06:58:16 -0400 Subject: [PATCH 1/2] Robot now shows ports for a component --- src/toolbox/hardware_category.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/toolbox/hardware_category.ts b/src/toolbox/hardware_category.ts index bfe4c538..07f51e31 100644 --- a/src/toolbox/hardware_category.ts +++ b/src/toolbox/hardware_category.ts @@ -49,12 +49,12 @@ export function getHardwareCategory(currentModule: commonStorage.Module) { name: 'Hardware', contents: [ getRobotMechanismsBlocks(currentModule), - getComponentsBlocks(currentModule), + getComponentsBlocks(currentModule, false), ] }; } if (currentModule.moduleType === commonStorage.MODULE_TYPE_MECHANISM) { - return getComponentsBlocks(currentModule); + return getComponentsBlocks(currentModule, true); } // Return default empty category if module type doesn't match return { @@ -239,14 +239,14 @@ function getRobotMethodsBlocks(currentModule: commonStorage.Module) { }; } -function getComponentsBlocks(currentModule: commonStorage.Module) { +function getComponentsBlocks(currentModule: commonStorage.Module, hideParams : boolean) { const contents = []; // Add the "+ Component" category contents.push({ kind: 'category', name: '+ Component', - contents: getAllPossibleComponents(true) + contents: getAllPossibleComponents(hideParams) }); // Get components from the current workspace From 0c16e320b80e87214d798143d4eb08817831258d Mon Sep 17 00:00:00 2001 From: Alan Smith Date: Thu, 3 Jul 2025 18:06:25 -0400 Subject: [PATCH 2/2] Add a comment to getComponentsBlocks --- src/toolbox/hardware_category.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/toolbox/hardware_category.ts b/src/toolbox/hardware_category.ts index 07f51e31..1bc0f62e 100644 --- a/src/toolbox/hardware_category.ts +++ b/src/toolbox/hardware_category.ts @@ -239,6 +239,8 @@ function getRobotMethodsBlocks(currentModule: commonStorage.Module) { }; } +// This is called when the user is editing a mechanism or the robot and allows +// the user to add a component or use an existing component. function getComponentsBlocks(currentModule: commonStorage.Module, hideParams : boolean) { const contents = [];