We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

puzzle vs. runcode()

Home Forums Puzzles puzzle vs. runcode()

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #32627
    derekwang0605
    Customer

    Suppose I will add several buttons to call the collections in the scene.
    puzzle vs. runcode()
    Can puzzle and runcode() realize the same programming functions?

    #32628

    Yes, under the hood the Puzzles are converted to JavaScript.

    You can read more about it here: https://www.soft8soft.com/docs/manual/en/introduction/Using-JavaScript.html

    Chief 3D Verger | LinkedIn | Twitter

    #32644
    derekwang0605
    Customer

    Thanks! Where to add ‘exec script’ after setting variables and procedures? Can not find this option in puzzles.
    It is a big house and I have 120 collections whose names categorized with ‘AXXX’,’DXXX’,’FXXX’,’TXXX’. I want to add four buttons ‘A’/’D’/’F’/’T’ to show or hide the corresponding collections. Can this be done by puzzle?

    #32654

    Hi!

    The exec script puzzle comes with version 3.4 which is currently available as preview from the downloads page.

    to show or hide the corresponding collections

    sure, you can use the group selector and the regular hide/show puzzles.

    Chief 3D Verger | LinkedIn | Twitter

    #32655
    derekwang0605
    Customer

    Thanks for that! Also how to add button and listener in runCode(). Any examples available?

    #32663

    Hi,

    you can create buttons as HTML elements or as 3D objects.

    For creating HTML buttons please take a look at this tutorial:

    Chief 3D Verger | LinkedIn | Twitter

    #32708
    derekwang0605
    Customer

    // utility function envoked by almost all V3D-specific puzzles
    // retrieve all objects on the scene
    function getAllObjectNames() {
    var objNameList = [];
    appInstance.scene.traverse(function(obj) {
    if (notIgnoredObj(obj))
    objNameList.push(obj.name)
    });
    return objNameList;
    }
    This is the code script for getAllObjectNames().
    Is there a function which can getAllGroups() in puzzle?

    #32712

    you can look at the function called getObjectNamesByGroupName in the same file

    Chief 3D Verger | LinkedIn | Twitter

    #32817
    derekwang0605
    Customer

    Thanks it works but get group name retrieved by objects and then removed the repeated groups in the group list. It is a bit time consuming and if there is a better way to retrieve the group list from scene, will be better.

    #32831

    Hi,

    at the moment there is no such API method, but the above-mentioned way should work pretty fast.

    Chief 3D Verger | LinkedIn | Twitter

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.