布尔运算#

../../_images/boolean_view.png ../../_images/boolean_block.png

javascript 运行

python 运行

npl 运行

代码#

var main = function(params, context){
    var jih_doc = new jihengine.JiHDocument()
    jih_doc.pushNode("union", '', params['color1'], params['checkbox1'])
    jih_doc.box("union", params['number1'], params['number1'], params['number1'], '#ffc658')
    jih_doc.sphere("difference", params['number2'], '#ffc658')
    jih_doc.popNode()
    context.jih_doc = jih_doc
}

var defaultConfigs = [
    { type: "group", name: 'group1', caption: '布尔运算示例' },
    { type: "number", name: 'number1', caption: '立方体大小', initial: 10 },
    { type: "number", name: 'number2', caption: '球体半径', initial: 6 },
    { type: "checkbox", name: 'checkbox1', caption: '启用布尔运算', initial: true },
    { type: "color", name: 'color1', caption: '颜色', initial: '#589dff' },
]
def main(params, context):

    jih_doc = new jihengine.JiHDocument()
    if True:
        jih_doc.pushNode("union", '', params['color1'], params['checkbox1'])
        jih_doc.box("union", params['number1'], params['number1'], params['number1'], '#ffc658')
        jih_doc.sphere("difference", params['number2'], '#ffc658')
        jih_doc.popNode()
    context.jih_doc = jih_doc


defaultConfigs = [
    { type: "group", name: 'group1', caption: '布尔运算示例' },
    { type: "number", name: 'number1', caption: '立方体大小', initial: 10 },
    { type: "number", name: 'number2', caption: '球体半径', initial: 6 },
    { type: "checkbox", name: 'checkbox1', caption: '启用布尔运算', initial: True },
    { type: "color", name: 'color1', caption: '颜色', initial: '#589dff' },
]
local main = function(params, context)
    local jih_doc = JiHDocument:new()
    jih_doc:pushNode("union", '', params['color1'], params['checkbox1'])
    jih_doc:box("union", params['number1'], params['number1'], params['number1'], '#ffc658')
    jih_doc:sphere("difference", params['number2'], '#ffc658')
    jih_doc:popNode()
    context.jih_doc = jih_doc
end

local defaultConfigs = {
    { type = "group", name = 'group1', caption = '布尔运算示例' },
    { type = "number", name = 'number1', caption = '立方体大小', initial = 10 },
    { type = "number", name = 'number2', caption = '球体半径', initial = 6 },
    { type = "checkbox", name = 'checkbox1', caption = '启用布尔运算', initial = true },
    { type = "color", name = 'color1', caption = '颜色', initial = '#589dff' },
}