cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Manipulate a Component with "PathID" instead of "Model Item Widget"

Highlighted
Amethyst

Manipulate a Component with "PathID" instead of "Model Item Widget"

Hi there,

 

In the post How to select model components in a 3d model without explicit definition of model Items?

I noticed that it is possible to manipulate a Component with "PathID" instead of "Model Item Widget".

 

$scope.currentSelection = target + "-" + pathid;  
          // create a component selection e.g. "model-1-/0/0/3/2"

 

 But somehow, I couldn't make it work.

I use Model Item Widget at first. Which works.

(The Model Item Properties Component Occurrence is /0/5 )

$scope.colorRed = function(){
$scope.view.wdg['modelItem-1']['color'] = "rgba(200, 0, 0, 1)";
};

Then I delete the Model Item Widget, and use PathID to identify specific component.

 But it is not working with a "PathID".

$scope.colorRed = function(){
    $scope.view.wdg['model-1-/0/5']['color'] = "rgba(200, 0, 0, 1)";
};

 

I really want to make the PathID method work.

Any advice would be appreciated.

Thanks in advance.

 

ClarK

2 REPLIES 2

Re: Manipulate a Component with "PathID" instead of "Model Item Widget"

Hi @dsgnrClarK,

 

no , this will not work because this is some functionlaity what is more then internal and you do not  have in fact a widget definition . Therefore   you can not use the widget syntax.

So to set the values of the colore you can use some think like:

...
var OPACITY_VAL=0.2;
var PICK_COLOR_WITH_OPACITY_TEMP  = "rgba(256,100,0,0.0)";
var PICK_COLOR_WITH_OPACITY= PICK_COLOR_OPACITY_TEMP.replace( "0.0)",OPACITY_VAL+")");

 try{ 
   
   if(twx.app.isPreview() == true) //the preview ignorre the opacity in the color value
  tml3dRenderer.GetObject('model-1-/0/0/3/2').GetWidget().ApplyOccludeOpacity(0.0,OPACITY_VAL);

     tml3dRenderer.setColor('model-1-/0/0/3/2',     PICK_COLOR_WITH_OPACITY );  
} catch (e1234) {$scope.view.wdg['3DLabel-1']['text']= "exception="+e1234; }

On mobile device the setColor method will work fine and will assignee both the color and transparency (alpha channel parameter in the rgba definition)

but in the Preview mode the alpha cannel parameter is ignored and need to be extra assigned via the ApplyOccludeOpacity method

Re: Manipulate a Component with "PathID" instead of "Model Item Widget"

For setting generaly  of temp model items properties you can also use this API:

setProperties: function (name, props, successCallback, errorCallback)
where

-name is the name of the node to set properties upon
-props is a dictionary/map contains property name/value pairs to set; properties are opacity, hidden, occlude, billboard, decal, shader, phantom, forceHidden
-successCallback and errorCallback are the completion callbacks

 

$scope.currentSelection='model-1-/0/1/1';
tml3dRenderer.setProperties ($scope.currentSelection, {opacity: 1.0, phantom: true});


//Phantom is not normal transparency. There are, limitations to normal transparency.

 

...
tml3dRenderer.setProperties ($scope.currentSelection, {opacity: 5.0});

or
...
tml3dRenderer.setProperties ($scope.currentSelection, {opacity: 5.0},
function() {console.log("success!"} ,function() {console.log("error occured!"});