Data output

Hi how can I use dataoutput in a HTML page?

for example I combine a data to shapediverdataoutput and change name “dimension_box_height”

How will I call that Apı in html page?

I got something but not get correct solution… it is that :

>  </button>
>       <button onclick="getData();">
>     Get Data
>   </button>
>  
>      
> 	<span id="ray_olcusu"></span>

 <script>
}
 function getData() {
var res = api.scene.getData();
document.getElementById('ray_olcusu').innerHTML=res.data[0].name + ": " + res.data[0].data;
} 
<script>

that code always give me same answer whatever “ray_olcusu” become what… What ever I wrote there "dimension_box" or “dimension_pipe” it give me same result :

ShapeDiverDataOutput: 49

what is wrong on that code?

There is nothing wrong in your code, but I think you probably renamed the input of the component, and not the component itself:

I changed all data names both for input name and also data name as photo…

<button onclick="getData();">
    Get Data
  </button>
  <table>
<tr>
<td>
     	 <span id="cita_ara_mesafesi"></span>
      	<span id="cita_sayisi</span>
	<span id="ray_olcusu"></span>
</td>
</tr>
</table>

<script>

function getData() {
  var res = api.scene.getData();
  document.getElementById('cita_ara_mesafesi').innerHTML=res.data[0].data;
  document.getElementById('cita_sayisi').innerHTML=res.data[0].data;
  document.getElementById('ray_olcusu').innerHTML=res.data[0].data;

}

</script>

but still jsut give me the code of “cita_ara_mesafesi”…

Note : I reupload file… so maybe it doesnt changes input parameters. I dont know

I solved problem…

function getData() {

  var res = api.scene.getData();

 document.getElementById('cita_ara_mesafesi').innerHTML=res.data[0].data;

  document.getElementById('cita_sayisi').innerHTML=res.data[1].data;

  document.getElementById('ray_olcusu').innerHTML=res.data[2].data;

}
1 Like

Now there is a problem for that code again… it is that :

 var res = api.scene.getData();

 document.getElementById('direk_papuc_plastigi_carpe').innerHTML=res.data[0].data+ ": " + res.data[0].name;

in that code when I start to change parameters

data[0] start to give me different parameters output…

for example at start it give “direk_papuc_plastigi_carpe” out put and it is the correct one

than I change a parameter on drawing and it give me “oluk_olcusu” output

than I change something else and data[0] become “direk_olcusu” how can I stabilize it…

how shapediver recognize which is .data[0] which is .data[1] etc…I think the problem is the way of that?

There is no way to predict in which order the data assets will be returned by the API. You can easily check their name before using the data they contain, or you can use the getData() function with filters to only return the data you need, for example:

api.scene.getData({name: 'direk_papuc_plastigi_carpe'});

doucmantgetelementbyeID that was the one I got problem…

I changed it like the api.scene.getadta({name:

But now there is nothing working

Assuming that your html ids are identical to the data outputs in your model (otherwise you’ll have to map them somehow):

var res = api.scene.getData().data;
for (let i=0; i<res.length; i++){
    let dataItem = res[i];
    document.getElementById(dataItem.name).innerHTML=dataItem.data+ ": " + dataItem.name;
}
function getData1() {

  var res = api.scene.getData().data;

  for (let i=0; i<res.length; i++){

    let dataItem = res[i];

    document.getElementById(dataItem.direk_papuc_plastigi_carpe).innerHTML=dataItem.data+ ": " + dataItem.name;

    document.getElementById(dataItem.direk_papuc_plastigi).innerHTML=dataItem.data+ ": " + dataItem.name;

    document.getElementById(dataItem.oluk_fitil_carpe).innerHTML=dataItem.data+ ": " + dataItem.name;

    document.getElementById(dataItem.travers_vida_carpe).innerHTML=dataItem.data+ ": " + dataItem.name;

    document.getElementById(dataItem.oluk_fitil).innerHTML=dataItem.data+ ": " + dataItem.name;

    document.getElementById(dataItem.travers_vida).innerHTML=dataItem.data+ ": " + dataItem.name;

    document.getElementById(dataItem.ray_on_baglanti_carpe).innerHTML=dataItem.data+ ": " + dataItem.name;

    document.getElementById(dataItem.ray_on_baglanti).innerHTML=dataItem.data+ ": " + dataItem.name;

    document.getElementById(dataItem.travers_tutucu_sayisi).innerHTML=dataItem.data+ ": " + dataItem.name;
1-----<span id="cita_ara_mesafesi"></span>cita_ara_mesafesi<br>

2-----<span id="cita_sayisi"></span>cita_sayisi<br>

3-----<span id="ray_olcusu"></span> ray_olcusu  <br>

4-----<span id="ray_sayisi"></span> ray_sayisi  <br>

5-----<span id="direk_olcusu"></span>  direk_olcusu <br>

6-----<span id="direk_sayisi"></span> direk_sayisi  <br>

7-----<span id="oluk_olcusu"></span> oluk_olcusu  <br>

8-----<span id="led_sayisi_toplam"></span>   led_sayisi_toplam  <br>

9-----<span id="pino_baglanti_profil_uzunlugu"></span> pino_baglanti_profil_uzunlugu  <br>

10-----<span id="radius"></span> radius   <br>

11-----<span id="arka_direkler"></span>  arka_direkler   <br>

12-----<span id="cita_uzunluk_1"></span> cita_uzunluk_1   <br>

13-----<span id="cita_uzunluk_2"></span>cita_uzunluk_2<br>

when I push getdata1 button stil get no daata :S

3----- ray_olcusu

function getData1() {

  var res = api.scene.getData().data;

for (let i=0; i<res.length; i++){

    let dataItem = res[i];

    document.getElementById(dataItem.ray_olcusu).innerHTML=dataItem.data+ ": " + dataItem.name;

}

}

this is the simplest way ı tried but no result again

I am sorry, I do not understand what you are trying to do. Did you try to just copy and paste exactly the code I wrote above?

I just trying to understand the logic of api outputs work logic…

I have lost of dataoutput with each spesiific name… and I wanna call them correctly… how can I do that…

I think thi is the right way to call datas correctly…

function getData1() {

  var res = api.scene.getData({name: 'direk_olcusu'});

 document.getElementById('direk_olcusu').innerHTML=res.data[0].data+ ": " + res.data[0].name;

 

 var res = api.scene.getData({name: 'cita_ara_mesafesi'});

 document.getElementById('cita_ara_mesafesi').innerHTML=res.data[0].data+ ": " + res.data[0].name;