是否可以根据参数隐藏参数组?

时间:2021-03-03 09:36:51

标签: roomle

我希望能够根据设置的参数隐藏某个参数组选项。我正在尝试制作一种高级模式,所以当我将一个参数设置为启用高级模式为 True 时,这会显示在其中一个选项上,例如...

"parameterGroups": [
    {
        "key": "grpOptions",
        "labels": {
            "en": "Options"
        },
        "collapsed": false,
        "sort": 20
    },
    {
        "key": "advOptions",
        "labels": {
            "en": "Advanced Options"
        },
        "collapsed": false,
        "visible":"(company=='BetatTest')",
        "sort": 10
    }
],
"parameters": [
    {
        "key": "advancedMode",
        "enabled": true,
        "visibleAsGlobal": true,
        "group": "advOptions",
        "visible":"(company=='BetaTest')",
        "global":true,
        "type": "String",
          "labels": {
            "en": "Advanced Settings?"
        },
        "defaultValue":"No",
        "validValues": [
            "No",
            "Yes"
       ]
    },

1 个答案:

答案 0 :(得分:1)

遗憾的是 ParameterGroup 不提供可见的属性。 https://docs.roomle.com/scripting/resources/model/configurator/ConfigurationFormat.html#json-objects



这源于这样一个前提,即某个 ParameterGroup 仅在分配给它的至少一个参数可见时才可见。

这是一个小例子:http://rml.co/UbSJ

{
"id": "isdt:advanced_mode_group_invisible_example",
"parameterGroups": [
    {
        "key": "grpOptions",
        "labels": {
            "en": "Options"
        },
        "collapsed": false,
        "sort": 20
    },
    {
        "key": "advOptions",
        "labels": {
            "en": "Advanced Options"
        },
        "collapsed": false,
        "sort": 10
    }
],
"parameters": [
    {
        "key": "company",
        "enabled": true,
        "visibleAsGlobal": true,
        "group": "grpOptions",
        "visible": true,
        "global": true,
        "type": "String",
        "labels": {
            "en": "Test Mode?"
        },
        "defaultValue": "AlphaTest",
        "validValues": [
            "AlphaTest",
            "BetaTest"
        ]
    },
    {
        "key": "advancedMode",
        "enabled": true,
        "visibleAsGlobal": "(company == 'BetaTest')",
        "group": "grpOptions",
        "visible": "(company == 'BetaTest')",
        "global": true,
        "type": "String",
        "labels": {
            "en": "Advanced Settings?"
        },
        "defaultValue": "No",
        "validValues": [
            "No",
            "Yes"
        ]
    },
    {
        "key": "fancyAdvancedOption1",
        "enabled": true,
        "visibleAsGlobal": "(advancedMode == 'Yes' && company == 'BetaTest')",
        "group": "advOptions",
        "visible": "(advancedMode == 'Yes')",
        "global": true,
        "type": "Integer",
        "labels": {
            "en": "Fancy advances option 1"
        },
        "defaultValue": 1,
        "valueObjects": [
            {
                "value": 1,
                "labels": {
                    "en": "Fancy Option 1"
                }
            },
            {
                "value": 2,
                "labels": {
                    "en": "Fancy Option 2"
                },
                "condition": ""
            }
        ]
    },
    {
        "key": "fancyAdvancedOption2",
        "enabled": true,
        "visibleAsGlobal": "(advancedMode == 'Yes' && company == 'BetaTest')",
        "group": "advOptions",
        "visible": "(advancedMode == 'Yes')",
        "global": true,
        "type": "Integer",
        "labels": {
            "en": "Fancy advances option 2"
        },
        "defaultValue": 1,
        "valueObjects": [
            {
                "value": 1,
                "labels": {
                    "en": "Fancy Option 1"
                }
            },
            {
                "value": 2,
                "labels": {
                    "en": "Fancy Option 2"
                },
                "condition": ""
            }
        ]
    }
],
"subComponents": [],
"geometry": "
    BeginObjGroup('coordinates');

        BeginObjGroup('X');
            Cylinder(5, 5, 1000, 100, 100, 100);
             RotateMatrixBy(Vector3f{0, 1, 0}, Vector3f{0, 0, 0}, 90);
        EndObjGroup();
         SetObjSurface('fantoni_1:AS19');

        BeginObjGroup('Y');
            Cylinder(5, 5, 1000, 100, 100, 100);
             RotateMatrixBy(Vector3f{1, 0, 0}, Vector3f{0, 0, 0}, -90);
        EndObjGroup();
         SetObjSurface('fantoni_1:C649');

        BeginObjGroup('Z');
            Cylinder(5, 5, 1000, 100, 100, 100);
             RotateMatrixBy(Vector3f{0, 0, 1}, Vector3f{0, 0, 0}, 90);
        EndObjGroup();
         SetObjSurface('fantoni_1:C669');

        Cube(Vector3f{100, 100, 100});

    EndObjGroup();
",
"parentDockings": {
    "points": [],
    "ranges": [],
    "lines": [],
    "lineRanges": []
},
"childDockings": {
    "points": []
},
"siblings": [],
"articleNr": "",
"pricing": [],
"validChildren": []

}