My purpose is to move the position of the model.
I want to move freely.
Because it is difficult for mobile terminals, assign that function to the button. .
Next, test-code works in the preview.
$scope.incPosX = function()
{
var x;
var y;
var z;
try{
x = parseFloat(tml3dRenderer.GetObject(l_currentSelection).GetWidget().GetLocation().position.x) + 0.005;
y = parseFloat(tml3dRenderer.GetObject(l_currentSelection).GetWidget().GetLocation().position.y);
z = parseFloat(tml3dRenderer.GetObject(l_currentSelection).GetWidget().GetLocation().position.z);
}catch (ex) {
$scope.app.params['x']= "error1" + ex;
console.warn("Exception 1 in tml3dRenderer()=>"+ex);
}
try{
tml3dRenderer.setTranslation(l_currentSelection,x,y,z);
}catch (ex) {
$scope.app.params['y']="error2" + ex;
console.warn("Exception 2 in tml3dRenderer)=>"+ex);
}
}
Exception error in tml3dRenderer.GetObject, it do not work.
Could you tell me how to solve it?
Thanks,
Tsubone
Solved! Go to Solution.
Hi @ytsubone ,
so far I see also some development statements it seems that currently there is no possible to get 'dynamically' modelitems / so this what e.g. the call will do (tml3dRenderer.GetObject('model-1-/0/0/3/2').GetWidget().GetLocation().position.x -> to get the x coordinate for the component for widget id=model-1 with occurrence (component path =/0/0/3/2) )
I also tested and was able to get it working only in preview but not on HoloLens and on Android.
After checking also some development statement seem currently not to be possible (or not yet)
But maybe , there is still solution -but it is definitely not simple.
So for example we have a model (an assembly) . When we create a modelitem for a component with the path e.g. /0/0/3/2
When we check the geometry of the assembly in Creo View we have then e.g.:
So here in this example we can see that the coordinate of the modelItem is a difference of the both coordinate:
0.017m = 17mm = 128.708mm - 111.708 mm
So means that we can calculate the coordinate of all components in Creo View ( Creo View Toolkit) and create a json object which contains an comp path id /occurrence , coordinate x,y,z ,rx,ry,rz and track all changes what we do in studio to know the correct component position.
This is as mention, definitely not simple , because we have to calculate the postion of each component in regards of the accumulated movements along the id path. (so means we have to accumulate the movements (x,y,z ,rx,ry,rz) of e.g. /0/0/3 /2 to the movement of /0/0/3 ( the subassembly containing the part)
More complicated is if we move the subassembly and the part .... in this case we have to consider the both movements. In creo the positions of the components along the component path is considered by transformation matrix where we can simple multiply the matrix to find the end position. In Creo View and in thingview we have a Euler coordinates(x,y,z,rx,ry,rz) but there are also some javaScript libraries which could be used to calculate the correct coordinates
Hi @ytsubone ,
so far I see also some development statements it seems that currently there is no possible to get 'dynamically' modelitems / so this what e.g. the call will do (tml3dRenderer.GetObject('model-1-/0/0/3/2').GetWidget().GetLocation().position.x -> to get the x coordinate for the component for widget id=model-1 with occurrence (component path =/0/0/3/2) )
I also tested and was able to get it working only in preview but not on HoloLens and on Android.
After checking also some development statement seem currently not to be possible (or not yet)
But maybe , there is still solution -but it is definitely not simple.
So for example we have a model (an assembly) . When we create a modelitem for a component with the path e.g. /0/0/3/2
When we check the geometry of the assembly in Creo View we have then e.g.:
So here in this example we can see that the coordinate of the modelItem is a difference of the both coordinate:
0.017m = 17mm = 128.708mm - 111.708 mm
So means that we can calculate the coordinate of all components in Creo View ( Creo View Toolkit) and create a json object which contains an comp path id /occurrence , coordinate x,y,z ,rx,ry,rz and track all changes what we do in studio to know the correct component position.
This is as mention, definitely not simple , because we have to calculate the postion of each component in regards of the accumulated movements along the id path. (so means we have to accumulate the movements (x,y,z ,rx,ry,rz) of e.g. /0/0/3 /2 to the movement of /0/0/3 ( the subassembly containing the part)
More complicated is if we move the subassembly and the part .... in this case we have to consider the both movements. In creo the positions of the components along the component path is considered by transformation matrix where we can simple multiply the matrix to find the end position. In Creo View and in thingview we have a Euler coordinates(x,y,z,rx,ry,rz) but there are also some javaScript libraries which could be used to calculate the correct coordinates
on second thought , I think there is another option which could be more easy as to use Creo View Toolkit. I personally will use Creo View Toolkit because I have experience with it , but no evrybody have license and knowledge how to extract the data from the pvz file.
so the new option is to create a script what is called only in preview mode ( checking e.g. if this is preview) and create a json which contains the components (position , with path ids). Later when you start the Experience on enddevice you can use this data to have the position of the components.
I am planing for the next 2 week to implement such tools in javaScript (it requires of course some work) and to provide it as information - as Post in the Tech Tips Studio
Hi RolandRaytchev
Thank you for your support.
The advice showed that we can do this by listing coordinates in CreoView.
I have also used Creo View toolkit in the past.
You can wait to provide information in two weeks.
Thank! Thank!
Tsubone