0 Replies Latest reply on Jan 17, 2018 3:22 PM by chelberg RSS
    chelberg Newbie

    Create or clone model in Javascript?

    Hi folks--

     

    Is it possible to create a new 3D model object, or to clone an existing one, in Javascript? I'm looking for something like this:

     

    $scope.view.wdg['model-2'] = $scope.view.wdg['model-1'].clone();

     

    where model-1 is defined in the experience, but model-2 is not.

     

    My use case is along these lines: I want to have a component, like a LEGO brick, so the user can create more of them (based on the same CAD model) and they can put them together to build something bigger. So, I'd like to have one model in the experience, but have a button that lets the user create another one (make a clone of the first one), and then position it in the experience. So, I need them to be separate instances, and not just a copy that shares a reference to the same 3D object.

     

    I tried duplicating the widget markup, and copying the existing widget object, but neither of those worked.

     

    Thanks for any suggestions, and happy holidays!

     

    --Clay